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: Fri, 23 Oct 2015 23:33:35 +0200	[thread overview]
Message-ID: <CAFgFV9MOCwn4BKUyHcN0YzmjLHuH=Z1pB3+o0xOR7nOxzuF4pg@mail.gmail.com> (raw)
In-Reply-To: <87fv11z5h3.fsf@nicolasgoaziou.fr>

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

Hello Nicolas,

2015-10-23 22:37 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Hello,
>
> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > I was wondering if macros could be used to output raw html code, but that
> > doesn't seem to be the case.
> >
> > Namely:
> >
> > #+macro: bfoo @@html:<div class"foo">@@
> > #+macro: efoo @@html:</div>@@
> >
> > The macros {{{bfoo}}} and {{{efoo}}} are expanded surrounded by <p> ...
> > </p>.
>
> Macros can output raw inline HTML code. If you want to generate any HTML
> code, you can use some babel block to do that.
>
>
I agree that raw html can be output by macros, but it can easily break too.

At the moment :

---------------------------------------------------------------------------------------------
#+macro: bfoo @@html:<div class"foo">@@
#+macro: efoo @@html:</div>@@

* Section

{{{bfoo}}}

Some text.

{{{efoo}}}
---------------------------------------------------------------------------------------------

is exported as :

---------------------------------------------------------------------------------------------
<div id="outline-container-orgheadline1" class="outline-2">
<h2 id="orgheadline1">Section</h2>
<div class="outline-text-2" id="text-orgheadline1">
<p>

</p>

<p>
<div class"foo">
</p>

<p>
Some text.
</p>

<p>
</div>
</p>
</div>
</div>
---------------------------------------------------------------------------------------------

But :

---------------------------------------------------------------------------------------------
#+macro: bfoo @@html:<div class"foo">@@
#+macro: efoo @@html:</div>@@

* Section

{{{bfoo}}}
Some text.
{{{efoo}}}
---------------------------------------------------------------------------------------------

is exported as :

---------------------------------------------------------------------------------------------
<div id="outline-container-orgheadline1" class="outline-2">
<h2 id="orgheadline1">Section</h2>
<div class="outline-text-2" id="text-orgheadline1">
<p>

</p>

<p>
<div class"foo">
Some text.
</div>
</p>
</div>
</div>
---------------------------------------------------------------------------------------------

In the first case, the <p> ... </p> are quite annoying.
In the second case,  the <p> ... </p> is spurious, but at least it doesn't
break the structure.

I wonder if there is a way to guess where ox-html could avoid to emit
paragraphs.

Regards,

Fabrice

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

  reply	other threads:[~2015-10-23 21:33 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 [this message]
2015-10-23 22:18     ` Nicolas Goaziou
2015-10-24  9:39       ` Fabrice Popineau
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='CAFgFV9MOCwn4BKUyHcN0YzmjLHuH=Z1pB3+o0xOR7nOxzuF4pg@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).