* Fwd: Enforcing newlines in plain text export [not found] <CAFyQvY2PtupGAuDX_UDMHiJgSvTUYYGKeVqfvCzZFAU9m-KJ7g@mail.gmail.com> @ 2014-09-26 15:52 ` Richard Lawrence 2014-09-26 16:04 ` Kaushal 0 siblings, 1 reply; 9+ messages in thread From: Richard Lawrence @ 2014-09-26 15:52 UTC (permalink / raw) To: Kaushal; +Cc: emacs-orgmode Hi Kaushal, I am forwarding your message to the Org mode list; you only sent it to me and Nicolas... Kaushal <kaushal.modi@gmail.com> writes: > I came across > https://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00466.html > through this emacs SE page: > http://emacs.stackexchange.com/questions/255/new-line-in-title-of-an-org-mode-exported-html-document > > The question I had asked on stackexchange was: How to export a mid-line > newline consistently in all formats. In paragraphs, all you need to do is end a line with "\\" to force a line break. This works for LaTeX, HTML, and plain text export, at least. This doesn't work in other kinds of syntax, like headlines, but you may not need it there. > But I couldn't figure out how to convey a newline character when exporting > to plain text (ascii). > > I tried, > > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:\n@@ > > But that simply puts out "\n" verbatim in the exported txt file. I don't know the answer to this specific issue---you might need to create a custom export filter---but hopefully you can just use "\\" instead of a macro like this. Do you need to enforce line breaks *outside of* a paragraph in plain text export? If so, what case are you worried about specifically? Best, Richard OpenPGP Key ID: CF6FA646 Fingerprint: 9969 43E1 CF6F A646 (See http://www.ocf.berkeley.edu/~rwl/encryption.html for more information.) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-26 15:52 ` Fwd: Enforcing newlines in plain text export Richard Lawrence @ 2014-09-26 16:04 ` Kaushal 2014-09-26 16:14 ` Kaushal 2014-09-27 0:46 ` Richard Lawrence 0 siblings, 2 replies; 9+ messages in thread From: Kaushal @ 2014-09-26 16:04 UTC (permalink / raw) To: Richard Lawrence; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 3266 bytes --] The reason I switched to using this {{{NEWLINE}}} macro is that I wanted consistent results wherever I used it for any kind of export. Example: ----- #+TITLE: First Line of Title // Second Line of Title ----- Above works for only latex > pdf exports. HTML export of above keeps the `//` characters verbatim. So I did the below: ----- #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ #+TITLE: First Line of Title {{{NEWLINE}}} Second Line of Title ----- The above solution looks clean to me, but now that doesn't work for ascii exports as I don't know what to put in between "@@ascii:@@" to get a newline in ascii exports. Interesting thing is that `//` work fine at the end of the lines. If I have the below: ----- Some text in org file on first line // Some text in org file on second line // Some text in org file on third line ----- .. then the pdf, html, ascii exports interpret `//` as a newline character. For consistency, now I use: ----- Some text in org file on first line {{{NEWLINE}}} Some text in org file on second line {{{NEWLINE}}} Some text in org file on third line ----- I am just waiting to know the magic characters for ascii exports that can give me newlines by using the above macro. Then I don't have to worry whether I am using `//` at the end of the line or in the middle of a line. The end result would be: ----- #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:NEWLINE_CHARACTERS_FOR_ASCII_EXPORT@@ #+TITLE: First Line of Title {{{NEWLINE}}} Second Line of Title Some text in org file on first line {{{NEWLINE}}} Some text in org file on second line {{{NEWLINE}}} Some text in org file on third line ----- -- Kaushal Modi On Fri, Sep 26, 2014 at 11:52 AM, Richard Lawrence < richard.lawrence@berkeley.edu> wrote: > Hi Kaushal, > > I am forwarding your message to the Org mode list; you only sent it to > me and Nicolas... > > Kaushal <kaushal.modi@gmail.com> writes: > > > I came across > > https://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00466.html > > through this emacs SE page: > > > http://emacs.stackexchange.com/questions/255/new-line-in-title-of-an-org-mode-exported-html-document > > > > The question I had asked on stackexchange was: How to export a mid-line > > newline consistently in all formats. > > In paragraphs, all you need to do is end a line with "\\" to force a > line break. This works for LaTeX, HTML, and plain text export, at least. > > This doesn't work in other kinds of syntax, like headlines, but you may > not need it there. > > > But I couldn't figure out how to convey a newline character when > exporting > > to plain text (ascii). > > > > I tried, > > > > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:\n@@ > > > > But that simply puts out "\n" verbatim in the exported txt file. > > I don't know the answer to this specific issue---you might need to > create a custom export filter---but hopefully you can just use "\\" > instead of a macro like this. > > Do you need to enforce line breaks *outside of* a paragraph in plain > text export? If so, what case are you worried about specifically? > > Best, > Richard > > OpenPGP Key ID: CF6FA646 > Fingerprint: 9969 43E1 CF6F A646 > > (See http://www.ocf.berkeley.edu/~rwl/encryption.html for more > information.) > [-- Attachment #2: Type: text/html, Size: 8869 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-26 16:04 ` Kaushal @ 2014-09-26 16:14 ` Kaushal 2014-09-27 0:46 ` Richard Lawrence 1 sibling, 0 replies; 9+ messages in thread From: Kaushal @ 2014-09-26 16:14 UTC (permalink / raw) To: Richard Lawrence; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 4692 bytes --] > Do you need to enforce line breaks *outside of* a paragraph in plain > text export? If so, what case are you worried about specifically? I forgot to answer this question.. I need to force line breaks in cases like these ----- For example, to execute the =example_1= test and run in the {{{NEWLINE}}} =/some/long/path/that/wouldn't/fit/along/with/the/above/line/in/the/same/line= directory, do the following.. ----- In the above example, org-export will not wrap the text between the verbatim formatting characters "=". To ensure that the exported formats (html/pdf/ascii) look clean, I have to force a newline character just before that long string. Now using "\\" here instead of {{{NEWLINE}}} works but then I have to ensure that I place the "\\" character at the very end. If they are placed mid-line then they will be interpreted as newline by latex but simply "\\" character by html exporter. For consistency, the {{{NEWLINE}}} approach looks better; hoping that org-mode will support a special newline character for ascii exports at some time: ----- #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:NEWLINE_CHARACTERS_ FOR_ASCII_EXPORT@@ ----- -- Kaushal Modi On Fri, Sep 26, 2014 at 12:04 PM, Kaushal <kaushal.modi@gmail.com> wrote: > The reason I switched to using this {{{NEWLINE}}} macro is that I wanted > consistent results wherever I used it for any kind of export. > > Example: > > ----- > #+TITLE: First Line of Title // Second Line of Title > ----- > > Above works for only latex > pdf exports. > HTML export of above keeps the `//` characters verbatim. > > So I did the below: > > ----- > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ > #+TITLE: First Line of Title {{{NEWLINE}}} Second Line of Title > ----- > > The above solution looks clean to me, but now that doesn't work for ascii > exports as I don't know what to put in between "@@ascii:@@" to get a > newline in ascii exports. > > > Interesting thing is that `//` work fine at the end of the lines. > If I have the below: > > ----- > Some text in org file on first line // > Some text in org file on second line // > Some text in org file on third line > ----- > > .. then the pdf, html, ascii exports interpret `//` as a newline character. > > For consistency, now I use: > > ----- > Some text in org file on first line {{{NEWLINE}}} > Some text in org file on second line {{{NEWLINE}}} > Some text in org file on third line > ----- > > I am just waiting to know the magic characters for ascii exports that can > give me newlines by using the above macro. Then I don't have to worry > whether I am using `//` at the end of the line or in the middle of a line. > > The end result would be: > > ----- > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ > @@ascii:NEWLINE_CHARACTERS_FOR_ASCII_EXPORT@@ > #+TITLE: First Line of Title {{{NEWLINE}}} Second Line of Title > Some text in org file on first line {{{NEWLINE}}} > Some text in org file on second line {{{NEWLINE}}} > Some text in org file on third line > ----- > > > > > > > > -- > Kaushal Modi > > On Fri, Sep 26, 2014 at 11:52 AM, Richard Lawrence < > richard.lawrence@berkeley.edu> wrote: > >> Hi Kaushal, >> >> I am forwarding your message to the Org mode list; you only sent it to >> me and Nicolas... >> >> Kaushal <kaushal.modi@gmail.com> writes: >> >> > I came across >> > https://lists.gnu.org/archive/html/emacs-orgmode/2014-09/msg00466.html >> > through this emacs SE page: >> > >> http://emacs.stackexchange.com/questions/255/new-line-in-title-of-an-org-mode-exported-html-document >> > >> > The question I had asked on stackexchange was: How to export a mid-line >> > newline consistently in all formats. >> >> In paragraphs, all you need to do is end a line with "\\" to force a >> line break. This works for LaTeX, HTML, and plain text export, at least. >> >> This doesn't work in other kinds of syntax, like headlines, but you may >> not need it there. >> >> > But I couldn't figure out how to convey a newline character when >> exporting >> > to plain text (ascii). >> > >> > I tried, >> > >> > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:\n@@ >> > >> > But that simply puts out "\n" verbatim in the exported txt file. >> >> I don't know the answer to this specific issue---you might need to >> create a custom export filter---but hopefully you can just use "\\" >> instead of a macro like this. >> >> Do you need to enforce line breaks *outside of* a paragraph in plain >> text export? If so, what case are you worried about specifically? >> >> Best, >> Richard >> >> OpenPGP Key ID: CF6FA646 >> Fingerprint: 9969 43E1 CF6F A646 >> >> (See http://www.ocf.berkeley.edu/~rwl/encryption.html for more >> information.) >> > > [-- Attachment #2: Type: text/html, Size: 12354 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-26 16:04 ` Kaushal 2014-09-26 16:14 ` Kaushal @ 2014-09-27 0:46 ` Richard Lawrence 2014-09-27 3:59 ` Kaushal 1 sibling, 1 reply; 9+ messages in thread From: Richard Lawrence @ 2014-09-27 0:46 UTC (permalink / raw) To: Kaushal; +Cc: emacs-orgmode Kaushal <kaushal.modi@gmail.com> writes: > Interesting thing is that `\\` work fine at the end of the lines. Yes, this is the behavior documented in the manual. > I need to force line breaks in cases like these > > ----- > For example, to execute the =example_1= test and run in the {{{NEWLINE}}} > > =/some/long/path/that/wouldn't/fit/along/with/the/above/line/in/the/same/line= > directory, > do the following.. > ----- > > In the above example, org-export will not wrap the text between the > verbatim formatting characters "=". > To ensure that the exported formats (html/pdf/ascii) look clean, I have to > force a newline character just before that long string. > > Now using "\\" here instead of {{{NEWLINE}}} works but then I have to > ensure that I place the "\\" character at the very end. If they are placed > mid-line then they will be interpreted as newline by latex but simply "\\" > character by html exporter. As you say, "\\" at the end of the line works fine in this case. So it seems you do not have a need for another solution. > For consistency, the {{{NEWLINE}}} approach looks better; hoping that > org-mode will support a special newline character for ascii exports at some > time: > > ----- > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:NEWLINE_CHARACTERS_ > FOR_ASCII_EXPORT@@ > ----- This would really not be a great solution, and I don't think you should expect Org mode to support it. If you really need something like this, you could write an export filter for yourself (e.g., one that replaces the string "ASCII_NEWLINE_CHARACTER" with "\n" in the exported buffer). See the "Advanced configuration" section of the Exporting chapter in the manual. A better and more general solution, I think, would be to allow "\\" to be used in other contexts, such as in headlines, title/author/date declarations, etc. But that is a change to the currently documented syntax, and it is probably a fair amount of work to implement, so it probably isn't going to happen unless a variety of users really need it and the maintainers think it would be an improvement to Org. Best, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-27 0:46 ` Richard Lawrence @ 2014-09-27 3:59 ` Kaushal 2014-09-27 15:59 ` Richard Lawrence 0 siblings, 1 reply; 9+ messages in thread From: Kaushal @ 2014-09-27 3:59 UTC (permalink / raw) To: Richard Lawrence; +Cc: emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 2815 bytes --] I am requesting a consistent solution. If "//" at the end of a line inserts newline when exporting in all formats, then it should do the same when used in between a line too for ALL export formats. Example: #+TITLE: Line one // Line two I am simply trying to explain why we need another solution for the sake of consistency across all org exported formats. But I understand if the org team doesn't think it worthwhile to implement. I'll look into the export filter configuration. Thanks. Kaushal On Sep 26, 2014 8:47 PM, "Richard Lawrence" <richard.lawrence@berkeley.edu> wrote: > Kaushal <kaushal.modi@gmail.com> writes: > > > Interesting thing is that `\\` work fine at the end of the lines. > > Yes, this is the behavior documented in the manual. > > > I need to force line breaks in cases like these > > > > ----- > > For example, to execute the =example_1= test and run in the {{{NEWLINE}}} > > > > > =/some/long/path/that/wouldn't/fit/along/with/the/above/line/in/the/same/line= > > directory, > > do the following.. > > ----- > > > > In the above example, org-export will not wrap the text between the > > verbatim formatting characters "=". > > To ensure that the exported formats (html/pdf/ascii) look clean, I have > to > > force a newline character just before that long string. > > > > Now using "\\" here instead of {{{NEWLINE}}} works but then I have to > > ensure that I place the "\\" character at the very end. If they are > placed > > mid-line then they will be interpreted as newline by latex but simply > "\\" > > character by html exporter. > > As you say, "\\" at the end of the line works fine in this case. So it > seems you do not have a need for another solution. > > > For consistency, the {{{NEWLINE}}} approach looks better; hoping that > > org-mode will support a special newline character for ascii exports at > some > > time: > > > > ----- > > #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:NEWLINE_CHARACTERS_ > > FOR_ASCII_EXPORT@@ > > ----- > > This would really not be a great solution, and I don't think you should > expect Org mode to support it. If you really need something like this, > you could write an export filter for yourself (e.g., one that replaces > the string "ASCII_NEWLINE_CHARACTER" with "\n" in the exported buffer). > See the "Advanced configuration" section of the Exporting chapter in the > manual. > > A better and more general solution, I think, would be to allow "\\" to > be used in other contexts, such as in headlines, title/author/date > declarations, etc. But that is a change to the currently documented > syntax, and it is probably a fair amount of work to implement, so it > probably isn't going to happen unless a variety of users really need it > and the maintainers think it would be an improvement to Org. > > Best, > Richard > [-- Attachment #2: Type: text/html, Size: 3583 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-27 3:59 ` Kaushal @ 2014-09-27 15:59 ` Richard Lawrence 2014-09-27 21:17 ` Nicolas Goaziou 2014-09-28 1:30 ` Alexis 0 siblings, 2 replies; 9+ messages in thread From: Richard Lawrence @ 2014-09-27 15:59 UTC (permalink / raw) To: emacs-orgmode; +Cc: Kaushal Hi Kaushal, Kaushal <kaushal.modi@gmail.com> writes: > I am requesting a consistent solution. > > If "//" at the end of a line inserts newline when exporting in all formats, > then it should do the same when used in between a line too for ALL export > formats. > > Example: #+TITLE: Line one // Line two > > I am simply trying to explain why we need another solution for the sake of > consistency across all org exported formats. Like I said, I agree that something like this would be useful; I occasionally would like "\\" to have more general behavior, too. Anyway, it seems worth discussing. My point is that this would be a new feature, which is technically *inconsistent* with the currently-documented behavior. Implementing it would take some work and would involve breaking backward compatibility. (At least in theory -- I don't know if anyone out there relies on "\\" *not* being translated when it does not appear at the end of a line, but someone might be.) So it's not something to be taken lightly. Does anyone know why the behavior of "\\" is presently restricted to appearing at the end of the line in a paragraph? Does anyone need it to be exported literally when it appears elsewhere? Best, Richard ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-27 15:59 ` Richard Lawrence @ 2014-09-27 21:17 ` Nicolas Goaziou 2014-09-27 21:37 ` Kaushal 2014-09-28 1:30 ` Alexis 1 sibling, 1 reply; 9+ messages in thread From: Nicolas Goaziou @ 2014-09-27 21:17 UTC (permalink / raw) To: Richard Lawrence; +Cc: emacs-orgmode, Kaushal Hello, Richard Lawrence <richard.lawrence@berkeley.edu> writes: > Does anyone know why the behavior of "\\" is presently restricted to > appearing at the end of the line in a paragraph? I certainly can see a good reason for it, although I don't know if it is the historical one. Org syntax is primarily intended for Org documents. When in an _Org_ buffer, what would be the meaning of a line break in the middle of a line? Regards, -- Nicolas Goaziou ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-27 21:17 ` Nicolas Goaziou @ 2014-09-27 21:37 ` Kaushal 0 siblings, 0 replies; 9+ messages in thread From: Kaushal @ 2014-09-27 21:37 UTC (permalink / raw) To: Richard Lawrence, emacs-orgmode [-- Attachment #1: Type: text/plain, Size: 701 bytes --] I needed to have multi line titles exported in all formats consistently and that's when I need to use '\\' mid-line. -- Kaushal Modi On Sep 27, 2014 5:16 PM, "Nicolas Goaziou" <mail@nicolasgoaziou.fr> wrote: > Hello, > > Richard Lawrence <richard.lawrence@berkeley.edu> writes: > > > Does anyone know why the behavior of "\\" is presently restricted to > > appearing at the end of the line in a paragraph? > > I certainly can see a good reason for it, although I don't know if it is > the historical one. > > Org syntax is primarily intended for Org documents. When in an _Org_ > buffer, what would be the meaning of a line break in the middle of > a line? > > > Regards, > > -- > Nicolas Goaziou > [-- Attachment #2: Type: text/html, Size: 1122 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Enforcing newlines in plain text export 2014-09-27 15:59 ` Richard Lawrence 2014-09-27 21:17 ` Nicolas Goaziou @ 2014-09-28 1:30 ` Alexis 1 sibling, 0 replies; 9+ messages in thread From: Alexis @ 2014-09-28 1:30 UTC (permalink / raw) To: emacs-orgmode Richard Lawrence writes: > Does anyone know why the behavior of "\\" is presently restricted to > appearing at the end of the line in a paragraph? Does anyone need it > to be exported literally when it appears elsewhere? When exporting code listings in any programming language which uses '\' for escaping characters in strings, and subsequently uses '\\' to mean "literal backslash", literal export is required. For example, one might have an Org document with Emacs Lisp source: ----- ' * A | ** B | #+begin_src emacs-lisp | (setq my-regex "\\\\(.+\\\\)") | #+end_src `----- Alexis. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2014-09-28 1:39 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <CAFyQvY2PtupGAuDX_UDMHiJgSvTUYYGKeVqfvCzZFAU9m-KJ7g@mail.gmail.com> 2014-09-26 15:52 ` Fwd: Enforcing newlines in plain text export Richard Lawrence 2014-09-26 16:04 ` Kaushal 2014-09-26 16:14 ` Kaushal 2014-09-27 0:46 ` Richard Lawrence 2014-09-27 3:59 ` Kaushal 2014-09-27 15:59 ` Richard Lawrence 2014-09-27 21:17 ` Nicolas Goaziou 2014-09-27 21:37 ` Kaushal 2014-09-28 1:30 ` Alexis
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).