From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Moe Subject: Re: Run lisp code in macros? Date: Fri, 29 Apr 2011 08:31:06 +0200 Message-ID: <4DBA5B2A.6060102@christianmoe.com> References: <59684.43075.qm@web120702.mail.ne1.yahoo.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 eggs.gnu.org ([140.186.70.92]:42320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFh9F-0001Fr-0S for emacs-orgmode@gnu.org; Fri, 29 Apr 2011 02:25:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QFh99-0003WB-EM for emacs-orgmode@gnu.org; Fri, 29 Apr 2011 02:25:52 -0400 Received: from mars.hitrost.net ([91.185.211.18]:36494) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QFh99-0003ST-8r for emacs-orgmode@gnu.org; Fri, 29 Apr 2011 02:25:47 -0400 In-Reply-To: <59684.43075.qm@web120702.mail.ne1.yahoo.com> 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: amscopub-mail@yahoo.com Cc: emacs-orgmode@gnu.org On 4/28/11 10:56 PM, amscopub-mail@yahoo.com wrote: > Is there a way to apply text transformations to arguments in macros? > > For example, say that you want to change the first argument to capital letters? or transpose the letters of the second argument? > > How would you do that? I imagine you would have to run elisp code, perhaps babel is the answer? > > Sample code: > > #+MACRO: test Change $1 to uppercase, somehow. > > * Hello World > {{{test(test phrase)}}} > > Desired HTML export: > > TEST PHRASE to uppercase, somehow. > Hi, This should do it: ------------------------------------------- #+MACRO: test src_emacs-lisp[:results raw]{(upcase "$1")} * Hello World {{{test(test phrase)}}} ------------------------------------------- If you only want HTML output, you could also use CSS styling. ------------------------------------------- Another @test phrase@ uppercased with CSS. ------------------------------------------- Yours, Christian