From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/39816 Path: news.gmane.org!not-for-mail From: Peter =?utf-8?Q?M=C3=BCnster?= Newsgroups: gmane.comp.tex.context Subject: Re: Various ConTeXt Questions Date: Thu, 3 Apr 2008 21:44:03 +0200 Message-ID: <20080403194403.GA6602@gaston.couberia.bzh> References: <6faad9f00804030349x37910350l3d70a35f3f67c2fb@mail.gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207251936 29913 80.91.229.12 (3 Apr 2008 19:45:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 3 Apr 2008 19:45:36 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Apr 03 21:46:07 2008 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1JhVNu-0006wa-KH for gctc-ntg-context-518@m.gmane.org; Thu, 03 Apr 2008 21:46:06 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id CA7751FBBE; Thu, 3 Apr 2008 21:45:27 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 14793-02-10; Thu, 3 Apr 2008 21:44:41 +0200 (CEST) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id E9A381FB39; Thu, 3 Apr 2008 21:44:40 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 11FA21FB39 for ; Thu, 3 Apr 2008 21:44:39 +0200 (CEST) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 17299-01-7 for ; Thu, 3 Apr 2008 21:44:05 +0200 (CEST) Original-Received: from smtp21.orange.fr (smtp21.orange.fr [80.12.242.46]) by ronja.ntg.nl (Postfix) with ESMTP id E526A1FB30 for ; Thu, 3 Apr 2008 21:44:04 +0200 (CEST) Original-Received: from me-wanadoo.net (localhost [127.0.0.1]) by mwinf2128.orange.fr (SMTP Server) with ESMTP id 5A8321C000A4; Thu, 3 Apr 2008 21:44:04 +0200 (CEST) Original-Received: from gaston.couberia.bzh (ARennes-358-1-97-235.w86-203.abo.wanadoo.fr [86.203.8.235]) by mwinf2128.orange.fr (SMTP Server) with ESMTP id 29E2C1C0009E; Thu, 3 Apr 2008 21:44:04 +0200 (CEST) X-ME-UUID: 20080403194404171.29E2C1C0009E@mwinf2128.orange.fr Original-Received: by gaston.couberia.bzh (Postfix, from userid 1000) id 73599305C7; Thu, 3 Apr 2008 21:44:03 +0200 (CEST) Mail-Followup-To: mailing list for ConTeXt users , adityam@umich.edu Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:39816 Archived-At: On Thu, Apr 03 2008, Edd Barrett wrote: > Just a way of isolating each of the marco's values that cvs defines. How about: > > ---8<--- > \definecvskeyword[cvsdate][D/M/Y]{$Date$}% will be expanded upon > commit to something like $Date: 1999/12/23 01:59:22 $ > \starttext > Last Updated: \cvskeyword[cvsdate] > \stoptext > ---8<--- > > would produce: > Last Updated: 1999/12/23 01:59:22 Hello Edd, Perhaps like this: % engine=luatex \startluacode thirddata = thirddata or { } -- write the replacement string -- p: pattern -- r: replacement pattern -- s: subject function thirddata.replace(p, r, s) s = string.gsub(s, "^.-" .. p .. ".-$", r) tex.print(s) end \stopluacode \def\definereplacement{\doquadrupleargument\dodefinereplacement} \def\dodefinereplacement[#1][#2][#3][#4]{\expandafter \def\csname #1\endcsname{\ctxlua{thirddata.replace("#2", "#3", "#4")}}} \definereplacement[cvsdate] [(\%d+)/(\%d+)/(\%d+)] [\%3.\%2.\%1] [$Date: 1999/12/23 01:59:22 $] \definereplacement[cvstime] [(\%d+):(\%d+):(\%d+)] [\%1h \%2m \%3s] [$Date: 1999/12/23 01:59:22 $] \definereplacement[cvsfile] [: (.+),] [\\type{\%1}] [$RCSfile: keyword.html,v $] \starttext File: \cvsfile, last Updated: \cvsdate\ at \cvstime \stoptext Cheers, Peter -- http://pmrb.free.fr/contact/ ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________