From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Lawrence Subject: Re: Custom formatting during export Date: Wed, 03 Sep 2014 09:22:39 -0700 Message-ID: <87bnqwvflc.fsf@berkeley.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44761) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDLz-0003Ym-IZ for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 12:24:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPDLt-0006rh-Hj for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 12:24:15 -0400 Received: from plane.gmane.org ([80.91.229.3]:52320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPDLt-0006rZ-B2 for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 12:24:09 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XPDLp-0000zG-3l for emacs-orgmode@gnu.org; Wed, 03 Sep 2014 18:24:05 +0200 Received: from c-67-169-117-151.hsd1.ca.comcast.net ([67.169.117.151]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2014 18:24:05 +0200 Received: from richard.lawrence by c-67-169-117-151.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 Sep 2014 18:24:05 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: becker.gabe@gene.com Hi Gabe, Gabe Becker 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