[NTG-context] Getting the content of source lines in a \startlines \stoplines env?
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? Thank you in advance, Ingo ___ 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 ___
Re: [NTG-context] Getting the content of source lines in a \startlines \stoplines env?
Am 04.02.2013 um 18:11 schrieb Ingo Hohmann cont...@ingohohmann.de: 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 ___
Re: [NTG-context] Getting the content of source lines in a \startlines \stoplines env?
On Mon, 4 Feb 2013, Wolfgang Schuster wrote: context({\\bf %s},l) context(true) What does context(true) do? 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 ___
Re: [NTG-context] Getting the content of source lines in a \startlines \stoplines env?
On Mon, Feb 4, 2013 at 7:05 PM, Aditya Mahajan adit...@umich.edu wrote: On Mon, 4 Feb 2013, Wolfgang Schuster wrote: context({\\bf %s},l) context(true) What does context(true) do? Aditya Newline tokens are injected by passing true to the context command: see cld-mkiv.pdf -- luigi ___ 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 ___