From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/80650 Path: news.gmane.org!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Getting the content of source lines in a \startlines \stoplines env? Date: Mon, 4 Feb 2013 18:49:23 +0100 Message-ID: <04D560BE-4CAA-4753-9D3E-887ED6D82AE8@gmail.com> References: <510FEBD1.9000908@ingohohmann.de> 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 1360000169 21641 80.91.229.3 (4 Feb 2013 17:49:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Feb 2013 17:49:29 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon Feb 04 18:49:49 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 1U2QAu-0004zW-0g for gctc-ntg-context-518@m.gmane.org; Mon, 04 Feb 2013 18:49:48 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 5447C101F9; Mon, 4 Feb 2013 18:49:29 +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 Jneq63b5zwio; Mon, 4 Feb 2013 18:49:27 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 70D521020B; Mon, 4 Feb 2013 18:49:27 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 832E31020B for ; Mon, 4 Feb 2013 18:49:25 +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 GVnzLcsKxabJ for ; Mon, 4 Feb 2013 18:49:24 +0100 (CET) Original-Received: from filter2-til.mf.surf.net (filter2-til.mf.surf.net [194.171.167.218]) by balder.ntg.nl (Postfix) with ESMTP id 99B44101F9 for ; Mon, 4 Feb 2013 18:49:24 +0100 (CET) Original-Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com [209.85.214.43]) by filter2-til.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id r14HnNA6029475 for ; Mon, 4 Feb 2013 18:49:24 +0100 Original-Received: by mail-bk0-f43.google.com with SMTP id jm19so2927207bkc.30 for ; Mon, 04 Feb 2013 09:49:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :content-transfer-encoding:message-id:references:to:x-mailer; bh=nwnY0rugtLelG7RoHBxSvNpefdN+ourZaXzJyDaWByw=; b=otVuyEPU3mVikZUuQIuGg7Gc9SmYQ4235ycGXMcxKTEv9ZYnR/IWl1mskuGvw7hfBs DR0Ro8xPLHAz/f4tGooAv/CLOAQ369Xcg2L9iXb+yvnSpu/GMf7wKm/6V9Fbgntfybqm aJ0XR6lh4Mdkxu0+982SzDMHJ/eIP38FR8i1yJypq9ZhH8yNT/4ezQAXo1ybrAP6rZiI 51UPbOF9vj19EcN2/LEC9y/DcJTYk9eSvDNSQ52j10S/JoJ+4f7z5ca3eVHCgCVq9wQO zgnRRd+6QtiVlz1y1yyJU59qlzkYIOrLlj1mKtl/OlKMXznzDEkFdx/YBeszWfGuWS1R QQaQ== X-Received: by 10.204.4.146 with SMTP id 18mr5901720bkr.9.1360000163554; Mon, 04 Feb 2013 09:49:23 -0800 (PST) Original-Received: from keima.localdomain (nrbg-4dbf03be.pool.mediaWays.net. [77.191.3.190]) by mx.google.com with ESMTPS id x10sm5616699bkv.13.2013.02.04.09.49.21 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 09:49:22 -0800 (PST) In-Reply-To: <510FEBD1.9000908@ingohohmann.de> X-Mailer: Apple Mail (2.1499) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.214.43; 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: 0TIUhNnAB - 4625898ef850 - 20130204 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.218 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:80650 Archived-At: Am 04.02.2013 um 18:11 schrieb Ingo Hohmann : > Hi, > > in another thread I got an answer to the question, how to format lines in an environment automatically. > Is there a way to get the content of source lines? For example, to save the line content into a variable? You can save the content in a buffer and process the content with Lua. \startluacode userdata = userdata or { } userdata.linescontent = userdata.linescontent or { } local linescontent = userdata.linescontent function linescontent.process() local lines = string.splitlines(buffers.getcontent("linescontent")) context.startlines() for i=1,#lines do local l = lines[i] if i == 1 then context("{\\bf %s}",l) context(true) elseif i == 2 then context("{\\tt %s}",l) context(true) else context("%s",l) context(true) end end context.stoplines() end \stopluacode \def\startlinescontent {\grabbufferdata[linescontent][startlinescontent][stoplinescontent]} \def\stoplinescontent {\ctxlua{userdata.linescontent.process()}} \starttext \startlinescontent One Two Three Four Five Six \stoplinescontent \stoptext Wolfgang ___________________________________________________________________________________ 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 ___________________________________________________________________________________