ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* file to buffer
@ 2021-08-17 13:15 Hans van der Meer via ntg-context
  2021-08-17 18:44 ` Wolfgang Schuster via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Hans van der Meer via ntg-context @ 2021-08-17 13:15 UTC (permalink / raw)
  To: ConTeXt NTG; +Cc: Hans van der Meer


[-- Attachment #1.1: Type: text/plain, Size: 248 bytes --]

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

dr. Hans van der Meer



[-- Attachment #1.2: Type: text/html, Size: 1431 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file to buffer
  2021-08-17 13:15 file to buffer Hans van der Meer via ntg-context
@ 2021-08-17 18:44 ` Wolfgang Schuster via ntg-context
  2021-08-17 19:17   ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfgang Schuster via ntg-context @ 2021-08-17 18:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Hans van der Meer via ntg-context
  Cc: Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 682 bytes --]

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

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 1277 bytes --]

[-- Attachment #2: Type: text/plain, Size: 493 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: file to buffer
  2021-08-17 18:44 ` Wolfgang Schuster via ntg-context
@ 2021-08-17 19:17   ` Hans Hagen via ntg-context
  0 siblings, 0 replies; 3+ messages in thread
From: Hans Hagen via ntg-context @ 2021-08-17 19:17 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-17 19:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 13:15 file to buffer Hans van der Meer via ntg-context
2021-08-17 18:44 ` Wolfgang Schuster via ntg-context
2021-08-17 19:17   ` Hans Hagen via ntg-context

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).