[Tutor] Fw: pretty_printing
Alan Gauld
alan.gauld at freenet.co.uk
Mon Oct 9 01:34:15 CEST 2006
Forwarding to the list for interests sake,
mainly for vim users.
----- Original Message -----
From: "LandSurveyor" <chiselchip at earthlink.net>
Sent: Monday, October 09, 2006 12:00 AM
Subject: Re: pretty_printing
> This issue has been solved! in a big way!!
> (I hope I'm doing this right, replying to your email this way...I'm
> new to this. Hope this makes its' way to the 'big screen')
>
> The entire issue [that I raised] regarding printing scripts with the
> same syntax highlighting with which they were displayed in the Vim
> editor turn out to be a Vim issue, and Vim solves it in an elegant,
> rich way. By using the command,
>
> ":hardcopy"
>
> (from within the Vim editor) a printout of the current file [being
> edited] is produced, with very rich colors, faithful to the
> displayed syntax colors. Two companion :help 'modules' provide a
> smorgasbord of options to apply to the desired hardcopy. They are:
>
> ":printoptions", and
> ":printfont"
>
> Ask for ":help" with either of the two options listed above, and a
> very clear and detailed file is offered in each case, from which to
> draw examples and/or specific coding types.
>
> -----Original Message-----
>>From: Alan Gauld <alan.gauld at freenet.co.uk>
>>Sent: Sep 3, 2006 7:03 PM
>>To: "Lowell H. Tackett" <chiselchip at earthlink.net>
>>Subject: Re: pretty_printing
>>
>>> It had occured to me that the root of my lack of success is simply
>>> that file
>>> XYZ.py sits on my HD as a simple string of X's and O's, not as a
>>> pretty,
>>> colorful text repository. Only thru the magic of say, Vim, is the
>>> display
>>> converted to meaningful hues. Therefor, Vim somehow knows how to
>>> detect each
>>> of the discrete syntax types: comments, quotes, reserved words,
>>> etc., and to
>>> apply an appropriate color into its' display.
>>
>>No magic, the patterns are defined in the xxxx.vim files in the
>>syntax
>>folder.
>>Each one defines a keyword/style and the regex that defines the
>>terms.
>>
>>> It occured to me that it ought to be very simple to gain access to
>>> those
>>> syntax discrimnators, write a code script that creates a 'dye' for
>>> each
>>> syntax type, and pipe a print request thru such a file.
>>
>>Yes, not impossible, but not trivial either.
>>The simplest way to generate the printed output is probably to
>>create an intermediate html file and print that via a browser
>>- possibly using the python browser module...
>>
>>Alan Gauld
>>Author of the Learn to Program web site
>>http://www.freenetpages.co.uk/hp/alan.gauld
>>
>
More information about the Tutor
mailing list