emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* MACRO calls with linebreaks?
@ 2009-08-09  0:40 Stefan Vollmar
  2009-08-10  8:09 ` Carsten Dominik
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Vollmar @ 2009-08-09  0:40 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I find org-mode's MACRO feature very useful for exporting to HTML as  
it allows you to generate literally any HTML construct that you need,  
here is a simple example: http://www.nf.mpg.de/kinderuni/kinderuni_en.html 
  (see the "Colophon" section; thanks again to everybody from the list  
who helped!).

For another project, we need to generate a table with many (multi- 
line) rows like this:

| logo.png | somebody.jpg | name \\ telephone \\ email... |

The images have different sizes (so some alignment is needed) and the  
text in the last column should have several lines (which should be  
next to the person's portrait). This can (currently) not been done  
with standard org tables (I am not complaining).

With something like this:

#+macro: person #+HTML: <table><tr><td style="vertical- 
align:middle;margin-right:2em;margin-left:2em;padding:5px;">[...]</ 
table>

{{{person(logo.png, somebody.jpg, somebody@nf.mpg.de, name<br/ 
 >telephone<br/>room<br/>group<br/>[...])}}}

the problem can be solved and yet again org-mode's flexibility is  
demonstrated.

The MACRO can be hidden in a setup-file. However, the MACRO call can  
not and it looks like a kludge and is awkward to read. MACRO calls  
work well with few and short arguments - different from this case. The  
problem is that org-mode seems to require the brackets in one line for  
MACROs to work. Assuming this restriction was not there, one could  
write in a much more readable fashion:

{{{person(
logo.png, somebody.jpg,
somebody@nf.mpg.de,
  name<br/>
  telephone<br/>
  room<br/>
  group<br/>
  [...]
)}}}

and (just a thought) might expect white space in front of an argument  
to be ignored and linebreaks in arguments conserved. Maybe there is a  
better way to pass longer arguments to MACROs?

Any help is appreciated.
Warm regards,
  Stefan
-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de

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

* Re: MACRO calls with linebreaks?
  2009-08-09  0:40 MACRO calls with linebreaks? Stefan Vollmar
@ 2009-08-10  8:09 ` Carsten Dominik
  2009-08-10 22:58   ` Stefan Vollmar
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2009-08-10  8:09 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode

Hi Stefan,

this should now work.

But note that the opening parenthesis must be attached to the macro  
name and the closing parenthesis must be attached to the "}}}", just  
as you have done in your proposal.

I have not tested this, please verify.

- Carsten

On Aug 9, 2009, at 2:40 AM, Stefan Vollmar wrote:

> Hello,
>
> I find org-mode's MACRO feature very useful for exporting to HTML as  
> it allows you to generate literally any HTML construct that you  
> need, here is a simple example: http://www.nf.mpg.de/kinderuni/kinderuni_en.html 
>  (see the "Colophon" section; thanks again to everybody from the  
> list who helped!).
>
> For another project, we need to generate a table with many (multi- 
> line) rows like this:
>
> | logo.png | somebody.jpg | name \\ telephone \\ email... |
>
> The images have different sizes (so some alignment is needed) and  
> the text in the last column should have several lines (which should  
> be next to the person's portrait). This can (currently) not been  
> done with standard org tables (I am not complaining).
>
> With something like this:
>
> #+macro: person #+HTML: <table><tr><td style="vertical- 
> align:middle;margin-right:2em;margin-left:2em;padding:5px;">[...]</ 
> table>
>
> {{{person(logo.png, somebody.jpg, somebody@nf.mpg.de, name<br/ 
> >telephone<br/>room<br/>group<br/>[...])}}}
>
> the problem can be solved and yet again org-mode's flexibility is  
> demonstrated.
>
> The MACRO can be hidden in a setup-file. However, the MACRO call can  
> not and it looks like a kludge and is awkward to read. MACRO calls  
> work well with few and short arguments - different from this case.  
> The problem is that org-mode seems to require the brackets in one  
> line for MACROs to work. Assuming this restriction was not there,  
> one could write in a much more readable fashion:
>
> {{{person(
> logo.png, somebody.jpg,
> somebody@nf.mpg.de,
> name<br/>
> telephone<br/>
> room<br/>
> group<br/>
> [...]
> )}}}
>
> and (just a thought) might expect white space in front of an  
> argument to be ignored and linebreaks in arguments conserved. Maybe  
> there is a better way to pass longer arguments to MACROs?
>
> Any help is appreciated.
> Warm regards,
> Stefan
> -- 
> Dr. Stefan Vollmar, Dipl.-Phys.
> Max-Planck-Institut für neurologische Forschung
> Gleuelerstr. 50, 50931 Köln, Germany
> Tel.: +49-221-4726-213  FAX +49-221-4726-298
> Tel.: +49-221-478-5713  Mobile: 0160-93874279
> Email: vollmar@nf.mpg.de   http://www.nf.mpg.de
>
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: MACRO calls with linebreaks?
  2009-08-10  8:09 ` Carsten Dominik
