/usr/share/enscript/hl/describe_languages.st is in enscript 1.6.5.90-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | /*
* Describe all known highlight languages.
*/
state describe_me
{
/ \*$/ {
}
/ \*\\\/.*/ {
print ("\n");
/* All done. */
return;
}
/ \* ?(.*)/ {
print ($1);
}
}
state describe_languages
{
/^\/\*\*.*$/ {
call (describe_me);
}
/[^\\\/]+/ {
/* NOP */
}
/./ {
/* NOP */
}
}
/*
* Create a HTML report of all supported highlighting rules.
*/
sub html_annotate_mailtos (str)
{
return regsuball (str, /[-_a-zA-Z0-9\\.]+@[-_a-zA-Z0-9\\.]+/,
"<a href=\"mailto:$0\">$0</a>");
}
sub html_quote (str)
{
str = regsuball (str, /\&/, "&");
str = regsuball (str, /</, "<");
str = regsuball (str, />/, ">");
str = regsuball (str, /\"/, """);
return str;
}
sub describe_me_html_print_pending_name ()
{
if (!language_name_pending)
return;
print ("<p>\n<dl compact>\n<dt><b>Name:</b><dd>",
html_quote (language_name), "\n");
language_name_pending = 0;
}
state describe_me_html
{
/ \*$/ {
}
/ \*\\\/.*/ {
/* Terminate this state. */
describe_me_html_print_pending_name ();
print ("</dl>\n");
return;
}
/ \* ?(.*)/ {
row = $1;
if (regmatch (row, /Name:(.*)/))
{
language_name = $1;
language_name_pending = 1;
}
else if (regmatch (row, /Description:(.*)/))
{
/* This starts the new language. */
title = $1;
title = regsub (title, /^[ \t]+/, "");
title = regsub (title, /[ \t\\.]+$/, "");
print ("<p><li><b>", html_quote (title), "</b><p>\n");
}
else if (regmatch (row, /([a-zA-Z]+:)(.*)/))
{
describe_me_html_print_pending_name ();
print ("<dt><b>", html_quote ($1), "</b><dd>",
html_annotate_mailtos (html_quote ($2)));
}
else
print (html_annotate_mailtos (html_quote (row)));
}
}
current_input_file = 0;
state describe_languages_html
{
BEGIN {
if (current_input_file == 0)
{
title = "Enscript Highlighting Languages And File Formats";
print ("<!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n",
"<html>\n<head>\n<title>", title, "</title>\n",
"<LINK REV=\"made\" HREF=\"mailto:mtr@iki.fi\">\n",
"</head>\n",
"<body BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#1F00FF\"",
"ALINK=\"#FF0000\" VLINK=\"#9900DD\">\n",
"<h1>", title, "</h1>\n<hr>\n<ul>\n");
}
current_input_file++;
}
END {
if (current_input_file == length (argv))
print ("\n</ul>\n<hr><address>By ", version,
"</address>\n</body>\n</html>\n");
}
/^\/\*\*.*$/ {
call (describe_me_html);
}
/[^\\\/]+/ {
/* NOP */
}
/./ {
/* NOP */
}
}
/*
Local variables:
mode: c
End:
*/
|