Perfect, thank you. Johan
2010/9/21 Aditya Mahajan <adit...@umich.edu>: > 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 > ___________________________________________________________________________________ > 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 > ___________________________________________________________________________________ > > -- Johan Sandblom, MD PhD m +46735521477 Sweden "What is wanted is not the will to believe, but the will to find out, which is the exact opposite" - Bertrand Russell ___________________________________________________________________________________ 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 ___________________________________________________________________________________