@ 2009-08-10 22:58   ` Stefan Vollmar
  2009-08-11  9:02     ` Carsten Dominik
  2009-08-11 13:30     ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Vollmar @ 2009-08-10 22:58 UTC (permalink / raw)
  To: emacs-orgmode

Dear Carsten,

On 10.08.2009, at 10:09, Carsten Dominik wrote:

> this should now work.
>
> But note that the opening parenthesis must be attached to the macro  
> name and the closing parenthesis must be attached to the "}}}", just  
> as you have done in your proposal.
>
> I have not tested this, please verify.

thank you!

Almost perfect: there seems to be some confusion as to when MACRO  
arguments are passed verbatim and when interpreted in org-fashion.  
Ideally, there should be a way to make sure that one gets verbatim  
text, possibly without leading white space.

(1)

{{{person(minerva_logo.png,
...)}}}

and

{{{person(
minerva_logo.png,
...)}}}

differ. The first version passes "minerva_log.png" as the first  
argument to the MACRO, the second version turns it into  
"minerva<sub>logo</sub>.png".

(2)

{{{person(minerva_logo.png, somebody.jpg,
line1 <br/> line2 <br/> line3 <br/>,
somebody@nf.mpg.de
)}}}

works fine, however,

{{{person(minerva_logo.png, somebody.jpg,
line1 <br/>
line2 <br/>
line3 <br/>,
somebody@nf.mpg.de
)}}}

creates "line1" folled by a line break (as expected) but all following  
HTML code rendered as text:
line1 <br/> line2 &lt;br/&gt; line3 &lt;br/&gt;&lt; [...]

(3)

{{{person(minerva_logo.png, somebody.jpg,
line1 <br/>
line2 @<br/>
line3 @<br/>,
somebody@nf.mpg.de
)}}}

this works (observe the inconsistency between line1 and the other  
lines: no "@" here) up to and including line 3, the rest is HTML  
markup rendered as text just as in (2).

Warm regards,
  Stefan

