From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/100680 Path: news.gmane.org!.POSTED!not-for-mail From: Wolfgang Schuster Newsgroups: gmane.comp.tex.context Subject: Re: Including part of a program source file Date: Sat, 21 Apr 2018 17:29:58 +0200 Message-ID: <5ADB58F6.7080008@gmail.com> References: <87zi1wpskq.fsf@gmail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============4636850933340670765==" X-Trace: blaine.gmane.org 1524324516 3535 195.159.176.226 (21 Apr 2018 15:28:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 21 Apr 2018 15:28:36 +0000 (UTC) User-Agent: Postbox 5.0.25 (Macintosh/20180328) To: "N. Raghavendra" , mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Sat Apr 21 17:28:32 2018 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from zapf.boekplan.nl ([5.39.185.232] helo=zapf.ntg.nl) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f9uRC-0000h3-Nk for gctc-ntg-context-518@m.gmane.org; Sat, 21 Apr 2018 17:28:30 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 2ABF362603C; Sat, 21 Apr 2018 17:30:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w8pcK0zoC0O5; Sat, 21 Apr 2018 17:30:13 +0200 (CEST) Original-Received: from zapf.ntg.nl (localhost [IPv6:::1]) by zapf.ntg.nl (Postfix) with ESMTP id 7AA2D625E7F; Sat, 21 Apr 2018 17:30:13 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by zapf.ntg.nl (Postfix) with ESMTP id 08603625E7F for ; Sat, 21 Apr 2018 17:30:13 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at zapf.boekplan.nl Original-Received: from zapf.ntg.nl ([127.0.0.1]) by localhost (zapf.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pzrQ72uRFYdb for ; Sat, 21 Apr 2018 17:30:11 +0200 (CEST) Original-Received: from mail-wr0-f174.google.com (mail-wr0-f174.google.com [209.85.128.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by zapf.ntg.nl (Postfix) with ESMTPS id E725D625E75 for ; Sat, 21 Apr 2018 17:30:01 +0200 (CEST) Original-Received: by mail-wr0-f174.google.com with SMTP id h3-v6so30087847wrh.5 for ; Sat, 21 Apr 2018 08:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to; bh=zf+uhR5+DWBijob4yYo1bChyORXO/rCKhT6CwPnvLWs=; b=iirylxOlCgdZNkgd3BWCP3S4fdBO/wHLxJuBNnUhO60L/5JT68V5t8Zm8CC4libni7 QGsZUVwLTgburHXIjdJryrquAvPJdI2N+dx+lyVeHDrDi1peykKZQn+6bIUinKOyu2M6 U6PSPLM2AInZnP+iRzt7jdcPO3ZfS244/DHcEv2sAo5Siu+x7qLiZtzVaZQKTiNb9KKZ 6uSfpHg8LgPsjdz5Ej5WCHkz5catRk7TNzAF2WXQgudq8t/WJrtA39ftiGz6gK6s94jg noe5DFa/FC9hDEHoS6T03DhE1cD/cnZd+6bYsTMWtY3ITU4VMZH1HgwGdY5M/N0vSt3r rQxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to; bh=zf+uhR5+DWBijob4yYo1bChyORXO/rCKhT6CwPnvLWs=; b=X5XXUMXqEuLEhbIokf02nMZ9xnRVS+Z+RiZr0LNhl4a5AejJ2nMgmSvBdURtIKtXzW D35GTQDWRDFd6wxGU0i8BdfL+ImCwAXsA3jhmWNGSM9waaHLFLBluHdkNvImRYkEvM4W 1vfV48DRhUO+yff/BP/SzSmhosEEhgqYSUeodk1BjtKsA8amKb56AHrbmioUe1nKcCIq IoET+u6KeAl3159t5yl7LY4BTk0Z2rFVFNoeelbhiHsZQW69YfAz82wKNFX8xjiegAf8 4x3Kxstd+lsnB6RBzFgipDKg+wJGBfyuNTjtiJ+XQ4tz3qr3HHG8BD0cl5qQA5gXv8W1 6iuQ== X-Gm-Message-State: ALQs6tBNj9giWJvy7nXDsQgLODkn5sWTkfpb5FTFhIWkdCsyzKTFMQkZ vDZdxG320N0xNi8fpycJYAA= X-Google-Smtp-Source: AIpwx4+NAs7LtU8mHkdNvQLtEN9QkdOC3EtsrRde/XD0EM1xd3kS4RBCpgk5rxG/L/NR+d+GgyFwCg== X-Received: by 10.80.182.44 with SMTP id b41mr13926083ede.255.1524324601283; Sat, 21 Apr 2018 08:30:01 -0700 (PDT) Original-Received: from [192.168.1.11] (x4dbe95e4.dyn.telefonica.de. [77.190.149.228]) by smtp.gmail.com with ESMTPSA id e24sm3628308edc.80.2018.04.21.08.30.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 21 Apr 2018 08:30:00 -0700 (PDT) In-Reply-To: <87zi1wpskq.fsf@gmail.com> X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.16 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: "ntg-context" Xref: news.gmane.org gmane.comp.tex.context:100680 Archived-At: This is a multi-part message in MIME format. --===============4636850933340670765== Content-Type: multipart/alternative; boundary="------------020804050208070403080102" This is a multi-part message in MIME format. --------------020804050208070403080102 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit The verbatim commands have a range key which let you select parts of the code, you can use line numbers to include a small block (e.g. range={3,10} or range {3,+7}) or you put labels in your code. \startbuffer % cmd:one:begin \define\FirstCommand {\dosingleempty\doFirstCommand} \def\doFirstCommand[#1]% {This is the definition for the first command} % cmd:one:end % cmd:two:begin \define\SecondCommand {\dosingleempty\doSecondCommand} \def\doSecondCommand[#1]% {This is the definition for the second command} % cmd:two:end \stopbuffer \starttext \typebuffer[range={cmd:two:begin,cmd:two:end}] \stoptext Wolfgang > N. Raghavendra > 21. April 2018 um 16:00 > I am writing some notes using ConTeXt, which involves displaying parts > of some program source files. At present, I am manually cutting and > pasting the parts into the ConTeXt file. Is it possible to make ConTeXt > do that for me? I am thinking of including each part of the Coq sources > between tags like this: > > ------------------------------------------------------------ > $ cat src-file > > part_to_be_included_1 > > > > part_to_be_included_2 > > ------------------------------------------------------------ > > I would like to say something like > > \IncludePart{src-file}{tag-1} > > in my ConTeXt file to get > > part_to_be_included_1 > > at that place in the PDF output after I run `context'. I would > appreciate any advice on how to go about this. > > Thanks, > Raghu. > > -- > N. Raghavendra , http://www.retrotexts.net/ > Harish-Chandra Research Institute, http://www.hri.res.in/ > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ --------------020804050208070403080102 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit The verbatim commands have a range key which let you select parts of the code,
you can use line numbers to include a small block (e.g. range={3,10} or range {3,+7})
or you put labels in your code.

