| [Top] | [Contents] | [Index] | [ ? ] |
This file documents the GNU enscript program. This edition documents version 1.6.3.
1. Introduction 2. Invoking Enscript 3. Basic Printing 4. Advanced Usage 5. Configuration Files 6. Customization 7. The `states' Program 8. Writing New Highlighting Definitions Index
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.1 Input Encodings 3.2 Selecting Fonts 3.3 Page Headers 3.4 Page Handling 3.5 Highlighting
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.4.1 Page Orientation 3.4.2 N-up Printing 3.4.3 Fitting Text to Page
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
3.5.1 Different Output Languages
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
4.1 Selecting Pages 4.2 Escape Sequences 4.3 Input Filters 4.4 Slice Printing 4.5 PostScript Printer Controlling 4.6 Pass-Through Mode
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.1 Output Media 6.2 User-Defined Fancy Headers
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The highlighting works in three separate phases. First, the highlighing rules process the input stream and parse it into logical components. The components are called faces. A face presents one logical component of the input language, for example, a keyword, a comment, etc.. The enscript's highlighting model defines the following faces:
As the second step, the output style specifies how the faces are presented in the generated output. Each face has the following properties:
Finally, the output language describes how the faces and other text are presented in the output language. The output language defines a set of functions which are called to generate the output.
8.1 Highlighting Rules 8.2 Styles 8.3 Output Languages
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The following example creates a new output language simple_html
that creates simple HTML outputs. The output language is defined in a
file called `lang_simple_html.st'. The file must define a state
called lang_simple_html. The file can be located in any
directory that is in the load path of the states program.
The output language definitions are defined in the BEGIN block of
the lang_simple_html state. Please, note that the BEGIN
block is ended with a return-statement. This statement will
return the control to the calling state that is the start state of the
enscript highlight program. If the return-statement was omitted,
the states would start processing the input with the
lang_simple_html state which is obviously a wrong choice.
state lang_simple_html
{
BEGIN {
sub map_color (r, g, b)
{
return sprintf ("#%02X%02X%02X", r, g, b);
}
sub language_print (str)
{
str = regsuball (str, /\&/, "&");
str = regsuball (str, /</, "<");
str = regsuball (str, />/, ">");
str = regsuball (str, /\"/, """);
print (str);
}
sub language_symbol (symbol)
{
return false;
}
sub header ()
{
print ("<html>\n<head>\n<title>Simple HTML Output</title>\n");
print ("</head>\n<body>\n");
}
sub trailer ()
{
print ("</body>\n</html>\n");
}
sub fase_on (face)
{
if (face(boldp])
print ("<B>");
if (face(italicp])
print ("<I>");
if (face[fg_color])
print ("<FONT COLOR=\", face[fg_color], "\">");
}
sub face_off (face)
{
if (face[fg_color])
print ("</FONT>");
if (face[italicp])
print ("</I>");
if (face[boldp])
print ("</B>");
}
LANGUAGE_SPECIALS = /[<>\&\"]/;
return;
}
}
|
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| Jump to: | F H L M T |
|---|
| Jump to: | F H L M T |
|---|
| [Top] | [Contents] | [Index] | [ ? ] |
| [Top] | [Contents] | [Index] | [ ? ] |
1. Introduction
2. Invoking Enscript
3. Basic Printing
4. Advanced Usage
5. Configuration Files
6. Customization
7. The `states' Program
8. Writing New Highlighting Definitions
Index
| [Top] | [Contents] | [Index] | [ ? ] |
| Button | Name | Go to | From 1.2.3 go to |
|---|---|---|---|
| [ < ] | Back | previous section in reading order | 1.2.2 |
| [ > ] | Forward | next section in reading order | 1.2.4 |
| [ << ] | FastBack | previous or up-and-previous section | 1.1 |
| [ Up ] | Up | up section | 1.2 |
| [ >> ] | FastForward | next or up-and-next section | 1.3 |
| [Top] | Top | cover (top) of document | |
| [Contents] | Contents | table of contents | |
| [Index] | Index | concept index | |
| [ ? ] | About | this page |