emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Macro question


From: Fabrice Popineau
Subject: Re: [O] Macro question
Date: Fri, 23 Oct 2015 23:33:35 +0200

Hello Nicolas,

2015-10-23 22:37 GMT+02:00 Nicolas Goaziou <address@hidden>:
Hello,

Fabrice Popineau <address@hidden> 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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]