\startbuffer
% cmd:one:begin
\define\FirstCommand
  {\dosingleempty\doFirstCommand}

\def\doFirstCommand[#1]%
  {This is the definition for the first command}
% cmd:one:end

% cmd:two:begin
\define\SecondCommand
  {\dosingleempty\doSecondCommand}

\def\doSecondCommand[#1]%
  {This is the definition for the second command}
% cmd:two:end
\stopbuffer

\starttext
\typebuffer[range={cmd:two:begin,cmd:two:end}]
\stoptext

Wolfgang
21. April 2018 um 16:00
I am writing some notes using ConTeXt, which involves displaying parts
of some program source files. At present, I am manually cutting and
pasting the parts into the ConTeXt file. Is it possible to make ConTeXt
do that for me? I am thinking of including each part of the Coq sources
between tags like this:

------------------------------------------------------------
$ cat src-file
<tag-1>
part_to_be_included_1
</tag-2>

<tag-2>
part_to_be_included_2
</tag-2>
------------------------------------------------------------

I would like to say something like

\IncludePart{src-file}{tag-1}

in my ConTeXt file to get

part_to_be_included_1

at that place in the PDF output after I run `context'. I would
appreciate any advice on how to go about this.

Thanks,
Raghu.

--
N. Raghavendra <raghu@hri.res.in>, http://www.retrotexts.net/
Harish-Chandra Research Institute, http://www.hri.res.in/
___________________________________________________________________________________
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
___________________________________________________________________________________

--------------020804050208070403080102-- --===============4636850933340670765== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX18KSWYgeW91ciBxdWVzdGlvbiBpcyBvZiBpbnRlcmVz dCB0byBvdGhlcnMgYXMgd2VsbCwgcGxlYXNlIGFkZCBhbiBlbnRyeSB0byB0aGUgV2lraSEKCm1h aWxsaXN0IDogbnRnLWNvbnRleHRAbnRnLm5sIC8gaHR0cDovL3d3dy5udGcubmwvbWFpbG1hbi9s aXN0aW5mby9udGctY29udGV4dAp3ZWJwYWdlICA6IGh0dHA6Ly93d3cucHJhZ21hLWFkZS5ubCAv IGh0dHA6Ly9jb250ZXh0LmFhbmhldC5uZXQKYXJjaGl2ZSAgOiBodHRwczovL2JpdGJ1Y2tldC5v cmcvcGhnL2NvbnRleHQtbWlycm9yL2NvbW1pdHMvCndpa2kgICAgIDogaHR0cDovL2NvbnRleHRn YXJkZW4ubmV0Cl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f --===============4636850933340670765==--