5 /* RGB -> HTML color mapper function. */
6 sub map_color (r, g, b)
8 return sprintf ("#%02X%02X%02X", r, g, b);
11 LANGUAGE_SPECIALS = /[<>\&\"]/;
13 sub language_print (str)
15 str = regsuball (str, /\&/, "&");
16 str = regsuball (str, /</, "<");
17 str = regsuball (str, />/, ">");
18 str = regsuball (str, /\"/, """);
22 sub language_symbol (symbol)
31 if (current_input_file == 1)
33 print ("<!DOCTYPE html PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n");
34 print ("<HTML>\n<HEAD>\n<TITLE>");
35 language_print (document_title);
36 print ("</TITLE>\n</HEAD>\n",
38 ? "<BODY BGCOLOR=\"#FFFFFF\" TEXT=\"#000000\" LINK=\"#1F00FF\" ALINK=\"#FF0000\" VLINK=\"#9900DD\">"
40 "\n<A NAME=\"top\">\n");
42 if (need_version (1, 5, 1) && int (toc) == 1)
44 if (length (argv) == 0)
47 print ("<H1>Contents</H1>\n<OL>\n");
48 for (i = 0; i < length (argv); i = i + 1)
49 print (" <LI><A HREF=\"#file", i + 1, "\">", argv[i],
51 print ("</OL>\n<HR>\n");
55 print ("<A NAME=\"file", current_input_file, "\">\n<H1>");
56 language_print (filename);
58 if (int (num_input_files) > 1)
59 print (" ", current_input_file, "/", num_input_files);
64 if (need_version (1, 5, 1))
66 if (length (argv) >= 2 )
68 print ("[<A HREF=\"#top\">top</A>]");
70 if (current_input_file == 1)
73 print ("[<A HREF=\"\#file", current_input_file - 1,
76 if (current_input_file == length (argv))
79 print ("[<A HREF=\"#file", current_input_file + 1,
84 print ("[<A HREF=\"#top\">top</A>]");
92 if (current_input_file == int (num_input_files))
93 print ("<ADDRESS>Generated by ",
94 "<A HREF=\"http://www.iki.fi/~mtr/genscript/\">",
95 substring (version, strchr (version, 'G'), length (version)),
109 print ("<FONT COLOR=\"", face[fg_color], "\">");
110 /* The background color is not supported in HTML. */