Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: printing source code green bar style

by thorkild (Initiate)
on Sep 18, 2004 at 02:05 UTC ( #391930=note: print w/replies, xml ) Need Help??


in reply to printing source code green bar style

a2ps (the swiss knife of pretty-printing) actually already has support for doing this. a2ps uses different styles for its printouts and one of those is named 'matrix'.
so, by running:

a2ps --prologue=matrix -o test.ps test.pl

it will generate a suitable matrix style printout. The default is to alternate the background each 6. line, but this can be adjusted. (I tested with a2ps 4.13b. I had a postscript-problem with an earlier version before I asked apt to kindly update it.)

I actually didn't find out how to adjust that value now, so I ended up patching matrix.pro (the prologue file). I changed the expand-line to:

%Expand:  nline #{pro.matrix.cycle:-2} mod #{pro.matrix.gray:-1} ge {

-Thorkild

PS: Yes, a2ps knows perl already

Replies are listed 'Best First'.
Re^2: printing source code green bar style
by BlndCat (Initiate) on Sep 20, 2004 at 15:56 UTC
    First of all, thanks for all the helpful replies. Especially to hsmyers because I was starting to think that I was the only one who ever wanted to print-out code in such a way. And also to Thorkild. I've just had a look at a2ps and it seems that it might do the trick, especially with the patched matrix.pro file.

    I might still try to implement it using perl and outputting html etc. in the future but in the meantime, I'll use the right tool for the right job.

    thanks again!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391930]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (5)
As of 2020-05-27 23:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (162 votes). Check out past polls.

    Notices?