From: Aditya Mahajan <adityam@umich.edu>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Removing banner from mtxrun output
Date: Tue, 21 Sep 2010 16:18:42 -0400 (EDT) [thread overview]
Message-ID: <alpine.LNX.2.01.1009211604090.16752@ybpnyubfg.ybpnyqbznva> (raw)
In-Reply-To: <20100921192856.GA32631@gaston.couberia.bzh>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 1528 bytes --]
On Tue, 21 Sep 2010, Peter Münster wrote:
> On Tue, Sep 21 2010, Johan Sandblom wrote:
>
>> Is there a way to instruct
>> \typefile to ignore the last four lines of the outputfile? I assume
>> defining an alternative command which does just that is not too
>> difficult, but sadly beyond me.
>
> It seems, that it's not possible at the moment. There is a tracker item
> for this feature: http://tracker.luatex.org/view.php?id=475
Not hard to do, just no interface. We can change buffers.range so that it
accepts {1,-4} to mean from first to last-4 lines, and then just set
\typefile[lines={1,-4}]{filename}
In any case, it is easy to define a lua function that does this.
\startluacode
function buffers.stripfromend(name, count)
local str = buffers.loaddata(name)
if str and str~= "" then
local lines = str:splitlines()
local line, n, action = 0, 0, buffers.typeline
local first, last, m = buffers.strip(lines)
last = last - count
m = m - count
for i=first,last do
n, line = action(lines[i], n, m, line)
end
end
end
\stopluacode
\unprotect
\def\strippedtyping#1#2% count file
{\begingroup
\tttf
\let\obs\specialobeyedspace
\ctxlua{buffers.stripfromend(\!!bs#2\!!es, #1)}
\endgraf
\endgroup}
\protect
\starttext
\strippedtyping{4}{filename}
\stoptext
To use this with t-filter, you can just say
readcommand=\strippedtyping{4},
Aditya
[-- Attachment #2: Type: text/plain, Size: 486 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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next prev parent reply other threads:[~2010-09-21 20:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 8:26 Johan Sandblom
2010-09-20 8:44 ` luigi scarso
2010-09-20 9:23 ` Aditya Mahajan
2010-09-20 20:56 ` Johan Sandblom
2010-09-21 18:44 ` Johan Sandblom
2010-09-21 19:28 ` Peter Münster
2010-09-21 20:18 ` Aditya Mahajan [this message]
2010-09-21 20:37 ` Johan Sandblom
2010-09-21 20:45 ` Hans Hagen
2010-09-20 9:17 ` Aditya Mahajan
2010-09-20 20:02 ` Johan Sandblom
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=alpine.LNX.2.01.1009211604090.16752@ybpnyubfg.ybpnyqbznva \
--to=adityam@umich.edu \
--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).