From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/72112 Path: news.gmane.org!not-for-mail From: Martin Fechner Newsgroups: gmane.comp.tex.context Subject: Re: lua and brackets Date: Thu, 03 Nov 2011 15:10:15 +0100 Message-ID: <4EB2A0C7.4000101@bbaw.de> References: <4EB25BC0.70202@bbaw.de> <4EB27486.6070402@wxs.nl> <4EB27E27.3090902@bbaw.de> <4EB29467.3050407@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1320329443 22311 80.91.229.12 (3 Nov 2011 14:10:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 3 Nov 2011 14:10:43 +0000 (UTC) Cc: mailing list for ConTeXt users To: Hans Hagen Original-X-From: ntg-context-bounces@ntg.nl Thu Nov 03 15:10:36 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RLy03-0003l2-2f for gctc-ntg-context-518@m.gmane.org; Thu, 03 Nov 2011 15:10:35 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 07BB9CB0B3; Thu, 3 Nov 2011 15:10: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 AEJ6hdbAhmRw; Thu, 3 Nov 2011 15:10:27 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AE164CB098; Thu, 3 Nov 2011 15:10:27 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 3B4D2CB098 for ; Thu, 3 Nov 2011 15:10:26 +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 AJpwnmbJwerx for ; Thu, 3 Nov 2011 15:10:18 +0100 (CET) Original-Received: from filter1-ams.mf.surf.net (filter1-ams.mf.surf.net [192.87.102.69]) by balder.ntg.nl (Postfix) with ESMTP id 82DA2CB097 for ; Thu, 3 Nov 2011 15:10:18 +0100 (CET) Original-Received: from mail.bbaw.de (mail.bbaw.de [194.95.188.6]) by filter1-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id pA3EAFOu010199 for ; Thu, 3 Nov 2011 15:10:18 +0100 Original-Received: from mailhub.bbaw.de (unknown [192.168.4.1]) by mail.bbaw.de (Postfix) with ESMTP id 04EB94A80BD; Thu, 3 Nov 2011 15:10:15 +0100 (CET) Original-Received: by mailhub.bbaw.de (Postfix, from userid 10) id 0CC2893D14; Thu, 3 Nov 2011 15:10:14 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by mailhub.bbaw.de (Postfix) with ESMTP id 8CAE393D16; Thu, 3 Nov 2011 15:10:14 +0100 (CET) Original-Received: from mailhub.bbaw.de (localhost [127.0.0.1]) by localhost (AvMailGate-2.1.4-7) id 1371-EPoxnX; Thu, 3 Nov 2011 15:10:14 +0100 (CET) Original-Received: from [192.168.1.197] (unknown [192.168.1.197]) by mailhub.bbaw.de (Postfix) with ESMTP id 6816193D13; Thu, 3 Nov 2011 15:10:14 +0100 (CET) User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:6.0.2) Gecko/20110902 Thunderbird/6.0.2 In-Reply-To: <4EB29467.3050407@wxs.nl> X-AntiVirus: checked by Avira MailGate (version: 2.1.4-7; AVE: 7.9.6.100; VDF: 7.11.16.255; host: mailhub); id=1371-EPoxnX X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=194.95.188.6; country=DE; region=16; city=Berlin; latitude=52.5167; longitude=13.4000; http://maps.google.com/maps?q=52.5167,13.4000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 06FQCafqB - 05ee330d396c - 20111103 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.69 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 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 Xref: news.gmane.org gmane.comp.tex.context:72112 Archived-At: > And if you want pure lua, you can do: > > \startluacode > function document.pagesetup(ref_one,ref_two) > local one, bug = structures.references.identify("",ref_one) > if bug then > context("[unknown reference: %s]",ref_one) > return > end > local two, bug = structures.references.identify("",ref_two) > if bug then > context("[unknown reference: %s]",ref_two) > return > end > structures.references.analyze(one) > structures.references.analyze(two) > local r_one = one.realpage > local r_two = two.realpage > if not r_one or not r_two then > context("[unknown pagenumbers]") > elseif r_one == r_two then > context("[same pagenumbers]") > else > context("[different pagenumbers]") > end > end > \stopluacode > > \ctxlua{document.pagesetup("one","two")} > \ctxlua{document.pagesetup("one","two-a")} > \ctxlua{document.pagesetup("two-a","two-b")} > > but the reference interface is not yet documented > Thanks, the lua solution works fine. One question: is the same possible with linereferences as with pagereferences? It's very important for the critical edition project I'm working at. Greetings, Martin ___________________________________________________________________________________ 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 ___________________________________________________________________________________