|
From: | Christian Moe |
Subject: | Re: [Orgmode] text color + highlight |
Date: | Tue, 10 Aug 2010 20:38:45 +0200 |
User-agent: | Thunderbird 2.0.0.24 (Macintosh/20100228) |
Hi, Eric,Thanks for trying this out -- I should have taken the trouble to write out sample code myself.
Just for completeness I'm adding an example of a color handler which can be added to a users config to enable colorization of exported text to html and latex. --8<---------------cut here---------------start------------->8--- (org-add-link-type "color" nil (lambda (path desc format) (cond ((eq format 'html) (format "<span style=\"color:%s;\">%s</span>" path desc)) ((eq format 'latex) (format "{\\color{%s}%s}" path desc))))) --8<---------------cut here---------------end--------------->8---
A drawback with using links for markup is that the user sees things that look like links, but do nothing when clicked, except give error messages.
So instead of setting the third argument -- the "follow" function -- to nil, I'd flash the user an informative message, e.g.
--8<---------------cut here---------------start------------->8--- (org-add-link-type "color" (lambda (path) (message (format "This link adds %s color but goes nowhere" path))) (lambda (path desc format) (cond ((eq format 'html) (format "<span style=\"color:%s;\">%s</span>" path desc)) ((eq format 'latex) (format "{\\color{%s}%s}" path desc))))) --8<---------------cut here---------------end--------------->8--- Yours, Christian
[Prev in Thread] | Current Thread | [Next in Thread] |