emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Kaushal <kaushal.modi@gmail.com>
To: Richard Lawrence <richard.lawrence@berkeley.edu>
Cc: emacs-orgmode@gnu.org
Subject: Re: Enforcing newlines in plain text export
Date: Fri, 26 Sep 2014 12:04:05 -0400	[thread overview]
Message-ID: <CAFyQvY2PbPaNJtZqzAytHF26p58VPjE2qhq4vzwrtxk-vtbydw@mail.gmail.com> (raw)
In-Reply-To: <87r3yybcqs.fsf@berkeley.edu>

[-- 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 --]

  reply	other threads:[~2014-09-26 16:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFyQvY2PbPaNJtZqzAytHF26p58VPjE2qhq4vzwrtxk-vtbydw@mail.gmail.com \
    --to=kaushal.modi@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=richard.lawrence@berkeley.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).