emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ATTR_HTML for a clickable image, howto?
@ 2012-04-01 21:27 François Pinard
  2012-04-02  8:14 ` Bastien
  0 siblings, 1 reply; 28+ messages in thread
From: François Pinard @ 2012-04-01 21:27 UTC (permalink / raw)
  To: emacs-orgmode

Hello, Org mode friends.

I just got a slight difficulty for which some of you may have an
advice.  My source looks like this:

--8<---------------cut here---------------start------------->8---
#+ATTR_HTML: align="right"
[[file:2011-06-04-gazou-passeport.png][file:2011-06-04-gazou-passeport-petit.jpg]]
--8<---------------cut here---------------end--------------->8---

and once converted to HTML, yields (reformatted for legibility):

--8<---------------cut here---------------start------------->8---
<a href="2011-06-04-gazou-passeport.png"
   align="right">
  <img src="2011-06-04-gazou-passeport-petit.jpg"
       alt="2011-06-04-gazou-passeport-petit.jpg"/>
</a>
--8<---------------cut here---------------end--------------->8---

The ATTR_HTML details got applied to the <a> tag while I wanted them to
be on the <img> tag.  If I hand-edit the result so it is:

--8<---------------cut here---------------start------------->8---
<a href="2011-06-04-gazou-passeport.png">
  <img src="2011-06-04-gazou-passeport-petit.jpg"
       alt="2011-06-04-gazou-passeport-petit.jpg"
       align="right"/>
</a>
--8<---------------cut here---------------end--------------->8---

then I get the display I wanted.  Is there a way for having #+ATTR_HTML
to be applied to the inner tag instead of the outer one?

François

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-01 21:27 ATTR_HTML for a clickable image, howto? François Pinard
@ 2012-04-02  8:14 ` Bastien
  2012-04-02 10:34   ` Christian Moe
  2012-04-05 15:02   ` François Pinard
  0 siblings, 2 replies; 28+ messages in thread
From: Bastien @ 2012-04-02  8:14 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi François,

pinard@iro.umontreal.ca (François Pinard) writes:

> then I get the display I wanted.  Is there a way for having #+ATTR_HTML
> to be applied to the inner tag instead of the outer one?

Not -- it would not make sense.

I suggest you fix your css instead.

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-02  8:14 ` Bastien
@ 2012-04-02 10:34   ` Christian Moe
  2012-04-02 15:06     ` Bastien
  2012-04-05 15:02   ` François Pinard
  1 sibling, 1 reply; 28+ messages in thread
From: Christian Moe @ 2012-04-02 10:34 UTC (permalink / raw)
  To: Bastien; +Cc: François Pinard, emacs-orgmode

François's problem is probably best fixed with CSS as you suggest.

But it might be nice to be able to set an ALT attribute on an image 
used as a link. That doesn't look like it's currently possible with 
Org link syntax and ATTR_HTML.

Just pointing it out, not making a feature request -- should I need to 
use image links, I'm fine with solving this with verbatim HTML.

Yours,
Christian

On 4/2/12 10:14 AM, Bastien wrote:
> Hi François,
>
> pinard@iro.umontreal.ca (François Pinard) writes:
>
>> then I get the display I wanted.  Is there a way for having #+ATTR_HTML
>> to be applied to the inner tag instead of the outer one?
>
> Not -- it would not make sense.
>
> I suggest you fix your css instead.
>
> Best,
>

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-02 10:34   ` Christian Moe
@ 2012-04-02 15:06     ` Bastien
  2012-04-02 21:30       ` Samuel Wales
  0 siblings, 1 reply; 28+ messages in thread
From: Bastien @ 2012-04-02 15:06 UTC (permalink / raw)
  To: mail; +Cc: François Pinard, emacs-orgmode

Hi Christian,

Christian Moe <mail@christianmoe.com> writes:

> François's problem is probably best fixed with CSS as you suggest.
>
> But it might be nice to be able to set an ALT attribute on an image used as
> a link. That doesn't look like it's currently possible with Org link syntax
> and ATTR_HTML.

Agreed -- this is where Nicolas' new export engine will help,
with a more comprehensive syntax for each element.

> Just pointing it out, not making a feature request -- should I need to use
> image links, I'm fine with solving this with verbatim HTML.

Sure.  Thanks for insisting on this anyway!

Best,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-02 15:06     ` Bastien
@ 2012-04-02 21:30       ` Samuel Wales
  2012-04-03  5:42         ` Bastien
  0 siblings, 1 reply; 28+ messages in thread
From: Samuel Wales @ 2012-04-02 21:30 UTC (permalink / raw)
  To: Bastien; +Cc: François Pinard, emacs-orgmode, mail

On 2012-04-02, Bastien <bzg@gnu.org> wrote:
> Agreed -- this is where Nicolas' new export engine will help,
> with a more comprehensive syntax for each element.

Is there a description of this part someplace?  Do you mean new syntax
or better semantics for existing syntax?

While the new exporter has advantages, I hope the old exporter will
still be available for a long time.  I will need it for various
purposes, including speed -- I use it for an exact word counter that
works flawlessly -- and some design differences from the new exporter.
 (Also the new exporter does not currently work on 22.)

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-02 21:30       ` Samuel Wales
@ 2012-04-03  5:42         ` Bastien
  2012-04-05 23:34           ` Samuel Wales
  0 siblings, 1 reply; 28+ messages in thread
From: Bastien @ 2012-04-03  5:42 UTC (permalink / raw)
  To: Samuel Wales; +Cc: François Pinard, emacs-orgmode, mail

Hi Samuel,

Samuel Wales <samologist@gmail.com> writes:

> On 2012-04-02, Bastien <bzg@gnu.org> wrote:
>> Agreed -- this is where Nicolas' new export engine will help,
>> with a more comprehensive syntax for each element.
>
> Is there a description of this part someplace?  

The reference document for the new org-export.el lives here:

  http://orgmode.org/worg/dev/org-export-reference.html

> Do you mean new syntax
> or better semantics for existing syntax?

I mean "a better description of all possible properties for any
syntactic element."  It should be clear by just skimming through
the link above.

> While the new exporter has advantages, I hope the old exporter will
> still be available for a long time.  I will need it for various
> purposes, including speed -- I use it for an exact word counter that
> works flawlessly -- and some design differences from the new exporter.
>  (Also the new exporter does not currently work on 22.)

Good to know.  We will try to keep things as backward compatible as
possible.  There is no plan to destroy existing code anyway.

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-02  8:14 ` Bastien
  2012-04-02 10:34   ` Christian Moe
@ 2012-04-05 15:02   ` François Pinard
  2012-04-06  8:52     ` Christian Moe
  2012-04-06  9:02     ` Bastien
  1 sibling, 2 replies; 28+ messages in thread
From: François Pinard @ 2012-04-05 15:02 UTC (permalink / raw)
  To: Bastien; +Cc: emacs-orgmode

Bastien <bzg@gnu.org> writes:

>> then I get the display I wanted.  Is there a way for having #+ATTR_HTML
>> to be applied to the inner tag instead of the outer one?

> Not -- it would not make sense.

Hello, Bastien.

I understand what you mean by saying it does not make sense with the
current mechanics.  Yet, from a user perspective, it surely makes sense
hoping that Org offers a way for adding attributes to either part of a
link, as links are kind of indivisible (so far that I know).

> I suggest you fix your css instead.

My knowledge of CSS is rudimentary.  I'm not aware that CSS (the version
widely available, not the incoming one) has enough matching capabilities
to spot wrong HTML, remove attributes on some elements and add them on
other elements.  Is that really possible?  Should I dive and study CSS
more?  Without matching, CSS would not help much, as the correction is
needed in three dozen cases at most, and not blindly for all images.

I could ponder using XSL or something else to post-process the HTML
generated by Org, so circumventing the limitation.  This would be adding
an unwelcome layer of complexity.  I like to perceive Org as a tool
which much simplify my life! :-).

François

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-03  5:42         ` Bastien
@ 2012-04-05 23:34           ` Samuel Wales
  0 siblings, 0 replies; 28+ messages in thread
From: Samuel Wales @ 2012-04-05 23:34 UTC (permalink / raw)
  To: Bastien; +Cc: François Pinard, emacs-orgmode, mail

On 2012-04-02, Bastien <bzg@gnu.org> wrote:
> I mean "a better description of all possible properties for any
> syntactic element."  It should be clear by just skimming through
> the link above.

Makes sense.

> Good to know.  We will try to keep things as backward compatible as
> possible.  There is no plan to destroy existing code anyway.

Very good news.

