From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/62657 Path: news.gmane.org!not-for-mail From: "Kevin D. Robbins" Newsgroups: gmane.comp.tex.context Subject: Re: Is it possible to pass unmarked paragraphs into Lua for processing Date: Fri, 15 Oct 2010 15:36:50 -0600 Message-ID: References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0775164739==" X-Trace: dough.gmane.org 1287178635 29743 80.91.229.12 (15 Oct 2010 21:37:15 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 15 Oct 2010 21:37:15 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Oct 15 23:37:14 2010 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 1P6rxe-0001Jc-VB for gctc-ntg-context-518@m.gmane.org; Fri, 15 Oct 2010 23:37:11 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id EEF70CA753; Fri, 15 Oct 2010 23:37:09 +0200 (CEST) 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 8nICfHuiCR9B; Fri, 15 Oct 2010 23:37:06 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 9DDCDCA744; Fri, 15 Oct 2010 23:37:06 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id AFFB6CA744 for ; Fri, 15 Oct 2010 23:37:04 +0200 (CEST) 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 DTk1gD3q07Gj for ; Fri, 15 Oct 2010 23:36:52 +0200 (CEST) Original-Received: from filter3-til.mf.surf.net (filter3-til.mf.surf.net [194.171.167.219]) by balder.ntg.nl (Postfix) with ESMTP id 86160CA743 for ; Fri, 15 Oct 2010 23:36:52 +0200 (CEST) Original-Received: from mail-fx0-f41.google.com (mail-fx0-f41.google.com [209.85.161.41]) by filter3-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o9FLapue014951 for ; Fri, 15 Oct 2010 23:36:51 +0200 Original-Received: by fxm2 with SMTP id 2so1096756fxm.14 for ; Fri, 15 Oct 2010 14:36:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=ngCBqyFG+VSD+4NDrGl20EBdOhEVSyGKVth7WMIjoYk=; b=oakkgKDNoJP/egRTg2nwkOjqnOiiUxIvSGCzDMwf8CREZyMeTWMdORC0P4dOEjz1Fv uBg4hy30FHIMaic03GY6lkKWL+1EuoQWeAW8GxlidO4vesLNwuJjb07UiJLXqH6JTvRn abVs64H6aSQP/jWM0Ng3yjyehTft4iggf1kcE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ZRjYkt/LEY0gPyM6MLKrmV2bOdGqukOKs1e1Sy15V9Z4bxTandT3YxRGzbCwOtUYyV k8NgpaTy1ZIbvIWXYBOBdskWGsfY1C8ZPzgk2xwaV3G/MLJ6I35BntyFaVAH57Nd/A2p /JhivTqbR8sshQiw371i+bPtbsm2Gsqbbv7t4= Original-Received: by 10.239.157.14 with SMTP id o14mr98763hbc.74.1287178610331; Fri, 15 Oct 2010 14:36:50 -0700 (PDT) Original-Received: by 10.239.132.79 with HTTP; Fri, 15 Oct 2010 14:36:50 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.161.41; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0eDj9APKi - b1ced65c9df8 - 20101015 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.219 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:62657 Archived-At: --===============0775164739== Content-Type: multipart/alternative; boundary=001485f1e71cd4cfb60492ae9faf --001485f1e71cd4cfb60492ae9faf Content-Type: text/plain; charset=UTF-8 I confess, I hadn't considered anything quite so bold as reading the whole of the text into Lua and then processing it back out. I suppose I was expecting one of the true TeXperts to offer suggestions involving \appendtoks ... \to \everypar. I also realized that I forgot to mention that I want to be able to do this all while using the ConTeXt project/product/component support. Any other suggestions on how I could process unmarked paragraphs in Lua? Kevin On Thu, Oct 14, 2010 at 3:48 PM, Aditya Mahajan wrote: > On Thu, 14 Oct 2010, Kevin D. Robbins wrote: > > Hi all, >> >> I am wondering if and how it might be possible to catch all unmarked >> paragraphs in a TeX file and pass them into Lua. So, in the following >> example, each of the first three unmarked paragraphs would be passed to >> the >> Lua function "process_paragraph" for optional processing, but the fourth >> paragraph between \startmarkedparagraph...\stopmarkedparagraph would not >> be >> passed to "process_paragraph". >> > > If you are willing to add some more markup, then you can do > > \starttext > \startMarking > ... > \startmarkedparagraph > ... > \stopmarkedparagraph > \stopMarking > \stoptext > > where \startMarking .. \stopMarking passes everything to lua ( > http://wiki.contextgarden.net/Programming_in_LuaTeX#Manipulating_verbatim_text_for_dummies) > and you can then search for \startmarkedparagraph ... \stopmarkedparagraph > in lua. > > Or you could just redefine \starttext ... \stoptext to do the capturing. > Something like: > > \let\normalstarttext\starttext > \let\normalstoptext\stoptext > > \def\starttext{....} > > And in the lua end call \normalstarttext before starting typesetting and > \normalstoptext after all typesetting is done. > > Aditya > > ___________________________________________________________________________________ > 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 > > ___________________________________________________________________________________ > --001485f1e71cd4cfb60492ae9faf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable I confess, I hadn't considered anything quite so bold as reading the wh= ole of the text into Lua and then processing it back out. I suppose I was e= xpecting one of the true TeXperts to offer suggestions involving \appendtok= s ... \to \everypar.

I also realized that I forgot to mention that I want to be able to do t= his all while using the ConTeXt project/product/component support.

A= ny other suggestions on how I could process unmarked paragraphs in Lua?

Kevin

On Thu, Oct 14, 2010 at 3:48 PM= , Aditya Mahajan <adityam@umich.edu> wrote:
On Thu, 14 Oct 2010, Kevin D. Robbins wrote:

Hi all,

I am wondering if and how it might be possible to catch all unmarked
paragraphs in a TeX file and pass them into Lua. So, in the following
example, each of the first three unmarked paragraphs would be passed to the=
Lua function "process_paragraph" for optional processing, but the= fourth
paragraph between \startmarkedparagraph...\stopmarkedparagraph would not be=
passed to "process_paragraph".

If you are willing to add some more markup, then you can do

\starttext
\startMarking
...
\startmarkedparagraph
...
\stopmarkedparagraph
\stopMarking
\stoptext

where \startMarking .. \stopMarking passes everything to lua (http://wiki.contextgarden.net/Programming_= in_LuaTeX#Manipulating_verbatim_text_for_dummies) and you can then sear= ch for \startmarkedparagraph ... \stopmarkedparagraph in lua.

Or you could just redefine \starttext ... \stoptext to do the capturing. So= mething like:

\let\normalstarttext\starttext
\let\normalstoptext\stoptext

\def\starttext{....}

And in the lua end call \normalstarttext before starting typesetting and \n= ormalstoptext after all typesetting is done.

Aditya
___________________________________________________________________________= ________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =C2=A0: http= ://www.pragma-ade.nl / http://tex.aanhet.net
archive =C2=A0: http://foundry.supelec.fr/projects/contextrev/
wiki =C2=A0 =C2=A0 : http://contextgarden.net
___________________________________________________________________________= ________

--001485f1e71cd4cfb60492ae9faf-- --===============0775164739== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ 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 ___________________________________________________________________________________ --===============0775164739==--