emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Custom formatting during export


From: Richard Lawrence
Subject: Re: [O] Custom formatting during export
Date: Wed, 03 Sep 2014 09:22:39 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux)

Hi Gabe,

Gabe Becker <address@hidden> writes:

> * section title
>
> Here is some text, but I want [specialthing: this bit here] to be formatted
> differently than [newanddifferent: this other big over here].
>
>
> Where I would have defined specific custom formatting rules for
> "specialthing" and "newanddifferent" type entities.
>
> Is there a way to do this in orgmode? If not, it seems like it would be a
> very useful feature (at least to me:) ). Note: I don't care about the
> syntax as long as the result is the same.

Based on the syntax you chose for your example, you might be looking for
custom link types; see the documentation for the org-add-link-type
function:
------------------------------------------------------------------------------
(org-add-link-type TYPE &optional FOLLOW EXPORT)

Add TYPE to the list of `org-link-types'.
Re-compute all regular expressions depending on `org-link-types'

FOLLOW and EXPORT are two functions.

FOLLOW should take the link path as the single argument and do whatever
is necessary to follow the link, for example find a file or display
a mail message.

EXPORT should format the link path for export to one of the export formats.
It should be a function accepting three arguments:

  path    the path of the link, the text after the prefix (like "http:")
  desc    the description of the link, if any, or a description added by
          org-export-normalize-links if there is none
  format  the export format, a symbol like `html' or `latex' or `ascii'..

The function may use the FORMAT information to return different values
depending on the format.  The return value will be put literally into
the exported file.  If the return value is nil, this means Org should
do what it normally does with links which do not have EXPORT defined.
------------------------------------------------------------------------------

You could define a custom link type for "specialthing", and then use the
export parameter to provide a function that will export the path 
of the link in a backend-specific way.  Then you would write

blah blah [[specialthing:whatever-path]] blah blah 

I'm sure there are good examples of how to do this on Worg, but I cannot
seem to find them at the moment...

If you need to do something more complicated than what custom link types
allow, Thorsten's suggestions are the place to start: Org has a lot of
ways to customize export output.
 
Best,
Richard




reply via email to

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