* Re: my-mini-table(something)
@ 2009-06-18 10:14 Giovanni Ridolfi
2009-06-18 11:40 ` my-mini-table(something) Stefan Vollmar
0 siblings, 1 reply; 6+ messages in thread
From: Giovanni Ridolfi @ 2009-06-18 10:14 UTC (permalink / raw)
To: emacs-orgmode, Stefan Vollmar
--- Gio 18/6/09, Stefan Vollmar <vollmar@nf.mpg.de> ha scritto:
>
> For one project, I used several statements like this
> (simplified):
>
> #+HTML: <table><tr><td><img
> src="./images/icon.png"/></td><td<code>something</code></td></tr></table>
>
> #+HTML: <table><tr><td><img
> src="./images/icon.png"/></td><td<code>other</code></td></tr></table>
>
> The result looks exactly the way we have planned it,
> however, ideally one would want to write:
>
> \my-mini-table(something)
> \my-mini-table(other)
>
+ you can use yasnippet
http://code.google.com/p/yasnippet/
http://doc.norang.ca/org-mode.html#sec-15.1
+ Or macros? manual, chapter 12.1 Markup rules
Macro replacement
-----------------
You can define text snippets with
#+MACRO: name replacement text
which can be referenced anywhere in the document (even in code
examples) with `{{{name}}}'.
#+MACRO: my-mt-sth #+HTML: <table><tr><td><img> src="./images/icon.png"/></td><td<code>something</code></td></tr></table>
cheers
Giovanni
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my-mini-table(something)
2009-06-18 10:14 my-mini-table(something) Giovanni Ridolfi
@ 2009-06-18 11:40 ` Stefan Vollmar
2009-06-18 14:00 ` my-mini-table(something) Sebastian Rose
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Vollmar @ 2009-06-18 11:40 UTC (permalink / raw)
To: emacs-orgmode
Dear Giovanni,
excellent, many thanks!
#+MACRO
is exactly what I was looking for.
(1) The release notes of 6.27 say:
> Macro processing for export has been enhanced: > > - You can use
arguments in a macro, for example > #+macro hello Greet the $1: Hello $1
which is just what I had been hoping for! This important change has
not yet made it into org.pdf of the 6.27a distribution. Obviously,
this gives you maximum flexibility even for more complex documents and
should get due emphasis in the documentation.
(2) The next logical step is to collect a number of useful macros in
one include file. However, when I use
#+INCLUDE: "./include.org"
which contains the MACRO, the macro expansion does not work (if the
same MACRO statements are part of the org-file where I use them, they
work just fine), all other org content is included as expected. Is
this is a bug?
Warm regards,
Stefan
On 18.06.2009, at 12:14, Giovanni Ridolfi wrote:
>
> --- Gio 18/6/09, Stefan Vollmar <vollmar@nf.mpg.de> ha scritto:
>>
>> For one project, I used several statements like this
>> (simplified):
>>
>> #+HTML: <table><tr><td><img
>> src="./images/icon.png"/></td><td<code>something</code></td></tr></
>> table>
>>
>> #+HTML: <table><tr><td><img
>> src="./images/icon.png"/></td><td<code>other</code></td></tr></table>
>>
>> The result looks exactly the way we have planned it,
>> however, ideally one would want to write:
>>
>> \my-mini-table(something)
>> \my-mini-table(other)
>>
>
> + you can use yasnippet
>
> http://code.google.com/p/yasnippet/
> http://doc.norang.ca/org-mode.html#sec-15.1
>
>
> + Or macros? manual, chapter 12.1 Markup rules
>
> Macro replacement
> -----------------
>
> You can define text snippets with
>
> #+MACRO: name replacement text
>
> which can be referenced anywhere in the document (even in code
> examples) with `{{{name}}}'.
>
>
> #+MACRO: my-mt-sth #+HTML: <table><tr><td><img> src="./images/
> icon.png"/></td><td<code>something</code></td></tr></table>
>
>
> cheers
> Giovanni
>
>
>
>
--
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] 6+ messages in thread
* Re: my-mini-table(something)
2009-06-18 11:40 ` my-mini-table(something) Stefan Vollmar
@ 2009-06-18 14:00 ` Sebastian Rose
0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Rose @ 2009-06-18 14:00 UTC (permalink / raw)
To: Stefan Vollmar; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 212 bytes --]
Ahh - I knew this technique existed. But I tried to find it in the
manual (since I never used yet).
Documentation for this is missing. Maybe mention it in the concept index
would help?
Regards
Sebastian
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-texi-macro-expansion.patch --]
[-- Type: text/x-diff, Size: 421 bytes --]
diff --git a/doc/org.texi b/doc/org.texi
index a8a6105..77584d4 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -8251,9 +8251,11 @@ Toggle the COMMENT keyword at the beginning of an entry.
@node Macro replacement, , Comment lines, Markup rules
@subheading Macro replacement
+@cindex macro replacement
You can define text snippets with
+@cindex #+MACRO:
@example
#+MACRO: name replacement text
@end example
[-- Attachment #3: Type: text/plain, Size: 204 bytes --]
_______________________________________________
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 related [flat|nested] 6+ messages in thread
* Re: Re: my-mini-table(something)
@ 2009-06-18 13:11 giovanni.ridolfi
2009-06-19 5:42 ` my-mini-table(something) Carsten Dominik
0 siblings, 1 reply; 6+ messages in thread
From: giovanni.ridolfi @ 2009-06-18 13:11 UTC (permalink / raw)
To: emacs-orgmode, Stefan Vollmar, Carsten Dominik
--- Gio 18/6/09, Stefan Vollmar <vollmar@nf.mpg.de> ha scritto:
> #+MACRO is exactly what I was looking for.
>
> (1) The release notes of 6.27 say:
> > Macro processing for export has been enhanced:
> > - You can use arguments in a macro, for example
> #+macro hello Greet the $1: Hello $1
> which is just what I had been hoping for! This important
> change has not yet made it into org.pdf of the 6.27a
> distribution.
???? really ?????
at page 106 of the pdf version, that you can download from the site,
http://orgmode.org/org.pdf
I can read: "Macro replacement"!
> (2) The next logical step is to collect a number of useful
> macros in one include file. However, when I use
> #+INCLUDE: "./include.org"
> which contains the MACRO, the macro expansion does not work
> (if the same MACRO statements are part of the org-file where
> I use them, they work just fine), all other org content is
> included as expected. Is this is a bug?
I think this is a not, yet?, implemented feature ;-)
*Macro processing* is intended *for export* (release notes)
so, I think, Carsten considered only the macros in the
current file/buffer.
cheers,
Giovanni
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: my-mini-table(something)
2009-06-18 13:11 my-mini-table(something) giovanni.ridolfi
@ 2009-06-19 5:42 ` Carsten Dominik
0 siblings, 0 replies; 6+ messages in thread
From: Carsten Dominik @ 2009-06-19 5:42 UTC (permalink / raw)
To: giovanni.ridolfi; +Cc: emacs-orgmode
On Jun 18, 2009, at 3:11 PM, giovanni.ridolfi@yahoo.it wrote:
>
> --- Gio 18/6/09, Stefan Vollmar <vollmar@nf.mpg.de> ha scritto:
>> #+MACRO is exactly what I was looking for.
>>
>> (1) The release notes of 6.27 say:
>>> Macro processing for export has been enhanced:
>>> - You can use arguments in a macro, for example
>> #+macro hello Greet the $1: Hello $1
>> which is just what I had been hoping for! This important
>> change has not yet made it into org.pdf of the 6.27a
>> distribution.
>
> ???? really ?????
>
> at page 106 of the pdf version, that you can download from the site,
> http://orgmode.org/org.pdf
>
> I can read: "Macro replacement"!
>
>> (2) The next logical step is to collect a number of useful
>> macros in one include file. However, when I use
>> #+INCLUDE: "./include.org"
>> which contains the MACRO, the macro expansion does not work
>> (if the same MACRO statements are part of the org-file where
>> I use them, they work just fine), all other org content is
>> included as expected. Is this is a bug?
>
> I think this is a not, yet?, implemented feature ;-)
>
> *Macro processing* is intended *for export* (release notes)
> so, I think, Carsten considered only the macros in the
> current file/buffer.
I guess the right thing would be in get macro definitions also
from a file linked to by #+SETUPFILE. This does
now (latest git) work.
- Carsten
^ permalink raw reply [flat|nested] 6+ messages in thread
* my-mini-table(something)
@ 2009-06-18 9:56 Stefan Vollmar
2009-06-18 12:25 ` my-mini-table(something) Matthew Lundin
0 siblings, 1 reply; 6+ messages in thread
From: Stefan Vollmar @ 2009-06-18 9:56 UTC (permalink / raw)
To: emacs-orgmode
Hello,
we have used org-mode for creating HTML content for software
documentation and it beats everything we have tried over the last
couple of years hands down, excellent work!
For one project, I used several statements like this (simplified):
#+HTML: <table><tr><td><img src="./images/icon.png"/></
td><td<code>something</code></td></tr></table>
#+HTML: <table><tr><td><img src="./images/icon.png"/></
td><td<code>other</code></td></tr></table>
The result looks exactly the way we have planned it, however, ideally
one would want to write:
\my-mini-table(something)
\my-mini-table(other)
(with a suitable syntax) in the org source, and this should only be
expanded when exporting the document, so I never need to look at the
HTML code (if I do not want to).
This is probably already possible with org-mode using the html-export-
hook and a little Lisp function. Many thanks in advance for any hints!
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] 6+ messages in thread
* Re: my-mini-table(something)
2009-06-18 9:56 my-mini-table(something) Stefan Vollmar
@ 2009-06-18 12:25 ` Matthew Lundin
0 siblings, 0 replies; 6+ messages in thread
From: Matthew Lundin @ 2009-06-18 12:25 UTC (permalink / raw)
To: Stefan Vollmar; +Cc: emacs-orgmode
Hi Stefan,
Stefan Vollmar <vollmar@nf.mpg.de> writes:
> we have used org-mode for creating HTML content for software
> documentation and it beats everything we have tried over the last
> couple of years hands down, excellent work!
>
> For one project, I used several statements like this (simplified):
>
> #+HTML: <table><tr><td><img src="./images/icon.png"/></
> td><td<code>something</code></td></tr></table>
>
> #+HTML: <table><tr><td><img src="./images/icon.png"/></
> td><td<code>other</code></td></tr></table>
>
> The result looks exactly the way we have planned it, however, ideally
> one would want to write:
>
> \my-mini-table(something)
> \my-mini-table(other)
>
> (with a suitable syntax) in the org source, and this should only be
> expanded when exporting the document, so I never need to look at the
> HTML code (if I do not want to).
Perhaps the easiest way to do this would be to define a macro at the top
of your org file:
--8<---------------cut here---------------start------------->8---
#+MACRO: special-table #+HTML: <table><tr><td><img src="./images/icon.png"/></td><td<code>something</code></td></tr></table>
--8<---------------cut here---------------end--------------->8---
Then, any time you wanted the html snippet to appear in the export, you
could place the following in your org file:
{{{special-table}}}
During export this will be replaced by the definition above. (At first I
wasn't sure this would work because of the extra comment notation in the
macro definition, but I tested it and it seemed to work fine.)
For more information on macros, see
http://orgmode.org/org.html#Macro-replacement
Regards,
Matt
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-06-19 6:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-18 10:14 my-mini-table(something) Giovanni Ridolfi
2009-06-18 11:40 ` my-mini-table(something) Stefan Vollmar
2009-06-18 14:00 ` my-mini-table(something) Sebastian Rose
-- strict thread matches above, loose matches on Subject: below --
2009-06-18 13:11 my-mini-table(something) giovanni.ridolfi
2009-06-19 5:42 ` my-mini-table(something) Carsten Dominik
2009-06-18 9:56 my-mini-table(something) Stefan Vollmar
2009-06-18 12:25 ` my-mini-table(something) Matthew Lundin
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.