From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80656 Path: news.gmane.org!not-for-mail From: "Meer H. van der" Newsgroups: gmane.comp.tex.context Subject: Re: What is changed? Date: Mon, 4 Feb 2013 19:26:31 +0100 Message-ID: References: <854E6F7F-CD3D-44F7-A5EF-FE16250FBD6C@uva.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\)) Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1360002402 12023 80.91.229.3 (4 Feb 2013 18:26:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Feb 2013 18:26:42 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Feb 04 19:26:57 2013 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1U2Qkr-0007HD-3x for gctc-ntg-context-518@m.gmane.org; Mon, 04 Feb 2013 19:26:57 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5548610252; Mon, 4 Feb 2013 19:26:38 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id UxQptDW0kGRv; Mon, 4 Feb 2013 19:26:35 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 4162710229; Mon, 4 Feb 2013 19:26:35 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4E56010229 for ; Mon, 4 Feb 2013 19:26:34 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mm0JbXLGJMkG for ; Mon, 4 Feb 2013 19:26:33 +0100 (CET) Original-Received: from filter3-ams.mf.surf.net (filter3-ams.mf.surf.net [192.87.102.71]) by balder.ntg.nl (Postfix) with ESMTP id 4365710215 for ; Mon, 4 Feb 2013 19:26:33 +0100 (CET) Original-Received: from ezel.ic.uva.nl (ezel.ic.uva.nl [146.50.108.158]) by filter3-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r14IQW4V025270 for ; Mon, 4 Feb 2013 19:26:32 +0100 Original-Received: from elhalyn-ethernet.fritz.box (a82-95-102-36.adsl.xs4all.nl [82.95.102.36]) (authenticated bits=0) by ezel.ic.uva.nl (8.13.8/8.13.8) with ESMTP id r14IQV1M011829 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) for ; Mon, 4 Feb 2013 19:26:31 +0100 In-Reply-To: X-Mailer: Apple Mail (2.1499) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=146.50.108.158; country=NL; latitude=52.5000; longitude=5.7500; http://maps.google.com/maps?q=52.5000,5.7500&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 03IUiqwSl - 266f9f961c63 - 20130204 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.71 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:80656 Archived-At: On 4 feb. 2013, at 19:13, Aditya Mahajan wrote: > On Mon, 4 Feb 2013, H. van der Meer wrote: > >> The following worked without a hitch: >> >> \def\IsNilReturn#1{\edef\tmp{#1}\doifelse{\tmp}{nil}{\color[red]{ERROR}}{\tmp}} >> \def\formatDuration#1{\ctxlua{ >> local s = string.gsub("#1","\%D","") >> local d = tostring(hvdm.time:match(s)) >> tex.print(string.sub(d,1,2) ~= "0:" and d or string.sub(d,3)) >> }} >> \def\FormatDuration#1{\IsNilReturn{\formatDuration{#1}}} >> Called by something like \FormatDuration{11929} (meaning: 1 hour 19 minutes 29 seconds) >> >> Now I get an error in >> ConTeXt ver: 2013.01.27 21:24 MKIV fmt: 2013.1.28 int: english/english >> ! LuaTeX error [string "\directlua "]:1: invalid escape sequence near '\%'. >> \formatDuration ...0:" and d or string.sub(d,3)) } >> \IsNilReturn #1->\edef \tmp {#1 >> }\doifelse {\tmp }{nil}{\color [red]{ERROR}}{... >> >> Whereas in a previous Context all went well: >> ConTeXt ver: 2012.05.30 11:26 MKIV fmt: 2013.2.4 int: english/english >> >> What did change? Why? And how to repair? > > I noticed something similar a few days ago. IIRC, using \letterpercent still works (untested). > > Aditya No, that is not the solution. Maybe because the % has to function in a Lua gsub as match pattern. I tried dropping the backslash, not \%D but using %D. Then the error is: ! LuaTeX error [string "\directlua "]:1: ')' expected near '0'. \formatDuration ...0:" and d or string.sub(d,3)) } \IsNilReturn #1->\edef \tmp {#1 }\doifelse {\tmp }{nil}{\color [red]{ERROR}}{... More ideas? Hans van der Meer ___________________________________________________________________________________ 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 : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________