/*
- * "$Id: rfctohtml.c 4966 2006-01-23 00:41:22Z mike $"
+ * "$Id: rfctohtml.c 5143 2006-02-21 19:13:01Z mike $"
*
* RFC file to HTML conversion program.
*
*
* Contents:
*
+ * main() - Convert a man page to HTML.
+ * put_entity() - Put a single character, using entities as needed.
+ * put_line() - Put a whole string for a line.
*/
/*
*lineptr, /* Pointer into line */
name[1024], /* Heading anchor name */
*nameptr; /* Pointer into anchor name */
- int inheading, /* Inside a heading? */
+ int rfc, /* RFC # */
+ inheading, /* Inside a heading? */
inpre, /* Inside preformatted text? */
intoc, /* Inside table-of-contents? */
toclevel, /* Current table-of-contents level */
"\t<style type='text/css'><!--\n"
"\th1, h2, h3 { font-family: sans-serif; }\n"
"\tp, pre { font-family: monospace; }\n"
- "\th1.title, h2.title, h3.title { border-bottom: solid "
+ "\th2.title, h3.title, h3.title { border-bottom: solid "
"2px #000000; }\n"
"\t--></style>\n");
*/
linenum = 0;
+ rfc = 0;
while (cupsFileGets(infile, line, sizeof(line)))
{
if (!line[0])
break;
+ else if (!strncasecmp(line, "Request for Comments:", 21))
+ rfc = atoi(line + 21);
}
/*
for (lineptr = line; isspace(*lineptr & 255); lineptr ++);
- cupsFilePrintf(outfile, "<title>%s", lineptr);
+ cupsFilePrintf(outfile, "<title>RFC %d: %s", rfc, lineptr);
while (cupsFileGets(infile, line, sizeof(line)))
{
}
strlcpy(name, line, sizeof(name));
- for (nameptr = name, level = 0; *nameptr;)
+ for (nameptr = name, level = 1; *nameptr;)
if (isdigit(*nameptr & 255))
{
while (isdigit(*nameptr & 255))
else
nameptr ++;
- cupsFilePrintf(outfile, "\n<h%d class='title'><a name='s%s'>", level, name);
+ cupsFilePrintf(outfile, "\n<h%d class='title'><a name='s%s'>", level,
+ name);
put_line(outfile, line);
intoc = 0;
if (!inheading)
{
- cupsFilePuts(outfile, "\n<h1 class='title'>");
+ cupsFilePuts(outfile, "\n<h2 class='title'>");
inheading = -1;
}
if (inheading)
{
if (inheading < 0)
- cupsFilePuts(outfile, "</h1>\n");
+ cupsFilePuts(outfile, "</h2>\n");
else
cupsFilePrintf(outfile, "</a></h%d>\n", inheading);
}
/*
- * End of "$Id: rfctohtml.c 4966 2006-01-23 00:41:22Z mike $".
+ * End of "$Id: rfctohtml.c 5143 2006-02-21 19:13:01Z mike $".
*/