emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: Fabrice Popineau <fabrice.popineau@gmail.com>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Macro question
Date: Sat, 24 Oct 2015 11:39:24 +0200	[thread overview]
Message-ID: <CAFgFV9Osqjq1uMs8+zz9RBeA=omDWmwfxs-e6mbeCYgPADZ08w@mail.gmail.com> (raw)
In-Reply-To: <871tclz0t4.fsf@nicolasgoaziou.fr>

[-- Attachment #1: Type: text/plain, Size: 1832 bytes --]

2015-10-24 0:18 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > I agree that raw html can be output by macros, but it can easily break
> > too.
>
> I think you are missing the "inline part". You cannot use macros to
> generate, or even replace a block element in HTML (e.g., a paragraph).
>
> Well, thinking about it, "raw inline html" needs to be clarified for me,
because
even a mere :

@@html:<br/>@@

is surrounded by a paragraph.

My point is that what can be achieved by macros depends on the backend,
which defeats part of the purpose of having a high level markup language.

#+MACRO: newline @@latex:\\@@ @@html:<br/>@@

This works for LaTeX, because LaTeX has no markup for paragraphs (I agree
it is pure luck), but fails
for HTML because there is one.

OTOH, resorting to babel blocks to insert a newline is not viable option:
it takes much more to achieve something very simple.

Basically, macros are of no help to solve this :

------------------------------------------------------------------------------------------
#+MACRO: newline @@latex:\\@@ @@html:<br/>@@

* Section 2

Some text.

{{{newline}}}

Some other text.

#+html: <br/>
#+latex: \\

Some other other text.
------------------------------------------------------------------------------------------

The macro way isn't a proper way: the <br/> will be embedded in a
paragraph, where it shouldn't.
Only the second way achieves cleanly the expected effect. Well, not quite
because in LaTeX, the \\ should stick to the paragraph.
So it should be :

Some other text.
#+latex: \\

#+html: <br/>

If I'm wrong, thanks for pointing me to the right way to use macros.
And if I'm right, maybe in the long term, Org needs another, different,
macro system
to help at this level.

Regards,

Fabrice

[-- Attachment #2: Type: text/html, Size: 3022 bytes --]

  reply	other threads:[~2015-10-24  9:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23 20:24 Macro question Fabrice Popineau
2015-10-23 20:37 ` Nicolas Goaziou
2015-10-23 21:33   ` Fabrice Popineau
2015-10-23 22:18     ` Nicolas Goaziou
2015-10-24  9:39       ` Fabrice Popineau [this message]
2015-10-24  9:53         ` Nicolas Goaziou
2015-10-24 11:37           ` Fabrice Popineau
2015-10-24 11:44             ` Nicolas Goaziou
2015-10-24 17:02             ` Eric S Fraga
2015-10-25  9:45               ` Fabrice Popineau
2015-10-25 12:04                 ` Eric S Fraga

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='CAFgFV9Osqjq1uMs8+zz9RBeA=omDWmwfxs-e6mbeCYgPADZ08w@mail.gmail.com' \
    --to=fabrice.popineau@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /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).