Thanks.

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-05 15:02   ` François Pinard
@ 2012-04-06  8:52     ` Christian Moe
  2012-04-06  9:29       ` Christian Moe
  2012-04-06 18:41       ` Samuel Wales
  2012-04-06  9:02     ` Bastien
  1 sibling, 2 replies; 28+ messages in thread
From: Christian Moe @ 2012-04-06  8:52 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi,

On 4/5/12 5:02 PM, François Pinard wrote:
> I understand what you mean by saying it does not make sense with the
> current mechanics.  Yet, from a user perspective, it surely makes sense
> hoping that Org offers a way for adding attributes to either part of a
> link, as links are kind of indivisible (so far that I know).

On reflection, there might be a case for making the exporter smart 
enough not to place #+ATTR_HTML attributes such as ALT, WIDTH and 
HEIGHT (or even ALIGN, though see below) in the <A> element, where 
they have no place, but instead pass them through to the clickable 
image, where they obviously belong.

>> I suggest you fix your css instead.
>
> My knowledge of CSS is rudimentary.  I'm not aware that CSS (the version
> widely available, not the incoming one) has enough matching capabilities
> to spot wrong HTML, remove attributes on some elements and add them on
> other elements.  Is that really possible?  Should I dive and study CSS
> more?  Without matching, CSS would not help much, as the correction is
> needed in three dozen cases at most, and not blindly for all images.

No, CSS doesn't move attributes around.

But the ALIGN attribute has long been deprecated in favor of CSS.

All the CSS needed to right-align all images that are children of a 
link anchor is:

    a img {float: right;}

(There are other, more complex ways to control horizontal alignment in 
CSS.)

To set this on a per-document basis in Org, use:

    #+STYLE: <style>a img {float: right;}</style>

If you need more fine-grained control, you could use e.g.:

    a.rightaligned img {float: right;}

where "rightaligned" is an arbitrary name, you could call the class 
"alignright" or "right" or "rt" or whatever.

Then you could set the "rightaligned" class on all links you want 
right-aligned:

    #+ATTR_HTML: class="rightaligned"
    [[./targetimage.png][./linkimage.png]]

Note that it's still the <A> element that gets the class. In this 
case, the CSS applies to all <IMG> child elements of <A 
CLASS="rightaligned"> elements.

For this particular purpose, though, that CSS may be overkill; looks 
to me like you get the same visual result by just styling <A> directly.

So here's the whole CSS for right-aligning any block element on which 
you can set the CLASS to "rightaligned" with ATTR_HTML:

    .rightaligned {float: right;}

> I could ponder using XSL or something else to post-process the HTML
> generated by Org, so circumventing the limitation.  This would be adding
> an unwelcome layer of complexity.  I like to perceive Org as a tool
> which much simplify my life! :-).

Any problem you can solve with a single line of simple CSS, you can 
probably solve with a deprecated tag, several lines of complicated 
XSL, and a postprocessing hook in Org to issue a shell command to an 
XSLT processor... But why would you?

If you like Org for its simplicity, you will love CSS.


Yours,
Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-05 15:02   ` François Pinard
  2012-04-06  8:52     ` Christian Moe
@ 2012-04-06  9:02     ` Bastien
  1 sibling, 0 replies; 28+ messages in thread
From: Bastien @ 2012-04-06  9:02 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi François,

pinard@iro.umontreal.ca (François Pinard) writes:

> I understand what you mean by saying it does not make sense with the
> current mechanics.  Yet, from a user perspective, it surely makes sense
> hoping that Org offers a way for adding attributes to either part of a
> link, as links are kind of indivisible (so far that I know).

Agreed.  But remember we are in kind of a transition from the current
exporter to the new ones, so efforts on fixing problems with the current
one are less pressing than trying to move to the new ones.

>> I suggest you fix your css instead.
>
> My knowledge of CSS is rudimentary.  I'm not aware that CSS (the version
> widely available, not the incoming one) has enough matching capabilities
> to spot wrong HTML, remove attributes on some elements and add them on
> other elements.  Is that really possible?  

  #+ATTR_HTML: align="right" id="my_css_id_for_this_anchor"
  [[file:2011-06-04-gazou-passeport.png][file:2011-06-04-gazou-passeport-petit.jpg]]

Then in your css:

  a.my_css_id_for_this_anchor > img {...}

> Should I dive and study CSS more?

Everyone should, no ? :)

> Without matching, CSS would not help much, as the correction is
> needed in three dozen cases at most, and not blindly for all images.

See above.

HTH,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-06  8:52     ` Christian Moe
@ 2012-04-06  9:29       ` Christian Moe
  2012-04-06 18:41       ` Samuel Wales
  1 sibling, 0 replies; 28+ messages in thread
From: Christian Moe @ 2012-04-06  9:29 UTC (permalink / raw)
  To: mail; +Cc: François Pinard, emacs-orgmode

On 4/6/12 10:52 AM, Christian Moe wrote:
> All the CSS needed to right-align all images that are children of a
> link anchor is:
>
>     a img {float: right;}

Correction: that's "descendants" of a link anchor, not just 
"children". If you need to limit this to images that are direct 
children of link anchors, use the selector

       a > img {...}

(Don't think that comes up much in practice, but if you have text 
links with inline images, e.g. fancy bullets or dvipng'd latex 
formulas, the code I posted first would not be what you wanted.)

Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-06  8:52     ` Christian Moe
  2012-04-06  9:29       ` Christian Moe
@ 2012-04-06 18:41       ` Samuel Wales
  2012-04-06 18:45         ` Samuel Wales
  2012-04-07 13:15         ` Christian Moe
  1 sibling, 2 replies; 28+ messages in thread
From: Samuel Wales @ 2012-04-06 18:41 UTC (permalink / raw)
  To: mail; +Cc: François Pinard, emacs-orgmode

Christian and others,

Will CSS solutions described in this thread work if you always export
subtrees (not entire .org files) and never include style files?

If so, how do you go about using them in Org?  Is there a less awkward
way than using an HTML block with a div with style=?

This is awkward as you have to do it for every such block:

  #+HTML: <div style="color: black; background-color: #f4a460">

