From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Popineau Subject: Re: Macro question Date: Sat, 24 Oct 2015 11:39:24 +0200 Message-ID: References: <87fv11z5h3.fsf@nicolasgoaziou.fr> <871tclz0t4.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113b697607dae80522d68260 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpvIf-0002Fl-3j for emacs-orgmode@gnu.org; Sat, 24 Oct 2015 05:39:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZpvIe-0006B9-0c for emacs-orgmode@gnu.org; Sat, 24 Oct 2015 05:39:45 -0400 Received: from mail-oi0-x22d.google.com ([2607:f8b0:4003:c06::22d]:36213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZpvId-0006B5-Qw for emacs-orgmode@gnu.org; Sat, 24 Oct 2015 05:39:43 -0400 Received: by oiao187 with SMTP id o187so77957103oia.3 for ; Sat, 24 Oct 2015 02:39:43 -0700 (PDT) In-Reply-To: <871tclz0t4.fsf@nicolasgoaziou.fr> 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: Fabrice Popineau , "emacs-orgmode@gnu.org" --001a113b697607dae80522d68260 Content-Type: text/plain; charset=UTF-8 2015-10-24 0:18 GMT+02:00 Nicolas Goaziou : > Fabrice Popineau 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:
@@ 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:
@@ 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:
@@ * Section 2 Some text. {{{newline}}} Some other text. #+html:
#+latex: \\ Some other other text. ------------------------------------------------------------------------------------------ The macro way isn't a proper way: the
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:
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 --001a113b697607dae80522d68260 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


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).




#+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 o= ne.

OTOH, resorting to babel blocks to insert a ne= wline is not viable option: it takes much more to achieve something very si= mple.

Basically, macros are of no help to solve th= is :

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

* Section= 2

Some text.

{{{newline}= }}

Some other text.

#+htm= l: <br/>
#+latex: \\

Some other ot= her text.
-------------------------------------------------= -----------------------------------------

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

=
Some other text.
#+latex: \\

=
#+html: <br/>

If I'm wrong, t= hanks 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
--001a113b697607dae80522d68260--