From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Subject: Re: Enforcing newlines in plain text export Date: Fri, 26 Sep 2014 12:04:05 -0400 Message-ID: References: <87r3yybcqs.fsf@berkeley.edu> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d5ec866b3310503fa13fd Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXY0s-0005Mf-67 for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 12:04:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XXY0q-0003mG-8f for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 12:04:54 -0400 Received: from mail-wi0-x22f.google.com ([2a00:1450:400c:c05::22f]:39373) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XXY0p-0003lq-Sd for emacs-orgmode@gnu.org; Fri, 26 Sep 2014 12:04:52 -0400 Received: by mail-wi0-f175.google.com with SMTP id r20so11272721wiv.14 for ; Fri, 26 Sep 2014 09:04:45 -0700 (PDT) In-Reply-To: <87r3yybcqs.fsf@berkeley.edu> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Richard Lawrence Cc: emacs-orgmode@gnu.org --047d7b5d5ec866b3310503fa13fd Content-Type: text/plain; charset=ISO-8859-1 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:
@@ #+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:
@@ @@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 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:
@@ @@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.) > --047d7b5d5ec866b3310503fa13fd Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
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 `//` cha= racters verbatim.

So I did the below:

---= --
#+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@
=
#+TITL= E: 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 "@@a= scii:@@" to get a newline in ascii exports.


I= f I have the below:

-----
Some text in org file on f= irst line //
Some text in org file on second line //
Some text = in org file on third line
-----

.. then the pdf, htm= l, ascii exports interpret `//` as a newline character.

Fo= r consistency, now I use:

-----
Some text in org file on first line {{{NEWLINE}}}
Som= e 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 whethe= r 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}}} Se= cond Line of Title
Some text in org file on first line {{{NEWLINE}}}<= br>
<= font face=3D"trebuchet ms, sans-serif">Some text in org file on second line= {{{NEWLINE}}}
Some text in org file on third line
-----=

<= /div>






--
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.co= m> writes:

> I came across
> https://lists.gnu.org/archive/html/emacs-org= mode/2014-09/msg00466.html
> through this emacs SE page:
> http://emacs.s= tackexchange.com/questions/255/new-line-in-title-of-an-org-mode-exported-ht= ml-document
>
> The question I had asked on stackexchange was: How to export a mid-lin= e
> newline consistently in all formats.

In paragraphs, all you need to do is end a line with "\\" to forc= e a
line break.=A0 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 e= xporting
> to plain text (ascii).
>
> I tried,
>
> #+MACRO: NEWLINE @@latex:\\@@ @@html:<br>@@ @@ascii:\n@@
>
> But that simply puts out "\n" verbatim in the exported txt f= ile.

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 "\\&quo= t;
instead of a macro like this.

Do you need to enforce line breaks *outside of* a paragraph in plain
text export?=A0 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 info= rmation.)

--047d7b5d5ec866b3310503fa13fd--