ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Jaroslav Hajtmar <hajtmar@gyza.cz>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: \savebuffer to merge of save contents
Date: Tue, 21 Mar 2017 12:30:43 +0000	[thread overview]
Message-ID: <BFBC0847-9191-4DC6-9180-DA261F26C85E@gyza.cz> (raw)


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

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





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

[-- Attachment #2: Type: text/plain, Size: 492 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
___________________________________________________________________________________

                 reply	other threads:[~2017-03-21 12:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=BFBC0847-9191-4DC6-9180-DA261F26C85E@gyza.cz \
    --to=hajtmar@gyza.cz \
    --cc=ntg-context@ntg.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).