From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: text color + highlight Date: Tue, 10 Aug 2010 20:38:45 +0200 Message-ID: <4C619CB5.70409@christianmoe.com> References: <87pqxw5cb1.fsf@gnu.org> <87mxszcsuv.fsf@gmail.com> <87d3tvru38.fsf@gmail.com> <87iq3kkef1.fsf@gmail.com> <4C60EE48.6030106@christianmoe.com> <532CED92-88AD-46F6-BC67-9D0DEDAA6D71@gmail.com> <4C611C24.2030601@christianmoe.com> <87pqxq4icv.fsf@gmail.com> Reply-To: mail@christianmoe.com Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=42436 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OitiX-0003lv-02 for emacs-orgmode@gnu.org; Tue, 10 Aug 2010 14:38:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oitho-0001aj-EO for emacs-orgmode@gnu.org; Tue, 10 Aug 2010 14:37:45 -0400 Received: from mail-forward1.uio.no ([129.240.10.70]:52592) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oitho-0001aE-5K for emacs-orgmode@gnu.org; Tue, 10 Aug 2010 14:37:44 -0400 Received: from exim by mail-out1.uio.no with local-bsmtp (Exim 4.69) (envelope-from ) id 1Oithm-0001WH-Du for emacs-orgmode@gnu.org; Tue, 10 Aug 2010 20:37:42 +0200 In-Reply-To: <87pqxq4icv.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: emacs-orgmode@gnu.org 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 "%s" 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 "%s" path desc)) ((eq format 'latex) (format "{\\color{%s}%s}" path desc))))) --8<---------------cut here---------------end--------------->8--- Yours, Christian