>
> - Carsten
>
> On Aug 9, 2009, at 2:40 AM, Stefan Vollmar wrote:
>
>> Hello,
>>
>> I find org-mode's MACRO feature very useful for exporting to HTML  
>> as it allows you to generate literally any HTML construct that you  
>> need, here is a simple example: http://www.nf.mpg.de/kinderuni/kinderuni_en.html 
>>  (see the "Colophon" section; thanks again to everybody from the  
>> list who helped!).
>>
>> For another project, we need to generate a table with many (multi- 
>> line) rows like this:
>>
>> | logo.png | somebody.jpg | name \\ telephone \\ email... |
>>
>> The images have different sizes (so some alignment is needed) and  
>> the text in the last column should have several lines (which should  
>> be next to the person's portrait). This can (currently) not been  
>> done with standard org tables (I am not complaining).
>>
>> With something like this:
>>
>> #+macro: person #+HTML: <table><tr><td style="vertical- 
>> align:middle;margin-right:2em;margin-left:2em;padding:5px;">[...]</ 
>> table>
>>
>> {{{person(logo.png, somebody.jpg, somebody@nf.mpg.de, name<br/ 
>> >telephone<br/>room<br/>group<br/>[...])}}}
>>
>> the problem can be solved and yet again org-mode's flexibility is  
>> demonstrated.
>>
>> The MACRO can be hidden in a setup-file. However, the MACRO call  
>> can not and it looks like a kludge and is awkward to read. MACRO  
>> calls work well with few and short arguments - different from this  
>> case. The problem is that org-mode seems to require the brackets in  
>> one line for MACROs to work. Assuming this restriction was not  
>> there, one could write in a much more readable fashion:
>>
>> {{{person(
>> logo.png, somebody.jpg,
>> somebody@nf.mpg.de,
>> name<br/>
>> telephone<br/>
>> room<br/>
>> group<br/>
>> [...]
>> )}}}
>>
>> and (just a thought) might expect white space in front of an  
>> argument to be ignored and linebreaks in arguments conserved. Maybe  
>> there is a better way to pass longer arguments to MACROs?
>>
>> Any help is appreciated.
>> Warm regards,
>> Stefan

-- 
Dr. Stefan Vollmar, Dipl.-Phys.
Max-Planck-Institut für neurologische Forschung
Gleuelerstr. 50, 50931 Köln, Germany
Tel.: +49-221-4726-213  FAX +49-221-4726-298
Tel.: +49-221-478-5713  Mobile: 0160-93874279
Email: vollmar@nf.mpg.de   http://www.nf.mpg.de

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

* Re: MACRO calls with linebreaks?
  2009-08-10 22:58   ` Stefan Vollmar
@ 2009-08-11  9:02     ` Carsten Dominik
  2009-08-11 13:30     ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-08-11  9:02 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode

Hi Stefan,

could you please make a complete example, with the complete macro
definition and calls, i.e. no ...?  This would give me something
to test without having to guess what might be happening.

Thanks.

- Carsten


On Aug 11, 2009, at 12:58 AM, Stefan Vollmar wrote:

> Dear Carsten,
>
> On 10.08.2009, at 10:09, Carsten Dominik wrote:
>
>> this should now work.
>>
>> But note that the opening parenthesis must be attached to the macro  
>> name and the closing parenthesis must be attached to the "}}}",  
>> just as you have done in your proposal.
>>
>> I have not tested this, please verify.
>
> thank you!
>
> Almost perfect: there seems to be some confusion as to when MACRO  
> arguments are passed verbatim and when interpreted in org-fashion.  
> Ideally, there should be a way to make sure that one gets verbatim  
> text, possibly without leading white space.
>
> (1)
>
> {{{person(minerva_logo.png,
> ...)}}}
>
> and
>
> {{{person(
> minerva_logo.png,
> ...)}}}
>
> differ. The first version passes "minerva_log.png" as the first  
> argument to the MACRO, the second version turns it into  
> "minerva<sub>logo</sub>.png".
>
> (2)
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/> line2 <br/> line3 <br/>,
> somebody@nf.mpg.de
> )}}}
>
> works fine, however,
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/>
> line2 <br/>
> line3 <br/>,
> somebody@nf.mpg.de
> )}}}
>
> creates "line1" folled by a line break (as expected) but all  
> following HTML code rendered as text:
> line1 <br/> line2 &lt;br/&gt; line3 &lt;br/&gt;&lt; [...]
>
> (3)
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/>
> line2 @<br/>
> line3 @<br/>,
> somebody@nf.mpg.de
> )}}}
>
> this works (observe the inconsistency between line1 and the other  
> lines: no "@" here) up to and including line 3, the rest is HTML  
> markup rendered as text just as in (2).
>
> Warm regards,
> Stefan
>
>>
>> - Carsten
>>
>> On Aug 9, 2009, at 2:40 AM, Stefan Vollmar wrote:
>>
>>> Hello,
>>>
>>> I find org-mode's MACRO feature very useful for exporting to HTML  
>>> as it allows you to generate literally any HTML construct that you  
>>> need, here is a simple example: http://www.nf.mpg.de/kinderuni/kinderuni_en.html 
>>>  (see the "Colophon" section; thanks again to everybody from the  
>>> list who helped!).
>>>
>>> For another project, we need to generate a table with many (multi- 
>>> line) rows like this:
>>>
>>> | logo.png | somebody.jpg | name \\ telephone \\ email... |
>>>
>>> The images have different sizes (so some alignment is needed) and  
>>> the text in the last column should have several lines (which  
>>> should be next to the person's portrait). This can (currently) not  
>>> been done with standard org tables (I am not complaining).
>>>
>>> With something like this:
>>>
>>> #+macro: person #+HTML: <table><tr><td style="vertical- 
>>> align:middle;margin-right:2em;margin-left:2em;padding:5px;">[...]</ 
>>> table>
>>>
>>> {{{person(logo.png, somebody.jpg, somebody@nf.mpg.de, name<br/ 
>>> >telephone<br/>room<br/>group<br/>[...])}}}
>>>
>>> the problem can be solved and yet again org-mode's flexibility is  
>>> demonstrated.
>>>
>>> The MACRO can be hidden in a setup-file. However, the MACRO call  
>>> can not and it looks like a kludge and is awkward to read. MACRO  
>>> calls work well with few and short arguments - different from this  
>>> case. The problem is that org-mode seems to require the brackets  
>>> in one line for MACROs to work. Assuming this restriction was not  
>>> there, one could write in a much more readable fashion:
>>>
>>> {{{person(
>>> logo.png, somebody.jpg,
>>> somebody@nf.mpg.de,
>>> name<br/>
>>> telephone<br/>
>>> room<br/>
>>> group<br/>
>>> [...]
>>> )}}}
>>>
>>> and (just a thought) might expect white space in front of an  
>>> argument to be ignored and linebreaks in arguments conserved.  
>>> Maybe there is a better way to pass longer arguments to MACROs?
>>>
>>> Any help is appreciated.
>>> Warm regards,
>>> Stefan
>
> -- 
> Dr. Stefan Vollmar, Dipl.-Phys.
> Max-Planck-Institut für neurologische Forschung
> Gleuelerstr. 50, 50931 Köln, Germany
> Tel.: +49-221-4726-213  FAX +49-221-4726-298
> Tel.: +49-221-478-5713  Mobile: 0160-93874279
> Email: vollmar@nf.mpg.de   http://www.nf.mpg.de
>
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: MACRO calls with linebreaks?
  2009-08-10 22:58   ` Stefan Vollmar
  2009-08-11  9:02     ` Carsten Dominik
@ 2009-08-11 13:30     ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2009-08-11 13:30 UTC (permalink / raw)
  To: Stefan Vollmar; +Cc: emacs-orgmode

Fixed, thanks.

- Carsten

On Aug 11, 2009, at 12:58 AM, Stefan Vollmar wrote:

> Dear Carsten,
>
> On 10.08.2009, at 10:09, Carsten Dominik wrote:
>
>> this should now work.
>>
>> But note that the opening parenthesis must be attached to the macro  
>> name and the closing parenthesis must be attached to the "}}}",  
>> just as you have done in your proposal.
>>
>> I have not tested this, please verify.
>
> thank you!
>
> Almost perfect: there seems to be some confusion as to when MACRO  
> arguments are passed verbatim and when interpreted in org-fashion.  
> Ideally, there should be a way to make sure that one gets verbatim  
> text, possibly without leading white space.
>
> (1)
>
> {{{person(minerva_logo.png,
> ...)}}}
>
> and
>
> {{{person(
> minerva_logo.png,
> ...)}}}
>
> differ. The first version passes "minerva_log.png" as the first  
> argument to the MACRO, the second version turns it into  
> "minerva<sub>logo</sub>.png".
>
> (2)
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/> line2 <br/> line3 <br/>,
> somebody@nf.mpg.de
> )}}}
>
> works fine, however,
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/>
> line2 <br/>
> line3 <br/>,
> somebody@nf.mpg.de
> )}}}
>
> creates "line1" folled by a line break (as expected) but all  
> following HTML code rendered as text:
> line1 <br/> line2 &lt;br/&gt; line3 &lt;br/&gt;&lt; [...]
>
> (3)
>
> {{{person(minerva_logo.png, somebody.jpg,
> line1 <br/>
> line2 @<br/>
> line3 @<br/>,
> somebody@nf.mpg.de
> )}}}
>
> this works (observe the inconsistency between line1 and the other  
> lines: no "@" here) up to and including line 3, the rest is HTML  
> markup rendered as text just as in (2).
>
> Warm regards,
> Stefan
>
>>
>> - Carsten
>>
>> On Aug 9, 2009, at 2:40 AM, Stefan Vollmar wrote:
>>
>>> Hello,
>>>
>>> I find org-mode's MACRO feature very useful for exporting to HTML  
>>> as it allows you to generate literally any HTML construct that you  
>>> need, here is a simple example: http://www.nf.mpg.de/kinderuni/kinderuni_en.html 
>>>  (see the "Colophon" section; thanks again to everybody from the  
>>> list who helped!).
>>>
>>> For another project, we need to generate a table with many (multi- 
>>> line) rows like this:
>>>
>>> | logo.png | somebody.jpg | name \\ telephone \\ email... |
>>>
>>> The images have different sizes (so some alignment is needed) and  
>>> the text in the last column should have several lines (which  
>>> should be next to the person's portrait). This can (currently) not  
>>> been done with standard org tables (I am not complaining).
>>>
>>> With something like this:
>>>
>>> #+macro: person #+HTML: <table><tr><td style="vertical- 
>>> align:middle;margin-right:2em;margin-left:2em;padding:5px;">[...]</ 
>>> table>
>>>
>>> {{{person(logo.png, somebody.jpg, somebody@nf.mpg.de, name<br/ 
>>> >telephone<br/>room<br/>group<br/>[...])}}}
>>>
>>> the problem can be solved and yet again org-mode's flexibility is  
>>> demonstrated.
>>>
>>> The MACRO can be hidden in a setup-file. However, the MACRO call  
>>> can not and it looks like a kludge and is awkward to read. MACRO  
>>> calls work well with few and short arguments - different from this  
>>> case. The problem is that org-mode seems to require the brackets  
>>> in one line for MACROs to work. Assuming this restriction was not  
>>> there, one could write in a much more readable fashion:
>>>
>>> {{{person(
>>> logo.png, somebody.jpg,
>>> somebody@nf.mpg.de,
>>> name<br/>
>>> telephone<br/>
>>> room<br/>
>>> group<br/>
>>> [...]
>>> )}}}
>>>
>>> and (just a thought) might expect white space in front of an  
>>> argument to be ignored and linebreaks in arguments conserved.  
>>> Maybe there is a better way to pass longer arguments to MACROs?
>>>
>>> Any help is appreciated.
>>> Warm regards,
>>> Stefan
>
> -- 
> Dr. Stefan Vollmar, Dipl.-Phys.
> Max-Planck-Institut für neurologische Forschung
> Gleuelerstr. 50, 50931 Köln, Germany
> Tel.: +49-221-4726-213  FAX +49-221-4726-298
> Tel.: +49-221-478-5713  Mobile: 0160-93874279
> Email: vollmar@nf.mpg.de   http://www.nf.mpg.de
>
>
>
>
>
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Remember: use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2009-08-11 13:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-09  0:40 MACRO calls with linebreaks? Stefan Vollmar
2009-08-10  8:09 ` Carsten Dominik
2009-08-10 22:58   ` Stefan Vollmar
2009-08-11  9:02     ` Carsten Dominik
2009-08-11 13:30     ` Carsten Dominik

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).