ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Hans Hagen <j.hagen@xs4all.nl>
Subject: Re: file to buffer
Date: Tue, 17 Aug 2021 21:17:33 +0200	[thread overview]
Message-ID: <3c182f1b-0d54-bab2-1412-ea5bf99a8f8b@xs4all.nl> (raw)
In-Reply-To: <645bdc59-a10e-9803-f144-8a89df82809b@gmail.com>

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	other threads:[~2021-08-17 19:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 13:15 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c182f1b-0d54-bab2-1412-ea5bf99a8f8b@xs4all.nl \
    --to=ntg-context@ntg.nl \
    --cc=j.hagen@xs4all.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).