It would be great to have a generic style of some sort, specify the
scoped Org elements with neat syntax (maybe like #+myblock_begin:)
instead of HTML blocks, and to be able to export it for subtrees (not
entire .org files!) in a completely self-contained way with no need to
include any file.

An example use case is Blogger, where you /could/ try to change the
CSS for your template, but it is far better to have your post be
entirely self-contained with all the style information you need.

Maybe this question deserves its own thread?

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-06 18:41       ` Samuel Wales
@ 2012-04-06 18:45         ` Samuel Wales
  2012-04-07 13:15         ` Christian Moe
  1 sibling, 0 replies; 28+ messages in thread
From: Samuel Wales @ 2012-04-06 18:45 UTC (permalink / raw)
  To: mail; +Cc: François Pinard, emacs-orgmode

On 2012-04-06, Samuel Wales <samologist@gmail.com> wrote:
> It would be great to have a generic style of some sort, specify the
> scoped Org elements with neat syntax (maybe like #+myblock_begin:)

Oops, if we did it this way it would be like #+begin_mycolor ...
#+end_mycolor of course.

But again, entirely self-contained.

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-06 18:41       ` Samuel Wales
  2012-04-06 18:45         ` Samuel Wales
@ 2012-04-07 13:15         ` Christian Moe
  2012-04-10 23:53           ` Samuel Wales
  2012-05-20  0:39           ` ATTR_HTML for a clickable image, howto? François Pinard
  1 sibling, 2 replies; 28+ messages in thread
From: Christian Moe @ 2012-04-07 13:15 UTC (permalink / raw)
  To: Samuel Wales; +Cc: François Pinard, emacs-orgmode

Hi, Samuel,

On 4/6/12 8:41 PM, Samuel Wales wrote:
> Christian and others,
>
> Will CSS solutions described in this thread work if you always export
> subtrees (not entire .org files) and never include style files?

Yes, CSS styles apply to exported subtrees as well, whether from the 
default stylesheet, linked external stylesheets, or #+STYLE headers.

But this applies to the static html files as exported by Org. If I 
understand your drift, you're thinking about using it in a content 
management system (CMS) like Blogger. A CMS will typically store only 
the content of your document and substitute its own template for the 
HEAD section where style information goes. Then these solutions won't 
work without modifying CSS in your CMS.

> If so, how do you go about using them in Org?  Is there a less awkward
> way than using an HTML block with a div with style=?
> This is awkward as you have to do it for every such block:
>
>    #+HTML:<div style="color: black; background-color: #f4a460">

You can edit the CSS template of your CMS to take advantage of the 
classes and ids Org applies to its HTML exports.

- You can also apply your own classes to subtrees using the 
:HTML_CONTAINER_CLASS: property, and style individual subtrees by  id 
from :CUSTOM_ID:.

- You can use #+ATTR_HTML to add class, id or style attributes to 
/some/ elements, and my understanding is that the new exporter that is 
in the works will help do this more systematically.

- You can enclose blocks in custom block classes (<DIV CLASS="foo">) 
with org-special-blocks (#+BEGIN_FOO), or with verbatim HTML.


See the Org manual:
- 12.5.9, "CSS support"

Locally applying CSS to elements with the STYLE attribute, the very 
lowest level of the cascade, should be the last resort.

> It would be great to have a generic style of some sort, specify the
> scoped Org elements with neat syntax (maybe like
[you meant to say:] #+begin_mycolor ... #+end_mycolor
> instead of HTML blocks, and to be able to export it for subtrees (not
> entire .org files!) in a completely self-contained way with no need to
> include any file.

Well, if you still want to apply local CSS formatting, but without 
writing verbatim HTML all the time, it gets a little more involved. 
Org-special-blocks doesn't help here as it only sets a class attribute 
for style sheets to select, it does not set the style attribute. Still:

- You can simplify repeated use with macros. See the manual, section 
11.6. Use the @ notation (section 12.5.3) for literal html tags within 
the macros. E.g.:

    #+MACRO: mycolor @<span style="color: black; background-color: 
#f4a460">$1@</span>

    {{{mycolor(Here I'd like some black text on an orange background.)}}}

- You could probably also use Eric Schulte's contributed 
org-exp-blocks.el, but you'd need to write some code, and it might be 
overkill for this purpose.

> An example use case is Blogger, where you /could/ try to change the
> CSS for your template, but it is far better to have your post be
> entirely self-contained with all the style information you need.

Depends on your use case, I guess, but I think it would nearly always 
be a better, simpler, cleaner solution to modify your Blogger CSS.


Yours,
Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-07 13:15         ` Christian Moe
@ 2012-04-10 23:53           ` Samuel Wales
  2012-04-11  8:11             ` Christian Moe
  2012-05-20  0:39           ` ATTR_HTML for a clickable image, howto? François Pinard
  1 sibling, 1 reply; 28+ messages in thread
From: Samuel Wales @ 2012-04-10 23:53 UTC (permalink / raw)
  To: mail; +Cc: François Pinard, emacs-orgmode

Hi Christian,

Thanks for your reply.

I left implicit the question of whether this can solve OP's problem
also, but believe it is potentially related.

However, if I understood CSS well enough to ask the question
precisely, I'd have the answer.  So bear with me.

More below:

On 2012-04-07, Christian Moe <mail@christianmoe.com> wrote:
>> Will CSS solutions described in this thread work if you always export
>> subtrees (not entire .org files) and never include style files?
>
> Yes, CSS styles apply to exported subtrees as well, whether from the
> default stylesheet, linked external stylesheets, or #+STYLE headers.

Hmm, I think I should have specified further.  I mean
org-export-region-as-html.  The raw HTML without any head section,
files, stylesheets, or anything else.

So for example, could the OP and I use styles that are specified with
div style= wrapping the entire output?  Seems a simple addition to the
exporter or even a defadvice, but I don't know if it would work as I
don't know what the CSS would look like well enough to try it.

The critical thing is to avoid all dependency on anything external
like a stylesheet.  The goal is to keep all information in your file
under Org control, including style.

> But this applies to the static html files as exported by Org. If I
> understand your drift, you're thinking about using it in a content
> management system (CMS) like Blogger. A CMS will typically store only
> the content of your document and substitute its own template for the
> HEAD section where style information goes. Then these solutions won't
> work without modifying CSS in your CMS.

Not even with wrapping the entire output in a div?

> You can edit the CSS template of your CMS to take advantage of the
> classes and ids Org applies to its HTML exports.

The idea is to avoid a dependency like that if possible.

> - You can use #+ATTR_HTML to add class, id or style attributes to
> /some/ elements, and my understanding is that the new exporter that is
> in the works will help do this more systematically.

Wondering if you can control this under my additional requirements
using inheritance from higher-level constructs like a div wrapper
around the whole export.

> - You can enclose blocks in custom block classes (<DIV CLASS="foo">)
> with org-special-blocks (#+BEGIN_FOO), or with verbatim HTML.

Yes, this is where I was leading.  But it's no good for my purposes if
you can't use CSS directly in your Org file without any header or
external files.

> Locally applying CSS to elements with the STYLE attribute, the very
> lowest level of the cascade, should be the last resort.

Right.  :)

> - You can simplify repeated use with macros. See the manual, section
> 11.6. Use the @ notation (section 12.5.3) for literal html tags within
> the macros. E.g.:
>
>     #+MACRO: mycolor @<span style="color: black; background-color:
> #f4a460">$1@</span>

I've tried macros for image specification, but ran into a variety of
issues getting it to work well.

>     {{{mycolor(Here I'd like some black text on an orange background.)}}}

For paragraphs and sections and quotes and so on, the #+ blocks would
work better.  Not sure if {{{}}} would nest?  Or be noticeable.  That
seems much better for spans of text, not so much for standalone images
and sections with more than one paragraph, lists, etc.

> - You could probably also use Eric Schulte's contributed
> org-exp-blocks.el, but you'd need to write some code, and it might be
> overkill for this purpose.

I was wondering if this would be useful too.

> Depends on your use case, I guess, but I think it would nearly always
> be a better, simpler, cleaner solution to modify your Blogger CSS.

OK.  But my desire not to depend on the cloud is large enough that I
have to go back to the raw HTML method.

I want this to work no matter who I give the HTML file (singular) to.

Assuming it's possible -- if not I will just keep using raw HTML.

This is not a critical issue, but I thought it could expand the OP's
conversation to include a general solution for everybody if it works.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-10 23:53           ` Samuel Wales
@ 2012-04-11  8:11             ` Christian Moe
  2012-05-12  0:43               ` Samuel Wales
  2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
  0 siblings, 2 replies; 28+ messages in thread
From: Christian Moe @ 2012-04-11  8:11 UTC (permalink / raw)
  To: Samuel Wales, Org Mode

Hi again,

On 4/11/12 1:53 AM, Samuel Wales wrote:
>>> Will CSS solutions described in this thread work if you always export
>>> subtrees (not entire .org files) and never include style files?
>>
>> Yes, CSS styles apply to exported subtrees as well, whether from the
>> default stylesheet, linked external stylesheets, or #+STYLE headers.
>
> Hmm, I think I should have specified further.  I mean
> org-export-region-as-html.  The raw HTML without any head section,
> files, stylesheets, or anything else.

Are those two separate questions, perhaps? I tried with 
org-export-as-region, and I still got the full HEAD section. So the 
solutions I posted to François should still work with that function. 
However, they would not work when the exported HTML is stripped of the 
HEAD section.

>
> So for example, could the OP and I use styles that are specified with
> div style= wrapping the entire output?  Seems a simple addition to the
> exporter or even a defadvice, but I don't know if it would work as I
> don't know what the CSS would look like well enough to try it.

No doubt there's some way you could wrap everything inside the <BODY> 
section in a <DIV>, but any CSS in its STYLE attribute would apply to 
that div element as a whole, i.e. to all the contents, not selectively 
to bits and parts inside it. That's probably not what you want.

>
> The critical thing is to avoid all dependency on anything external
> like a stylesheet.  The goal is to keep all information in your file
> under Org control, including style.

Maybe it's the wrong goal.
:-)

But if that's what you want to do, the current options for doing local 
STYLE= formatting that I can think of are the same as for setting 
classes or ids:

1. #+attr_html on some elements, and
2. verbatim HTML with #+HTML or with the `@' notation;

repeated use of which could be simplified with (a mix of)

3. macros;
4. org-exp-blocks.el;
5. custom link types (didn't mention that yet, see:
http://orgmode.org/worg/org-tutorials/org-latex-export.html#sec-10-3); 
or even
6. Babel src and call commands (very exotic for the purpose of 
formatting a bit of html).

Beyond that, we'd need something like the extensible syntax you have 
proposed previously.

Personally, I'm looking forward to Nicolas Gouaziou's exporter, which 
I believe will handle ATTR commands in a more systematic way.

>> (...) Then these solutions won't
>> work without modifying CSS in your CMS.
>
> Not even with wrapping the entire output in a div?

I don't think so.

>> You can edit the CSS template of your CMS to take advantage of the
>> classes and ids Org applies to its HTML exports.
>
> The idea is to avoid a dependency like that if possible.

OK. Even so, though, the CMS will probably apply its own stylesheet by 
default, and there's a small but non-zero chance it will interact with 
your local formatting in ways you don't want; e.g., the orange text 
background you specify clashes horribly with off-peach surroundings... 
So you may end up having to edit stylesheets anyway.

>> - You can use #+ATTR_HTML to add class, id or style attributes to
>> /some/ elements, and my understanding is that the new exporter that is
>> in the works will help do this more systematically.
>
> Wondering if you can control this under my additional requirements
> using inheritance from higher-level constructs like a div wrapper
> around the whole export.

Not quite sure what you have in mind, but I don't think so.

>> - You can enclose blocks in custom block classes (<DIV CLASS="foo">)
>> with org-special-blocks (#+BEGIN_FOO), or with verbatim HTML.
>
> Yes, this is where I was leading.  But it's no good for my purposes if
> you can't use CSS directly in your Org file without any header or
> external files.

No, not if you can't or won't control what stylesheets will be applied.

 >> [...]
>> - You can simplify repeated use with macros. [...]

> For paragraphs and sections and quotes and so on, the #+ blocks would
> work better.  Not sure if {{{}}} would nest?

Yes, macros will nest. (As opposed to custom links.) E.g.:

#+MACRO: mycolor @<span style="background-color: #f4a460">$1@</span>
#+MACRO: blue @<span style="background-color: blue">$1@</span>
#+MACRO: red @<span style="background-color: red">$1@</span>

{{{mycolor(This is a single paragraph where I'd like text on an
orange background\, {{{blue(except where I want a blue blackground and
some {{{red(red)}}} in between)}}}.)}}}

>  Or be noticeable.  That
> seems much better for spans of text, not so much for standalone images
> and sections with more than one paragraph, lists, etc.

You may be right. I have had success adding a block-level element 
(DIV) with a macro, but I had to take special care to close the 
preceding P tag to get valid xhtml. That's why in the example I gave, 
I used the macro to wrap the whole text content of the block in a 
SPAN, rather than a DIV.

There are other drawbacks, such as needing to backslash-escape any 
commas (as in the above example). And extensive use of macros looks 
terribly messy in Org source, though the same is likely true for any 
other extensive use of means to local formatting.

Yours,
Christian

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-11  8:11             ` Christian Moe
@ 2012-05-12  0:43               ` Samuel Wales
  2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
  1 sibling, 0 replies; 28+ messages in thread
From: Samuel Wales @ 2012-05-12  0:43 UTC (permalink / raw)
  To: mail; +Cc: Org Mode

Hi Christian,

Thanks for your thoughtful comments.  I have a better understanding of
it now.  Here is more as a sort of summary for searchers.

On 2012-04-11, Christian Moe <mail@christianmoe.com> wrote:
> Are those two separate questions, perhaps? I tried with
> org-export-as-region, and I still got the full HEAD section. So the

I mean this: "If prefix arg body-only is set, omit file header,
footer, and table of contents, and only produce the region of
converted text, useful for cut-and-paste operations." (from the
docstring).

Blogger (and many other places online) already has a HEAD section, and
my understanding is that you can't have 2 HEAD sections.  (I presume
there does not exist a "HEAD-APPEND" section in the HTML standard.)

So letting Org produce the HEAD section seems to be not possible here.

> No doubt there's some way you could wrap everything inside the <BODY>
> section in a <DIV>, but any CSS in its STYLE attribute would apply to
> that div element as a whole, i.e. to all the contents, not selectively
> to bits and parts inside it. That's probably not what you want.

To summarize, it appears as if you can't use full CSS (like "whatever
{ whatever: whatever; }") as a wrapper at all in the body section, so
you need a HEAD section or a separate CSS file to be able to style
specific types of elements the way it is normally done.  The rough
Lisp analogy seems to be that you cannot use let to bind a variable
that is used in various places, but you can use setq (in a section
that can only be used once) or load.

That's the answer I was looking for.  I looked it up more and it seems
to be the case.

Thanks.

> 4. org-exp-blocks.el;

I don't understand this enough yet to know how much effort would be
required.  Good to know you think it might work.

Samuel

-- 
The Kafka Pandemic: http://thekafkapandemic.blogspot.com

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: ATTR_HTML for a clickable image, howto?
  2012-04-07 13:15         ` Christian Moe
  2012-04-10 23:53           ` Samuel Wales
@ 2012-05-20  0:39           ` François Pinard
  1 sibling, 0 replies; 28+ messages in thread
From: François Pinard @ 2012-05-20  0:39 UTC (permalink / raw)
  To: emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

> - You can simplify repeated use with macros. See the manual, section 
> 11.6. Use the @ notation (section 12.5.3) for literal html tags within 
> the macros. E.g.:

>     #+MACRO: mycolor @<span style="color: black; background-color: 
> #f4a460">$1@</span>
>     {{{mycolor(Here I'd like some black text on an orange background.)}}}

Hi, Christian, and everybody.

Just curious...  Would the mere need of the comma in a text ruin the
idea?  Commas are pretty common, aren't they?  Can they be quoted?

François

P.S. Proper quoting in Org is a bit of a mystery to me.  How does one
quote one or more = within ='s, or * within *'s, etc.?  Backslashes
sometimes help, sometimes go through.  I never was in control, and
whenever I have an unusual need in that area, may feel miserable. :-)

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-04-11  8:11             ` Christian Moe
  2012-05-12  0:43               ` Samuel Wales
@ 2012-05-20  1:00               ` François Pinard
  2012-05-20  8:02                 ` Nicolas Goaziou
                                   ` (2 more replies)
  1 sibling, 3 replies; 28+ messages in thread
From: François Pinard @ 2012-05-20  1:00 UTC (permalink / raw)
  To: emacs-orgmode

Christian Moe <mail@christianmoe.com> writes:

> There are other drawbacks [to macros], such as needing to
> backslash-escape any commas (as in the above example).

Oh, thanks!

This (partly) replies to the message I sent a few minutes ago.  Before
sending that message, I checked in the Org manual, and the manual is
silent about the possibility of such escaping.

The manual is also silent about nesting, which has been mentioned
elsewhere in this thread.  The examples in the manual do not hint either
about whether newlines are allowed or not in macro arguments.

In fact, the manual section "Macro replacement" says very little, so
when I initially read it, I guessed that macros are only usable in very
simple cases.  However, the last statement says that macros can be used
to construct "complex HTML code".  Yet, the definition method at the
beginning suggests that macro definitions have to fit on one line, and
this seriously limits the complexity of what we can do with them.  So,
on initial reading, I just decided I understood nothing about them :-).

If macros are there to stay in Org, it might be worth documenting a more
complete specification about how to define and use them.

François

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
@ 2012-05-20  8:02                 ` Nicolas Goaziou
  2012-05-20  8:34                   ` Yagnesh Raghava Yakkala
  2012-05-22 23:23                 ` Bastien
  2012-07-05 14:40                 ` Bastien
  2 siblings, 1 reply; 28+ messages in thread
From: Nicolas Goaziou @ 2012-05-20  8:02 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hello,

François Pinard <pinard@iro.umontreal.ca> writes:

> The examples in the manual do not hint either about whether newlines
> are allowed or not in macro arguments.

They are not.

> In fact, the manual section "Macro replacement" says very little, so
> when I initially read it, I guessed that macros are only usable in very
> simple cases.  However, the last statement says that macros can be used
> to construct "complex HTML code".  Yet, the definition method at the
> beginning suggests that macro definitions have to fit on one line, and
> this seriously limits the complexity of what we can do with them.  So,
> on initial reading, I just decided I understood nothing about
> them :-).

They can build complex code since you can eval a sexp in a macro:

--8<---------------cut here---------------start------------->8---
#+TITLE: Macro test
#+MACRO: test2 recursive $1
#+MACRO: test A {{{test2(inner)}}} macro, $1.
#+MACRO: html-builder (eval (+ $1 $2))


{{{test(and an outer one)}}}

Some complex macro {{{html-builder(1,2)}}}.
--8<---------------cut here---------------end--------------->8---

> If macros are there to stay in Org, it might be worth documenting a more
> complete specification about how to define and use them.

They are useful. Though, for "complex code", I think Babel should be the
way to go.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-05-20  8:02                 ` Nicolas Goaziou
@ 2012-05-20  8:34                   ` Yagnesh Raghava Yakkala
  2012-05-20 10:24                     ` Nicolas Goaziou
  0 siblings, 1 reply; 28+ messages in thread
From: Yagnesh Raghava Yakkala @ 2012-05-20  8:34 UTC (permalink / raw)
  To: emacs-orgmode


Hello Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:
> #+TITLE: Macro test
> #+MACRO: test2 recursive $1
> #+MACRO: test A {{{test2(inner)}}} macro, $1.
> #+MACRO: html-builder (eval (+ $1 $2))
>
>
> {{{test(and an outer one)}}}
>
> Some complex macro {{{html-builder(1,2)}}}.


out of curiosity I tried to export above snippet. it is working nice except for
new exporter latex option. (org-export-dispatch and d option)

here is the back trace:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (void-variable \1)
  (+ \1 \2)
  (eval (+ \1 \2))
  eval((eval (+ \1 \2)))
  (setq value (eval (read value)))
  (progn (setq value (eval (read value))))
  (if (string-match "\\`(eval\\>" value) (progn (setq value (eval (read value)))))
  (when (string-match "\\`(eval\\>" value) (setq value (eval (read value))))
  (let* ((key (org-element-property :key macro)) (args (org-element-property :args macro)) (value (org-export-data (plist-get info (intern (format ":macro-%s" key))) info))) (let ((s 0) n) (while (string-match "\\$\\([0-9]+\\)" value s) (setq s (1+ (match-beginning 0)) n (string-to-number (match-string 1 value))) (and (>= (length args) n) (setq value (replace-match (nth (1- n) args) t t value))))) (when (string-match "\\`(eval\\>" value) (setq value (eval (read value)))) (format "%s" (or value "")))
  org-export-expand-macro((macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  org-e-latex-macro((macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) nil (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  funcall(org-e-latex-macro (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) nil (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  (and (fboundp transcoder) (funcall transcoder data nil info))
  (let ((transcoder (org-export-transcoder data info))) (and (fboundp transcoder) (funcall transcoder data nil info)))
  (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let ((transcoder (org-export-transcoder data info))) (if transcoder (funcall transcoder data info) data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat (lambda (blob) (org-export-data blob info)) (org-element-contents data) "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type (quote headline)) (eq (plist-get info :with-archived-trees) (quote headline)) (org-element-property :archivedp data))) (let ((transcoder (org-export-transcoder data info))) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and ... ...)) (contents (mapconcat ... ... ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))))
  (let* ((type (org-element-type data)) (results (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let (...) (if transcoder ... data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat ... ... "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type ...) (eq ... ...) (org-element-property :archivedp data))) (let ((transcoder ...)) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder ...)) (when transcoder (let* ... ...))))))) (cond ((not results) nil) ((memq type (quote (org-data plain-text nil))) results) (t (let ((results (org-export-filter-apply-functions (plist-get info ...) (let ... ...) info))) results))))
  org-export-data((macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  (lambda (element) (org-export-data element info))((macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)))
  mapconcat((lambda (element) (org-export-data element info)) ("Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) ".") "")
  (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data (when ... ...)))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))
  (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (if transcoder (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let ((transcoder (org-export-transcoder data info))) (if transcoder (funcall transcoder data info) data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat (lambda (blob) (org-export-data blob info)) (org-element-contents data) "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type (quote headline)) (eq (plist-get info :with-archived-trees) (quote headline)) (org-element-property :archivedp data))) (let ((transcoder (org-export-transcoder data info))) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and ... ...)) (contents (mapconcat ... ... ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))))
  (let* ((type (org-element-type data)) (results (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let (...) (if transcoder ... data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat ... ... "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type ...) (eq ... ...) (org-element-property :archivedp data))) (let ((transcoder ...)) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder ...)) (when transcoder (let* ... ...))))))) (cond ((not results) nil) ((memq type (quote (org-data plain-text nil))) results) (t (let ((results (org-export-filter-apply-functions (plist-get info ...) (let ... ...) info))) results))))
  org-export-data((paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) ".") (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  (lambda (element) (org-export-data element info))((paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) "."))
  mapconcat((lambda (element) (org-export-data element info)) ((keyword (:key "TITLE" :value "Macro test" :begin 1 :end 21 :post-blank 0)) (keyword (:key "MACRO" :value "test2 recursive $1" :begin 21 :end 49 :post-blank 0)) (keyword (:key "MACRO" :value "test A {{{test2(inner)}}} macro, $1." :begin 49 :end 95 :post-blank 0)) (keyword (:key "MACRO" :value "html-builder (eval (+ $1 $2))" :begin 95 :end 136 :post-blank 2)) (paragraph (:begin 136 :end 166 :contents-begin 136 :contents-end 164 :post-blank 1) (macro (:key "test" :value "{{{test(and an outer one)}}}" :args ("and an outer one") :begin 136 :end 164 :post-blank 0))) (paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) ".")) "")
  (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data (when ... ...)))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))
  (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (if transcoder (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let ((transcoder (org-export-transcoder data info))) (if transcoder (funcall transcoder data info) data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat (lambda (blob) (org-export-data blob info)) (org-element-contents data) "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type (quote headline)) (eq (plist-get info :with-archived-trees) (quote headline)) (org-element-property :archivedp data))) (let ((transcoder (org-export-transcoder data info))) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and ... ...)) (contents (mapconcat ... ... ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))))
  (let* ((type (org-element-type data)) (results (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let (...) (if transcoder ... data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat ... ... "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type ...) (eq ... ...) (org-element-property :archivedp data))) (let ((transcoder ...)) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder ...)) (when transcoder (let* ... ...))))))) (cond ((not results) nil) ((memq type (quote (org-data plain-text nil))) results) (t (let ((results (org-export-filter-apply-functions (plist-get info ...) (let ... ...) info))) results))))
  org-export-data((section (:begin 1 :end 210 :contents-begin 1 :contents-end 210 :post-blank 0) (keyword (:key "TITLE" :value "Macro test" :begin 1 :end 21 :post-blank 0)) (keyword (:key "MACRO" :value "test2 recursive $1" :begin 21 :end 49 :post-blank 0)) (keyword (:key "MACRO" :value "test A {{{test2(inner)}}} macro, $1." :begin 49 :end 95 :post-blank 0)) (keyword (:key "MACRO" :value "html-builder (eval (+ $1 $2))" :begin 95 :end 136 :post-blank 2)) (paragraph (:begin 136 :end 166 :contents-begin 136 :contents-end 164 :post-blank 1) (macro (:key "test" :value "{{{test(and an outer one)}}}" :args ("and an outer one") :begin 136 :end 164 :post-blank 0))) (paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) ".")) (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  (lambda (element) (org-export-data element info))((section (:begin 1 :end 210 :contents-begin 1 :contents-end 210 :post-blank 0) (keyword (:key "TITLE" :value "Macro test" :begin 1 :end 21 :post-blank 0)) (keyword (:key "MACRO" :value "test2 recursive $1" :begin 21 :end 49 :post-blank 0)) (keyword (:key "MACRO" :value "test A {{{test2(inner)}}} macro, $1." :begin 49 :end 95 :post-blank 0)) (keyword (:key "MACRO" :value "html-builder (eval (+ $1 $2))" :begin 95 :end 136 :post-blank 2)) (paragraph (:begin 136 :end 166 :contents-begin 136 :contents-end 164 :post-blank 1) (macro (:key "test" :value "{{{test(and an outer one)}}}" :args ("and an outer one") :begin 136 :end 164 :post-blank 0))) (paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) ".")))
  mapconcat((lambda (element) (org-export-data element info)) ((section (:begin 1 :end 210 :contents-begin 1 :contents-end 210 :post-blank 0) (keyword (:key "TITLE" :value "Macro test" :begin 1 :end 21 :post-blank 0)) (keyword (:key "MACRO" :value "test2 recursive $1" :begin 21 :end 49 :post-blank 0)) (keyword (:key "MACRO" :value "test A {{{test2(inner)}}} macro, $1." :begin 49 :end 95 :post-blank 0)) (keyword (:key "MACRO" :value "html-builder (eval (+ $1 $2))" :begin 95 :end 136 :post-blank 2)) (paragraph (:begin 136 :end 166 :contents-begin 136 :contents-end 164 :post-blank 1) (macro (:key "test" :value "{{{test(and an outer one)}}}" :args ("and an outer one") :begin 136 :end 164 :post-blank 0))) (paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) "."))) "")
  (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data (when ... ...)))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))
  (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (if transcoder (progn (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if (or greaterp objectp) data (org-element-normalize-contents data ...))) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info)))
  (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and (not greaterp) (memq type org-element-recursive-objects))) (contents (mapconcat (lambda (element) (org-export-data element info)) (org-element-contents (if ... data ...)) ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))
  (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let ((transcoder (org-export-transcoder data info))) (if transcoder (funcall transcoder data info) data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat (lambda (blob) (org-export-data blob info)) (org-element-contents data) "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type (quote headline)) (eq (plist-get info :with-archived-trees) (quote headline)) (org-element-property :archivedp data))) (let ((transcoder (org-export-transcoder data info))) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder (org-export-transcoder data info))) (when transcoder (let* ((greaterp (memq type org-element-greater-elements)) (objectp (and ... ...)) (contents (mapconcat ... ... ""))) (funcall transcoder data (if greaterp (org-element-normalize-string contents) contents) info))))))
  (let* ((type (org-element-type data)) (results (cond ((member data (plist-get info :ignore-list)) nil) ((eq type (quote plain-text)) (org-export-filter-apply-functions (plist-get info :filter-plain-text) (let (...) (if transcoder ... data)) info)) ((not (org-export-interpret-p data info)) (org-export-data (org-export-expand data (mapconcat ... ... "")) info)) ((not type) (mapconcat (lambda (obj) (org-export-data obj info)) data "")) ((or (not (org-element-contents data)) (and (eq type ...) (eq ... ...) (org-element-property :archivedp data))) (let ((transcoder ...)) (and (fboundp transcoder) (funcall transcoder data nil info)))) (t (let ((transcoder ...)) (when transcoder (let* ... ...))))))) (cond ((not results) nil) ((memq type (quote (org-data plain-text nil))) results) (t (let ((results (org-export-filter-apply-functions (plist-get info ...) (let ... ...) info))) results))))
  org-export-data((org-data nil (section (:begin 1 :end 210 :contents-begin 1 :contents-end 210 :post-blank 0) (keyword (:key "TITLE" :value "Macro test" :begin 1 :end 21 :post-blank 0)) (keyword (:key "MACRO" :value "test2 recursive $1" :begin 21 :end 49 :post-blank 0)) (keyword (:key "MACRO" :value "test A {{{test2(inner)}}} macro, $1." :begin 49 :end 95 :post-blank 0)) (keyword (:key "MACRO" :value "html-builder (eval (+ $1 $2))" :begin 95 :end 136 :post-blank 2)) (paragraph (:begin 136 :end 166 :contents-begin 136 :contents-end 164 :post-blank 1) (macro (:key "test" :value "{{{test(and an outer one)}}}" :args ("and an outer one") :begin 136 :end 164 :post-blank 0))) (paragraph (:begin 166 :end 210 :contents-begin 166 :contents-end 209 :post-blank 0) "Some complex macro " (macro (:key "html-builder" :value "{{{html-builder(1,2)}}}" :args ("1" "2") :begin 185 :end 208 :post-blank 0)) "."))) (:author "Yagnesh Raghava Yakkala" :creator "Generated by Org mode 7.8.10 in Emacs 24.1.50.5." :date "\\today" :description nil :email "yagnesh@okhotsk19.lowtem.hokudai.ac.jp" :exclude-tags ("noexport") :headline-levels 3 :keywords nil :language "en" :preserve-breaks nil :section-numbers t :select-tags ("export") :time-stamp-file t :title ("Macro test") :with-archived-trees headline :with-author t :with-clocks nil :with-creator comment :with-drawers t :with-email nil :with-emphasize t :with-entities t :with-fixed-width t :with-footnotes t :with-plannings nil ...))
  (org-element-normalize-string (org-export-data tree info))
  (let* ((body (org-element-normalize-string (org-export-data tree info))) (template (intern (format "org-%s-template" backend))) (output (org-export-filter-apply-functions (plist-get info :filter-final-output) (if (or (not (fboundp template)) body-only) body (funcall template body info)) info))) (when org-export-copy-to-kill-ring (org-kill-new output)) output)
  (let ((info (org-export-install-filters (org-export-store-footnote-definitions (org-export-get-environment backend subtreep ext-plist)))) (tree (let ((buf (or (buffer-file-name ...) (current-buffer)))) (org-export-with-current-buffer-copy (unless noexpand (org-export-expand-include-keyword) (let (...) (org-export-blocks-preprocess))) (goto-char (point-min)) (let ((org-export-current-backend backend)) (run-hooks (quote org-export-before-parsing-hook))) (org-element-parse-buffer nil visible-only))))) (setq tree (org-export-filter-apply-functions (plist-get info :filter-parse-tree) tree info)) (setq info (org-combine-plists info (org-export-collect-tree-properties tree info))) (let* ((body (org-element-normalize-string (org-export-data tree info))) (template (intern (format "org-%s-template" backend))) (output (org-export-filter-apply-functions (plist-get info :filter-final-output) (if (or (not ...) body-only) body (funcall template body info)) info))) (when org-export-copy-to-kill-ring (org-kill-new output)) output))
  (save-restriction (cond ((org-region-active-p) (narrow-to-region (region-beginning) (region-end))) (subtreep (org-narrow-to-subtree) (goto-char (point-min)) (forward-line) (narrow-to-region (point) (point-max)))) (let ((info (org-export-install-filters (org-export-store-footnote-definitions (org-export-get-environment backend subtreep ext-plist)))) (tree (let ((buf (or ... ...))) (org-export-with-current-buffer-copy (unless noexpand (org-export-expand-include-keyword) (let ... ...)) (goto-char (point-min)) (let (...) (run-hooks ...)) (org-element-parse-buffer nil visible-only))))) (setq tree (org-export-filter-apply-functions (plist-get info :filter-parse-tree) tree info)) (setq info (org-combine-plists info (org-export-collect-tree-properties tree info))) (let* ((body (org-element-normalize-string (org-export-data tree info))) (template (intern (format "org-%s-template" backend))) (output (org-export-filter-apply-functions (plist-get info :filter-final-output) (if (or ... body-only) body (funcall template body info)) info))) (when org-export-copy-to-kill-ring (org-kill-new output)) output)))
  (save-excursion (save-restriction (cond ((org-region-active-p) (narrow-to-region (region-beginning) (region-end))) (subtreep (org-narrow-to-subtree) (goto-char (point-min)) (forward-line) (narrow-to-region (point) (point-max)))) (let ((info (org-export-install-filters (org-export-store-footnote-definitions (org-export-get-environment backend subtreep ext-plist)))) (tree (let ((buf ...)) (org-export-with-current-buffer-copy (unless noexpand ... ...) (goto-char ...) (let ... ...) (org-element-parse-buffer nil visible-only))))) (setq tree (org-export-filter-apply-functions (plist-get info :filter-parse-tree) tree info)) (setq info (org-combine-plists info (org-export-collect-tree-properties tree info))) (let* ((body (org-element-normalize-string (org-export-data tree info))) (template (intern (format "org-%s-template" backend))) (output (org-export-filter-apply-functions (plist-get info :filter-final-output) (if ... body ...) info))) (when org-export-copy-to-kill-ring (org-kill-new output)) output))))
  org-export-as(e-latex nil nil nil nil nil)
  (let ((out (org-export-as backend subtreep visible-only body-only ext-plist noexpand))) (with-temp-buffer (insert out) (let ((coding-system-for-write org-export-coding-system)) (write-file file))))
  org-export-to-file(e-latex "/tmp/org-scratch.tex" nil nil nil nil)
  (let ((outfile (org-export-output-file-name ".tex" subtreep pub-dir))) (org-export-to-file (quote e-latex) outfile subtreep visible-only body-only ext-plist))
  org-e-latex-export-to-latex(nil nil nil nil nil)
  (org-e-latex-compile (org-e-latex-export-to-latex subtreep visible-only body-only ext-plist pub-dir))
  org-e-latex-export-to-pdf(nil nil nil)
  (org-open-file (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))
  (cond ((eql --cl-var-- (quote 113)) nil) ((member* --cl-var-- (quote (65 78 85))) (let ((outbuf (org-export-to-buffer (quote e-ascii) "*Org E-ASCII Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset ...))))) (with-current-buffer outbuf (text-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((member* --cl-var-- (quote (97 110 117))) (org-e-ascii-export-to-ascii (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset (\, (case raw-key (97 ...) (110 ...) (t ...))))))) ((eql --cl-var-- (quote 76)) (let ((outbuf (org-export-to-buffer (quote e-latex) "*Org E-LaTeX Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (with-current-buffer outbuf (latex-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((eql --cl-var-- (quote 108)) (org-e-latex-export-to-latex (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 112)) (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 100)) (org-open-file (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 72)) (let ((outbuf (org-export-to-buffer (quote e-html) "*Org E-HTML Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (with-current-buffer outbuf (if (featurep (quote nxhtml-mode)) (nxhtml-mode) (nxml-mode))) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((eql --cl-var-- (quote 104)) (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 98)) (org-open-file (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 111)) (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 79)) (org-open-file (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 70)) (org-e-publish-current-file (memq (quote force) optns))) ((eql --cl-var-- (quote 80)) (org-e-publish-current-project (memq (quote force) optns))) ((eql --cl-var-- (quote 88)) (let ((project (assoc (org-icompleting-read "Publish project: " org-e-publish-project-alist nil t) org-e-publish-project-alist))) (org-e-publish project (memq (quote force) optns)))) ((eql --cl-var-- (quote 69)) (org-e-publish-all (memq (quote force) optns))) (t (error "No command associated with key %s" (char-to-string raw-key))))
  (let ((--cl-var-- (if (< raw-key 27) (+ raw-key 96) raw-key))) (cond ((eql --cl-var-- (quote 113)) nil) ((member* --cl-var-- (quote (65 78 85))) (let ((outbuf (org-export-to-buffer (quote e-ascii) "*Org E-ASCII Export*" (memq ... optns) (memq ... optns) (memq ... optns) (\` ...)))) (with-current-buffer outbuf (text-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((member* --cl-var-- (quote (97 110 117))) (org-e-ascii-export-to-ascii (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset (\, (case raw-key ... ... ...)))))) ((eql --cl-var-- (quote 76)) (let ((outbuf (org-export-to-buffer (quote e-latex) "*Org E-LaTeX Export*" (memq ... optns) (memq ... optns) (memq ... optns)))) (with-current-buffer outbuf (latex-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((eql --cl-var-- (quote 108)) (org-e-latex-export-to-latex (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 112)) (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 100)) (org-open-file (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 72)) (let ((outbuf (org-export-to-buffer (quote e-html) "*Org E-HTML Export*" (memq ... optns) (memq ... optns) (memq ... optns)))) (with-current-buffer outbuf (if (featurep (quote nxhtml-mode)) (nxhtml-mode) (nxml-mode))) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((eql --cl-var-- (quote 104)) (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 98)) (org-open-file (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 111)) (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) ((eql --cl-var-- (quote 79)) (org-open-file (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) ((eql --cl-var-- (quote 70)) (org-e-publish-current-file (memq (quote force) optns))) ((eql --cl-var-- (quote 80)) (org-e-publish-current-project (memq (quote force) optns))) ((eql --cl-var-- (quote 88)) (let ((project (assoc (org-icompleting-read "Publish project: " org-e-publish-project-alist nil t) org-e-publish-project-alist))) (org-e-publish project (memq (quote force) optns)))) ((eql --cl-var-- (quote 69)) (org-e-publish-all (memq (quote force) optns))) (t (error "No command associated with key %s" (char-to-string raw-key)))))
  (case (if (< raw-key 27) (+ raw-key 96) raw-key) (113 nil) ((65 78 85) (let ((outbuf (org-export-to-buffer (quote e-ascii) "*Org E-ASCII Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset ...))))) (with-current-buffer outbuf (text-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((97 110 117) (org-e-ascii-export-to-ascii (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset (\, (case raw-key (97 ...) (110 ...) (t ...))))))) (76 (let ((outbuf (org-export-to-buffer (quote e-latex) "*Org E-LaTeX Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (with-current-buffer outbuf (latex-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) (108 (org-e-latex-export-to-latex (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (112 (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (100 (org-open-file (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (72 (let ((outbuf (org-export-to-buffer (quote e-html) "*Org E-HTML Export*" (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (with-current-buffer outbuf (if (featurep (quote nxhtml-mode)) (nxhtml-mode) (nxml-mode))) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) (104 (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (98 (org-open-file (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (111 (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (79 (org-open-file (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (70 (org-e-publish-current-file (memq (quote force) optns))) (80 (org-e-publish-current-project (memq (quote force) optns))) (88 (let ((project (assoc (org-icompleting-read "Publish project: " org-e-publish-project-alist nil t) org-e-publish-project-alist))) (org-e-publish project (memq (quote force) optns)))) (69 (org-e-publish-all (memq (quote force) optns))) (t (error "No command associated with key %s" (char-to-string raw-key))))
  (let* ((input (org-export-dispatch-ui (if (listp org-export-initial-scope) org-export-initial-scope (list org-export-initial-scope)) org-export-dispatch-use-expert-ui)) (raw-key (car input)) (optns (cdr input))) (case (if (< raw-key 27) (+ raw-key 96) raw-key) (113 nil) ((65 78 85) (let ((outbuf (org-export-to-buffer (quote e-ascii) "*Org E-ASCII Export*" (memq ... optns) (memq ... optns) (memq ... optns) (\` ...)))) (with-current-buffer outbuf (text-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) ((97 110 117) (org-e-ascii-export-to-ascii (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns) (\` (:ascii-charset (\, (case raw-key ... ... ...)))))) (76 (let ((outbuf (org-export-to-buffer (quote e-latex) "*Org E-LaTeX Export*" (memq ... optns) (memq ... optns) (memq ... optns)))) (with-current-buffer outbuf (latex-mode)) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) (108 (org-e-latex-export-to-latex (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (112 (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (100 (org-open-file (org-e-latex-export-to-pdf (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (72 (let ((outbuf (org-export-to-buffer (quote e-html) "*Org E-HTML Export*" (memq ... optns) (memq ... optns) (memq ... optns)))) (with-current-buffer outbuf (if (featurep (quote nxhtml-mode)) (nxhtml-mode) (nxml-mode))) (when org-export-show-temporary-export-buffer (switch-to-buffer-other-window outbuf)))) (104 (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (98 (org-open-file (org-e-html-export-to-html (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (111 (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns))) (79 (org-open-file (org-e-odt-export-to-odt (memq (quote subtree) optns) (memq (quote visible) optns) (memq (quote body) optns)))) (70 (org-e-publish-current-file (memq (quote force) optns))) (80 (org-e-publish-current-project (memq (quote force) optns))) (88 (let ((project (assoc (org-icompleting-read "Publish project: " org-e-publish-project-alist nil t) org-e-publish-project-alist))) (org-e-publish project (memq (quote force) optns)))) (69 (org-e-publish-all (memq (quote force) optns))) (t (error "No command associated with key %s" (char-to-string raw-key)))))
  org-export-dispatch()
  call-interactively(org-export-dispatch record nil)
  command-execute(org-export-dispatch record)
  execute-extended-command(nil "org-export-dispatch")
  call-interactively(execute-extended-command nil nil)
--8<---------------cut here---------------end--------------->8---

org version: pulled a while ago.
Org-mode version 7.8.10 (release_7.8.10-574-g57cfa6 @ /home/yagnesh/.emacs.d/el-get/org-mode/lisp/)

-- 
ఎందరో మహానుభావులు అందరికి వందనములు
YYR

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-05-20  8:34                   ` Yagnesh Raghava Yakkala
@ 2012-05-20 10:24                     ` Nicolas Goaziou
  0 siblings, 0 replies; 28+ messages in thread
From: Nicolas Goaziou @ 2012-05-20 10:24 UTC (permalink / raw)
  To: Yagnesh Raghava Yakkala; +Cc: emacs-orgmode

Hello,

Yagnesh Raghava Yakkala <yagnesh@live.com> writes:

> Nicolas Goaziou <n.goaziou@gmail.com> writes:
>> #+TITLE: Macro test
>> #+MACRO: test2 recursive $1
>> #+MACRO: test A {{{test2(inner)}}} macro, $1.
>> #+MACRO: html-builder (eval (+ $1 $2))
>>
>>
>> {{{test(and an outer one)}}}
>>
>> Some complex macro {{{html-builder(1,2)}}}.
>
>
> out of curiosity I tried to export above snippet. it is working nice except for
> new exporter latex option. (org-export-dispatch and d option)

You're right. I was protecting dollar signs before replacing arguments.
This should be fixed in master.

Thank you for the report.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
  2012-05-20  8:02                 ` Nicolas Goaziou
@ 2012-05-22 23:23                 ` Bastien
  2012-07-05 14:40                 ` Bastien
  2 siblings, 0 replies; 28+ messages in thread
From: Bastien @ 2012-05-22 23:23 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi François,

François Pinard <pinard@iro.umontreal.ca> writes:

> This (partly) replies to the message I sent a few minutes ago.  Before
> sending that message, I checked in the Org manual, and the manual is
> silent about the possibility of such escaping.
>
> The manual is also silent about nesting, which has been mentioned
> elsewhere in this thread.  The examples in the manual do not hint either
> about whether newlines are allowed or not in macro arguments.

Please contribute by sending patches or more readable hints on what
should be fixed... 

> If macros are there to stay in Org, it might be worth documenting a more
> complete specification about how to define and use them.

Macros are here to stay.  Please also remember the manual cannot cover
everything -- Worg can efficiently cover topics like this one.

Thanks for your help!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
  2012-05-20  8:02                 ` Nicolas Goaziou
  2012-05-22 23:23                 ` Bastien
@ 2012-07-05 14:40                 ` Bastien
  2012-07-05 15:09                   ` Nicolas Goaziou
  2 siblings, 1 reply; 28+ messages in thread
From: Bastien @ 2012-07-05 14:40 UTC (permalink / raw)
  To: François Pinard; +Cc: emacs-orgmode

Hi,

François Pinard <pinard@iro.umontreal.ca> writes:

> If macros are there to stay in Org, it might be worth documenting a more
> complete specification about how to define and use them.

I'd welcome some improvement of the manual wrt macros -- any taker?

Thanks,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-07-05 14:40                 ` Bastien
@ 2012-07-05 15:09                   ` Nicolas Goaziou
  2012-07-05 15:51                     ` Sebastien Vauban
  2012-08-05  9:19                     ` Bastien
  0 siblings, 2 replies; 28+ messages in thread
From: Nicolas Goaziou @ 2012-07-05 15:09 UTC (permalink / raw)
  To: Bastien; +Cc: François Pinard, emacs-orgmode

Hello,

Bastien <bzg@gnu.org> writes:

> François Pinard <pinard@iro.umontreal.ca> writes:
>
>> If macros are there to stay in Org, it might be worth documenting a more
>> complete specification about how to define and use them.
>
> I'd welcome some improvement of the manual wrt macros -- any taker?

Before documenting anything, we should first define them clearly. That
is, we can define them through documentation, but we shouldn't write
documentation by looking at their current implementation.

Should macros be allowed anywhere (which means that the user can shoot
himself in the foot) or should their expansion happen in a protected
environment (thus limiting their power)?

In the first case, can macros generate inline Babel code, that will be
executed before export?

In the second case, what types of elements are allowed in the protected
environment?

Also, do we want to allow multiples macros definitions to stack up? I.e.

  #+MACRO: a-macro First line of the macro.
  #+MACRO: a-macro Second line of the macro.

If so, do we allow blank lines in them, meaning they can break document
structure even more?

Can the macros be nested?

Since macros arguments are comma-separated, how do one insert commas
within an argument?

Are newline characters allowed in arguments? If not, what else is
forbidden there?

There are probably other questions, but it should be a good start for
a correct implementation.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-07-05 15:09                   ` Nicolas Goaziou
@ 2012-07-05 15:51                     ` Sebastien Vauban
  2012-07-05 20:44                       ` Nicolas Goaziou
  2012-08-05  9:19                     ` Bastien
  1 sibling, 1 reply; 28+ messages in thread
From: Sebastien Vauban @ 2012-07-05 15:51 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Nicolas,

Nicolas Goaziou wrote:
> Bastien <bzg-mXXj517/zsQ@public.gmane.org> writes:
>> François Pinard <pinard-CRDzTM1onBSWkKpYnGOUKg@public.gmane.org> writes:
>>> If macros are there to stay in Org, it might be worth documenting a more
>>> complete specification about how to define and use them.
>>
>> I'd welcome some improvement of the manual wrt macros -- any taker?
>
> Before documenting anything, we should first define them clearly.

I think you're right here, seen the latest threads on this.

> That is, we can define them through documentation, but we shouldn't write
> documentation by looking at their current implementation.
>
> Should macros be allowed anywhere (which means that the user can shoot
> himself in the foot) or should their expansion happen in a protected
> environment (thus limiting their power)?

If I had to choose, I would opt for the first case...

> In the first case, can macros generate inline Babel code, that will be
> executed before export?

... where macros would be pre-processed "à la M4" (or C preprocessing):
replacing some keyword with some other expression.

> In the second case, what types of elements are allowed in the protected
> environment?
>
> Also, do we want to allow multiples macros definitions to stack up? I.e.
>
>   #+MACRO: a-macro First line of the macro.
>   #+MACRO: a-macro Second line of the macro.
>
> If so, do we allow blank lines in them, meaning they can break document
> structure even more?
>
> Can the macros be nested?
>
> Since macros arguments are comma-separated, how do one insert commas
> within an argument?
>
> Are newline characters allowed in arguments? If not, what else is
> forbidden there?
>
> There are probably other questions, but it should be a good start for
> a correct implementation.

An extra question is: the "replacing expression" of a macro, must it be pure
text, or can it be anything (such as code that will be interpreted, in a
further pass, by some back-end)?

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-07-05 15:51                     ` Sebastien Vauban
@ 2012-07-05 20:44                       ` Nicolas Goaziou
  0 siblings, 0 replies; 28+ messages in thread
From: Nicolas Goaziou @ 2012-07-05 20:44 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: public-emacs-orgmode-mXXj517/zsQ



Hello,

"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:

> Hi Nicolas,
>
> Nicolas Goaziou wrote:
>> Bastien <bzg-mXXj517/zsQ@public.gmane.org> writes:
>>> François Pinard <pinard-CRDzTM1onBSWkKpYnGOUKg@public.gmane.org> writes:
>>>> If macros are there to stay in Org, it might be worth documenting a more
>>>> complete specification about how to define and use them.
>>>
>>> I'd welcome some improvement of the manual wrt macros -- any taker?
>>
>> Before documenting anything, we should first define them clearly.
>
> I think you're right here, seen the latest threads on this.
>
>> That is, we can define them through documentation, but we shouldn't write
>> documentation by looking at their current implementation.
>>
>> Should macros be allowed anywhere (which means that the user can shoot
>> himself in the foot) or should their expansion happen in a protected
>> environment (thus limiting their power)?
>
> If I had to choose, I would opt for the first case...
>
>> In the first case, can macros generate inline Babel code, that will be
>> executed before export?
>
> ... where macros would be pre-processed "à la M4" (or C preprocessing):
> replacing some keyword with some other expression.
>
>> In the second case, what types of elements are allowed in the protected
>> environment?
>>
>> Also, do we want to allow multiples macros definitions to stack up? I.e.
>>
>>   #+MACRO: a-macro First line of the macro.
>>   #+MACRO: a-macro Second line of the macro.
>>
>> If so, do we allow blank lines in them, meaning they can break document
>> structure even more?
>>
>> Can the macros be nested?
>>
>> Since macros arguments are comma-separated, how do one insert commas
>> within an argument?
>>
>> Are newline characters allowed in arguments? If not, what else is
>> forbidden there?
>>
>> There are probably other questions, but it should be a good start for
>> a correct implementation.
>
> An extra question is: the "replacing expression" of a macro, must it be pure
> text, or can it be anything (such as code that will be interpreted, in a
> further pass, by some back-end)?

The first option implies that the expression are inserted in the Org
buffer before being parsed. This is mostly what happens in the current
exporter.


Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?]
  2012-07-05 15:09                   ` Nicolas Goaziou
  2012-07-05 15:51                     ` Sebastien Vauban
@ 2012-08-05  9:19                     ` Bastien
  1 sibling, 0 replies; 28+ messages in thread
From: Bastien @ 2012-08-05  9:19 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: François Pinard, emacs-orgmode

Hi Nicolas,

Nicolas Goaziou <n.goaziou@gmail.com> writes:

>> I'd welcome some improvement of the manual wrt macros -- any taker?
>
> Before documenting anything, we should first define them clearly.

FWIW, I don't forget this important thread.

Let's revive it after the release of Org 7.9, when we will think of
moving org-export.el into core.

-- 
 Bastien

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2012-08-05  9:19 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-01 21:27 ATTR_HTML for a clickable image, howto? François Pinard
2012-04-02  8:14 ` Bastien
2012-04-02 10:34   ` Christian Moe
2012-04-02 15:06     ` Bastien
2012-04-02 21:30       ` Samuel Wales
2012-04-03  5:42         ` Bastien
2012-04-05 23:34           ` Samuel Wales
2012-04-05 15:02   ` François Pinard
2012-04-06  8:52     ` Christian Moe
2012-04-06  9:29       ` Christian Moe
2012-04-06 18:41       ` Samuel Wales
2012-04-06 18:45         ` Samuel Wales
2012-04-07 13:15         ` Christian Moe
2012-04-10 23:53           ` Samuel Wales
2012-04-11  8:11             ` Christian Moe
2012-05-12  0:43               ` Samuel Wales
2012-05-20  1:00               ` Macros [was: Re: ATTR_HTML for a clickable image, howto?] François Pinard
2012-05-20  8:02                 ` Nicolas Goaziou
2012-05-20  8:34                   ` Yagnesh Raghava Yakkala
2012-05-20 10:24                     ` Nicolas Goaziou
2012-05-22 23:23                 ` Bastien
2012-07-05 14:40                 ` Bastien
2012-07-05 15:09                   ` Nicolas Goaziou
2012-07-05 15:51                     ` Sebastien Vauban
2012-07-05 20:44                       ` Nicolas Goaziou
2012-08-05  9:19                     ` Bastien
2012-05-20  0:39           ` ATTR_HTML for a clickable image, howto? François Pinard
2012-04-06  9:02     ` Bastien

Code repositories for project(s) associated with this 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).