[NTG-context] \savebuffer to merge of save contents
Hello ConTeXist. Is there any possibility or modifications that will allow to savebuffer to work, so that will add (merge) the buffer contents into a file (Which content of the previous buffer)? For inspiration, it is possible use a solution that wrote before year ago Wolfgang for Lukas Prochazka – ie https://mailman.ntg.nl/pipermail/ntg-context/2016/087657.html Thanx Jaroslav Hajtmar Here is source code of Wolfgangs solution: \unexpanded\def\startcontentexport {\dosingleempty\dostartcontentexport} \def\dostartcontentexport[#1]% {\iffirstargument \edef\contentexportfile{#1}% \else \let\contentexportfile\empty \fi \grabbufferdata[contentexport][startcontentexport][stopcontentexport]} \def\stopcontentexport {\doifsomething{\contentexportfile}{\savebuffer[list=contentexport,prefix=no,file=\contentexportfile]}% \getbufferdata[contentexport]} \starttext A \startcontentexport[Test.mkiv] Basic content … \startitemize \item Item \stopitemize \stopcontentexport B \startcontentexport[Test.mkiv] Add this text into Test.mkiv file \startitemize \item Item \stopitemize \stopcontentexport C \startcontentexport[Test.mkiv] And this text add into Test.mkiv file too. \startitemize \item Item \stopitemize \stopcontentexport \stoptext ___ 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://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___
Re: [NTG-context] \savebuffer
>> Which file extension would this use, “tmp” as the current \savebuffer >> command or a requested with is applied with the filename (e.g. >> “file=myfile.tex”) or a extension key (e.g. “extension=tex”). > > > with prefix=no it uses the given filename (so no suffix if not given) `prefix=no` doesn't really hint at that. What about `prefix=,suffix=` (default: `prefix=\jobname,suffix=.tmp`)? Cheers, and a happy new year to all, Sietse On Wed, Jan 2, 2013 at 10:20 AM, Hans Hagen wrote: > On 1/2/2013 9:15 AM, Wolfgang Schuster wrote: > >> Which file extension would this use, “tmp” as the current \savebuffer >> command or a requested with is applied with the filename (e.g. >> “file=myfile.tex”) or a extension key (e.g. “extension=tex”). > > > with prefix=no it uses the given filename (so no suffix if not given) > > > - > Hans Hagen | PRAGMA ADE > Ridderstraat 27 | 8061 GH Hasselt | The Netherlands > tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com > | www.pragma-pod.nl > - > ___ > 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 > ___ ___ 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] \savebuffer
On 1/2/2013 9:15 AM, Wolfgang Schuster wrote: Which file extension would this use, “tmp” as the current \savebuffer command or a requested with is applied with the filename (e.g. “file=myfile.tex”) or a extension key (e.g. “extension=tex”). with prefix=no it uses the given filename (so no suffix if not given) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ 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] \savebuffer
Am 31.12.2012 um 19:02 schrieb Hans Hagen : > On 12/29/2012 6:29 PM, Wolfgang Schuster wrote: >> Hi Hans, >> >> can you add a \savebuffer variant which works like the first version of the >> command where >> >> \savebuffer[][] >> >> saved the buffer as and not as \jobname-.tmp like it >> currently does. >> >> >> Instead of a new command a key-val-version of \savebuffer would do the job >> as well, e.g. >> >> \savebuffer[list=,file=,prefix=no] >> >> or something similar. > > next beta: > > \starttext > > \startbuffer[test] > crap > \stopbuffer > > \savebuffer[test][whatever] > > \savebuffer[list=test,file=something,prefix=no] > > \stoptext Which file extension would this use, “tmp” as the current \savebuffer command or a requested with is applied with the filename (e.g. “file=myfile.tex”) or a extension key (e.g. “extension=tex”). 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] \savebuffer
On 12/29/2012 6:29 PM, Wolfgang Schuster wrote: Hi Hans, can you add a \savebuffer variant which works like the first version of the command where \savebuffer[][] saved the buffer as and not as \jobname-.tmp like it currently does. Instead of a new command a key-val-version of \savebuffer would do the job as well, e.g. \savebuffer[list=,file=,prefix=no] or something similar. next beta: \starttext \startbuffer[test] crap \stopbuffer \savebuffer[test][whatever] \savebuffer[list=test,file=something,prefix=no] \stoptext - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl - ___ 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 ___
[NTG-context] \savebuffer
Hi Hans, can you add a \savebuffer variant which works like the first version of the command where \savebuffer[][] saved the buffer as and not as \jobname-.tmp like it currently does. Instead of a new command a key-val-version of \savebuffer would do the job as well, e.g. \savebuffer[list=,file=,prefix=no] or something similar. 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] \savebuffer disappeared
Hello, > The macro \savebuffer seems to have disappeared from mkiv. What's now > the official way to write out chunks of code into a file? I guess there's not going to be an official way anymore, according to yourself (http://www.ntg.nl/pipermail/ntg-context/2007/026680.html), but you can always use the original definition: \def\savebuffer{\dosingleempty\dosavebuffer} \def\dosavebuffer[#1]{\ctxlua{buffers.save("#1")}} Arthur ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] \savebuffer disappeared
Hello Hans, The macro \savebuffer seems to have disappeared from mkiv. What's now the official way to write out chunks of code into a file? \startbuffer[abc] Module stopped working !?#...@! \stopbuffer \savebuffer[abc] Thanks, Mojca ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
[NTG-context] usage of \savebuffer
Hello, How must \savebuffer be used? I would like to save some lines in file abc, but there are 2 problems: - the file is called \jobname-abc.tmp - the line-endings are removed Test-file: % engine=luatex \startbuffer[abc] asjdf asdjf klasdjf kla asjdf asdjf klasdjf kla asjdf asdjf klasdjf kla \stopbuffer \savebuffer[abc] \starttext only one line found in file test-abc.tmp \stoptext Cheers, Peter -- http://pmrb.free.fr/contact/ ___ 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 : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___