On 8/17/2021 8:44 PM, Wolfgang Schuster via ntg-context wrote:
Hans van der Meer via ntg-context schrieb am 17.08.2021 um 15:15:
Is it possible to retrieve the contents of a file directly into a buffer? On the Wiki I could not find such a command. That is, equivalent to something like:
\startbuffer[from file]
contents of the file
\stopbuffer

Yes and no. The \samplefile command used to read file for example
stores the content of a file in a buffer to avoid rereading the file each
time the content is output but there is no way to suppress the output
neither to change the name of the buffer.

\starttext

\startnointerference
\samplefile{knuth}
\stopnointerference

\typebuffer[knuth]

\getbuffer[knuth]

\stoptext
\starttext

    \ctxlua{buffers.assign(
        "hvdm-is-not-afraid-of-some-lua",
        io.loaddata(resolvers.findfile("tufte.tex"))
    )}

    \typebuffer[hvdm-is-not-afraid-of-some-lua]

\stoptext




-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to