emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Richard Lawrence <richard.lawrence@berkeley.edu>
To: emacs-orgmode@gnu.org
Cc: becker.gabe@gene.com
Subject: Re: Custom formatting during export
Date: Wed, 03 Sep 2014 09:22:39 -0700	[thread overview]
Message-ID: <87bnqwvflc.fsf@berkeley.edu> (raw)
In-Reply-To: CAMFmJsknK8MoQz6FYYh8NCE6g72QmGWEDT4E8gMhBry5zHmrRQ@mail.gmail.com

Hi Gabe,

Gabe Becker <becker.gabe@gene.com> 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

  parent reply	other threads:[~2014-09-03 16:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-03 13:36 Custom formatting during export Gabe Becker
2014-09-03 15:41 ` Thorsten Jolitz
2014-09-03 16:22 ` Richard Lawrence [this message]
2014-09-03 16:26 ` Julian Gehring
2014-09-03 16:44 ` Thomas S. Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bnqwvflc.fsf@berkeley.edu \
    --to=richard.lawrence@berkeley.edu \
    --cc=becker.gabe@gene.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).