diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-12-15 06:57:17 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-12-15 06:57:17 -0800 |
commit | d0e01100a2d59c4fc14918e18475aad0f853b0a0 (patch) | |
tree | 75570fbd89d4059d1e743bcf764edf96c1de9946 | |
parent | 76030a947f4f0726c7841767831ba5710cbfecb0 (diff) | |
download | man-d0e01100a2d59c4fc14918e18475aad0f853b0a0.tar.gz man-d0e01100a2d59c4fc14918e18475aad0f853b0a0.tar.bz2 man-d0e01100a2d59c4fc14918e18475aad0f853b0a0.zip |
Use lower case for all HTML tags and attributes.
-rw-r--r-- | man2html/man2html.c | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/man2html/man2html.c b/man2html/man2html.c index ef1fae8..eed6be2 100644 --- a/man2html/man2html.c +++ b/man2html/man2html.c @@ -370,8 +370,8 @@ static int dl_set[30]= { 0 }; #define DL 1 #define UL 2 #define OL 3 -static char *dl_open[4] = { "", "<DL COMPACT>\n", "<UL>", "<OL>" }; -static char *dl_close[4] = { "", "</DL>\n", "</UL>", "</OL>" }; +static char *dl_open[4] = { "", "<dl compact>\n", "<ul>", "<ol>" }; +static char *dl_close[4] = { "", "</dl>\n", "</ul>", "</ol>" }; static inline void dl_begin(void) { @@ -379,7 +379,7 @@ dl_begin(void) { out_html(dl_open[DL]); dl_set[itemdepth]=DL; } - out_html("<DT>"); + out_html("<dt>"); } static inline void @@ -398,14 +398,14 @@ dl_newlevel(void) { itemdepth++; if (itemdepth < SIZE(dl_set)) dl_set[itemdepth]=noDL; - out_html("<DL COMPACT><DT><DD>"); + out_html("<dl compact><dt><dd>"); } static inline void dl_endlevel(void) { if (itemdepth) { dl_end(); - out_html("</DL>\n"); + out_html("</dl>\n"); itemdepth--; } } @@ -455,14 +455,14 @@ Bug 2: incorrect font: after the .IP things are roman again. #define FO0 "" #define FC0 "" -#define FO1 "<I>" -#define FC1 "</I>" -#define FO2 "<B>" -#define FC2 "</B>" -#define FO3 "<TT>" -#define FC3 "</TT>" -#define FO4 "<TT><I>" -#define FC4 "</I></TT>" +#define FO1 "<i>" +#define FC1 "</i>" +#define FO2 "<b>" +#define FC2 "</b>" +#define FO3 "<tt>" +#define FC3 "</tt>" +#define FO4 "<tt><i>" +#define FC4 "</i></tt>" #define NFONTS 5 @@ -518,11 +518,11 @@ change_to_size(int nr) i=current_font; sizebuf[0]=0; strcat(sizebuf, change_to_font(0)); - if (current_size) strcat(sizebuf, "</FONT>"); + if (current_size) strcat(sizebuf, "</font>"); current_size=nr; if (nr) { int l; - strcat(sizebuf, "<FONT SIZE=\""); + strcat(sizebuf, "<font size=\""); l=strlen(sizebuf); if (nr>0) sizebuf[l++]='+'; else sizebuf[l++]='-',nr=-nr; sizebuf[l++]=nr+'0'; @@ -710,7 +710,7 @@ scan_escape(char *c) { skip_escape=exskipescape; intresult=j; break; - case 'l': h="<HR>"; curpos=0; + case 'l': h="<hr>"; curpos=0; case 'b': case 'v': case 'x': @@ -733,7 +733,7 @@ scan_escape(char *c) { case 'c': no_newline_output=1; break; case '{': newline_for_fun++; h="";break; case '}': if (newline_for_fun) newline_for_fun--; h="";break; - case 'p': h="<BR>\n";curpos=0; break; + case 'p': h="<br>\n";curpos=0; break; case 't': h="\t";curpos=(curpos+8)&0xfff8; break; case '<': h="<";curpos++; break; case '>': h=">";curpos++; break; @@ -950,7 +950,7 @@ scan_table(char *c) { out_html(change_to_size(0)); if (!fillout) { fillout=1; - out_html("</PRE>"); + out_html("</pre>"); } while (*h && *h!='\n') h++; if (h[-1]==';') { @@ -1126,45 +1126,45 @@ scan_table(char *c) { currow=currow->prev; } /* produce html output */ - if (center) out_html("<CENTER>"); - if (box==2) out_html("<TABLE BORDER><TR><TD>"); - out_html("<TABLE"); + if (center) out_html("<center>"); + if (box==2) out_html("<table border><tr><td>"); + out_html("<table"); if (box || border) { - out_html(" BORDER"); - if (!border) out_html("><TR><TD><TABLE"); - if (expand) out_html(" WIDTH=100%"); + out_html(" border"); + if (!border) out_html("><tr><td><table"); + if (expand) out_html(" width=100%"); } out_html(">\n"); currow=layout; while (currow) { j=0; - out_html("<TR VALIGN=top>"); + out_html("<tr valign=top>"); curfield=currow->first; while (curfield) { if (curfield->align!='S' && curfield->align!='^') { - out_html("<TD"); + out_html("<td"); switch (curfield->align) { case 'N': curfield->space+=4; case 'R': - out_html(" ALIGN=right"); + out_html(" align=right"); break; case 'C': - out_html(" ALIGN=center"); + out_html(" align=center"); default: break; } if (!curfield->valign && curfield->rowspan>1) - out_html(" VALIGN=center"); + out_html(" valign=center"); if (curfield->colspan>1) { char buf[5]; - out_html(" COLSPAN="); + out_html(" colspan="); sprintf(buf, "%i", curfield->colspan); out_html(buf); } if (curfield->rowspan>1) { char buf[5]; - out_html(" ROWSPAN="); + out_html(" rowspan="); sprintf(buf, "%i", curfield->rowspan); out_html(buf); } @@ -1173,8 +1173,8 @@ scan_table(char *c) { if (curfield->size) out_html(change_to_size(curfield->size)); if (curfield->font) out_html(change_to_font(curfield->font)); switch (curfield->align) { - case '=': out_html("<HR><HR>"); break; - case '_': out_html("<HR>"); break; + case '=': out_html("<hr><hr>"); break; + case '_': out_html("<hr>"); break; default: if (curfield->contents) out_html(curfield->contents); break; @@ -1184,20 +1184,20 @@ scan_table(char *c) { if (curfield->font) out_html(change_to_font(0)); if (curfield->size) out_html(change_to_size(0)); if (j>=maxcol && curfield->align>'@' && curfield->align!='_') - out_html("<BR>"); - out_html("</TD>"); + out_html("<br>"); + out_html("</td>"); } curfield=curfield->next; } - out_html("</TR>\n"); + out_html("</tr>\n"); currow=currow->next; } - if (box && !border) out_html("</TABLE>"); - out_html("</TABLE>"); - if (box==2) out_html("</TABLE>"); - if (center) out_html("</CENTER>\n"); + if (box && !border) out_html("</table>"); + out_html("</table>"); + if (box==2) out_html("</table>"); + if (center) out_html("</center>\n"); else out_html("\n"); - if (!oldfillout) out_html("<PRE>"); + if (!oldfillout) out_html("<pre>"); fillout=oldfillout; out_html(change_to_size(oldsize)); out_html(change_to_font(oldfont)); @@ -1565,12 +1565,12 @@ add_to_index(int level, char *item, char **result) while (level != subs) { if (level > subs) { manidx_need(5); - strcpy(manidx+mip, "<DL>\n"); + strcpy(manidx+mip, "<dl>\n"); mip += 5; subs++; } else { manidx_need(6); - strcpy(manidx+mip, "</DL>\n"); + strcpy(manidx+mip, "</dl>\n"); mip += 6; subs--; } @@ -1578,7 +1578,7 @@ add_to_index(int level, char *item, char **result) out = scan_troff(item, 1, &c); manidx_need(100 + strlen(c)); - sprintf(manidx+mip, "<DT><A HREF=\"#%s\">%s</A><DD>\n", label, c); + sprintf(manidx+mip, "<dt><a href=\"#%s\">%s</a><dd>\n", label, c); if (result) *result = c; else @@ -1735,8 +1735,8 @@ scan_request(char *c) { nofillout=1; break; case V('b','r'): - if (still_dd) out_html("<DD>"); - else out_html("<BR>\n"); + if (still_dd) out_html("<dd>"); + else out_html("<br>\n"); curpos=0; c=c+j; if (c[0] == escapesym) { c=scan_escape(c+1); } @@ -1766,17 +1766,17 @@ scan_request(char *c) { c=skip_till_newline(c); /* center next i lines */ if (i>0) { - out_html("<CENTER>\n"); + out_html("<center>\n"); while (i && *c) { char *line=NULL; c=scan_troff(c,1, &line); - if (line && strncmp(line, "<BR>", 4)) { + if (line && strncmp(line, "<br>", 4)) { out_html(line); - out_html("<BR>\n"); + out_html("<br>\n"); i--; } } - out_html("</CENTER>\n"); + out_html("</center>\n"); curpos=0; } break; @@ -1807,7 +1807,7 @@ scan_request(char *c) { if (!fillout) { out_html(change_to_font(0)); out_html(change_to_size('0')); - out_html("</PRE>\n"); + out_html("</pre>\n"); } curpos=0; fillout=1; @@ -1920,7 +1920,7 @@ scan_request(char *c) { if (fillout) { out_html(change_to_font(0)); out_html(change_to_size('0')); - out_html("<PRE>\n"); + out_html("<pre>\n"); } curpos=0; fillout=0; @@ -1942,7 +1942,7 @@ scan_request(char *c) { break; case V('s','p'): c=c+j; - if (fillout) out_html("<P>"); else { + if (fillout) out_html("<p>"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -1982,10 +1982,10 @@ scan_request(char *c) { if (!t) t=fname; fprintf(stderr, "ln -s %s.html %s.html\n", h, t); s=strrchr(t, '.');if (!s) s=t; - printf("<HTML><HEAD><TITLE> Manpage of %s</TITLE>\n" - "</HEAD><BODY>\n" - "See the manpage for <A HREF=\"%s.html\">%s</A>.\n" - "</BODY></HTML>\n", + printf("<html><head><title> Manpage of %s</title>\n" + "</head><body>\n" + "See the manpage for <a href=\"%s.html\">%s</a>.\n" + "</body></html>\n", s, h, h); } else #endif @@ -1994,10 +1994,10 @@ scan_request(char *c) { if (!l || !(f = fopen(h,"r"))) { fprintf(stderr, "man2html: unable to open or read file %s\n", h); - out_html("<BLOCKQUOTE>" + out_html("<blockquote>" "man2html: unable to open or read file\n"); out_html(h); - out_html("</BLOCKQUOTE>\n"); + out_html("</blockquote>\n"); } else { i=fread(buf+1,1,l,f); fclose(f); @@ -2029,7 +2029,7 @@ scan_request(char *c) { #if 0 dl_down(); #endif - out_html("<BR>\n"); + out_html("<br>\n"); c=c+j; c=scan_expression(c, &j); for (i=0; i<j; i++) out_html(" "); @@ -2105,7 +2105,7 @@ scan_request(char *c) { if (words) { scan_troff(wordlist[0], 1,NULL); } - out_html("<DD>"); + out_html("<dd>"); curpos = 0; break; case V('T','P'): @@ -2114,7 +2114,7 @@ scan_request(char *c) { /* somewhere a definition ends with '.TP' */ if (!*c) still_dd=1; else { c=scan_troff(c,1,NULL); - out_html("<DD>"); + out_html("<dd>"); } curpos=0; break; @@ -2137,18 +2137,18 @@ scan_request(char *c) { fprintf(idxfile,"\n"); } #endif - out_html("<A NAME=\""); + out_html("<a name=\""); out_html(idxlabel); /* this will not work in mosaic (due to a bug). ** Adding ' ' between '>' and '<' solves it, but creates ** some space. A normal space does not work. */ - out_html("\"></A>"); + out_html("\"></a>"); break; case V('L','P'): case V('P','P'): dl_end(); - if (fillout) out_html("<P>\n"); else { + if (fillout) out_html("<p>\n"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -2212,21 +2212,21 @@ scan_request(char *c) { out_html(change_to_size(0)); if (!fillout) { fillout=1; - out_html("</PRE>"); + out_html("</pre>"); } trans_char(c,'"', '\a'); h = NULL; c = add_to_index(mode, c, &h); - out_html("<A NAME=\""); + out_html("<a name=\""); out_html(label); /* for mosaic users */ - if (mode) out_html("\"> </A>\n<H3>"); - else out_html("\"> </A>\n<H2>"); + if (mode) out_html("\"> </a>\n<h3>"); + else out_html("\"> </a>\n<h2>"); mandoc_synopsis = (strncmp(c, "SYNOPSIS", 8) == 0); out_html(h); free(h); - if (mode) out_html("</H3>\n"); - else out_html("</H2>\n"); + if (mode) out_html("</h3>\n"); + else out_html("</h2>\n"); curpos=0; break; case V4('M','2','S','S'): @@ -2250,9 +2250,9 @@ scan_request(char *c) { h = NULL; (void) add_to_index(i, wordlist[2], &h); wordlist[2] = h; - out_html("<A NAME=\""); + out_html("<a name=\""); out_html(label); - out_html("\"> </A>\n<"); + out_html("\"> </a>\n<"); out_html(wordlist[1]); out_html(">"); out_html(wordlist[2]); out_html("</"); out_html(wordlist[1]); out_html(">\n"); @@ -2272,11 +2272,11 @@ scan_request(char *c) { *sl = 0; if (words > 1) { output_possible=1; - out_html("<HTML><HEAD><TITLE>Manpage of "); + out_html("<html><head><title>Manpage of "); out_html(wordlist[0]); - out_html("</TITLE>\n</HEAD><BODY>\n<H1>"); + out_html("</title>\n</head><body>\n<h1>"); out_html(wordlist[0]); - out_html("</H1>\nSection: "); + out_html("</h1>\nSection: "); if (words>4) out_html(wordlist[4]); else @@ -2284,14 +2284,14 @@ scan_request(char *c) { out_html(" ("); out_html(wordlist[1]); if (words>2) { - out_html(")<BR>Updated: "); + out_html(")<br>Updated: "); scan_troff(wordlist[2], 1, NULL); } else out_html(")"); - out_html("<BR><A HREF=\"#index\">Index</A>\n"); + out_html("<br><a href=\"#index\">Index</a>\n"); man_page_html(0,0); /* Return to Main Contents */ *sl='\n'; - out_html("<HR>\n"); - if (mandoc_command) out_html("<BR>BSD mandoc<BR>"); + out_html("<hr>\n"); + if (mandoc_command) out_html("<br>BSD mandoc<br>"); } c = sl+1; } else @@ -2459,7 +2459,7 @@ scan_request(char *c) { dl_newlevel_type(DL); if (nl) *nl = t; - if (fillout) out_html("<P>\n"); else { + if (fillout) out_html("<p>\n"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -2470,7 +2470,7 @@ scan_request(char *c) { case V('E','l'): /* BSD mandoc */ c=c+j; dl_endlevel_type(); - if (fillout) out_html("<P>\n"); else { + if (fillout) out_html("<p>\n"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -2480,7 +2480,7 @@ scan_request(char *c) { case V('I','t'): /* BSD mandoc */ c=c+j; if (dl_type(DL)) { - out_html("<DT>"); + out_html("<dt>"); out_html(change_to_font('B')); if (*c == '\n') { /* Don't allow embedded comms after a newline */ @@ -2495,9 +2495,9 @@ scan_request(char *c) { if (inXo) still_dd = 1; else - out_html("<DD>"); + out_html("<dd>"); } else if (dl_type(UL) || dl_type(OL)) { - out_html("<LI>"); + out_html("<li>"); c=scan_troff_mandoc(c,1,NULL); out_html(NEWLINE); } @@ -2512,7 +2512,7 @@ scan_request(char *c) { c=c+j; if (inXo) { if (still_dd) - out_html("<DD>"); + out_html("<dd>"); inXo = 0; } break; @@ -2547,12 +2547,12 @@ scan_request(char *c) { case V('D','l'): /* BSD mandoc */ c=c+j; out_html(NEWLINE); - out_html("<BLOCKQUOTE>"); + out_html("<blockquote>"); out_html(change_to_font('L')); if (*c == '\n') c++; c=scan_troff_mandoc(c, 1, NULL); out_html(change_to_font('R')); - out_html("</BLOCKQUOTE>"); + out_html("</blockquote>"); if (fillout) curpos++; else curpos=0; break; case V('B','d'): /* BSD mandoc */ @@ -2568,14 +2568,14 @@ scan_request(char *c) { mandoc_bd_options = 0; /* Remember options for terminating Bl */ if (strstr(c, "-offset indent")) { mandoc_bd_options |= BD_INDENT; - out_html("<BLOCKQUOTE>\n"); + out_html("<blockquote>\n"); } if (strstr(c, "-literal") || strstr(c, "-unfilled")) { if (fillout) { mandoc_bd_options |= BD_LITERAL; out_html(change_to_font(0)); out_html(change_to_size('0')); - out_html("<PRE>\n"); + out_html("<pre>\n"); } curpos=0; fillout=0; @@ -2590,18 +2590,18 @@ scan_request(char *c) { if (!fillout) { out_html(change_to_font(0)); out_html(change_to_size('0')); - out_html("</PRE>\n"); + out_html("</pre>\n"); } } if (mandoc_bd_options & BD_INDENT) - out_html("</BLOCKQUOTE>\n"); + out_html("</blockquote>\n"); curpos=0; fillout=1; c=skip_till_newline(c); break; case V('B','e'): /* BSD mandoc */ c=c+j; - if (fillout) out_html("<P>"); else { + if (fillout) out_html("<p>"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -2668,7 +2668,7 @@ scan_request(char *c) { if (fillout) curpos++; else curpos=0; break; case V('P','p'): /* BSD mandoc */ - if (fillout) out_html("<P>\n"); else { + if (fillout) out_html("<p>\n"); else { out_html(NEWLINE); NEWLINE[0]='\n'; } @@ -2808,7 +2808,7 @@ scan_request(char *c) { */ static int count = 0; /* Don't break on the first Nm */ if (count) { - out_html("<BR>"); + out_html("<br>"); } else { char *end, t=0 /* just for gcc */; end = strchr(c, '\n'); @@ -3035,7 +3035,7 @@ scan_troff(char *c, int san, char **result) { /* san : stop at newline */ if (h[-1] == '\n' && still_dd && isalnum(*h)) { /* sometimes a .HP request is not followed by a .br request */ FLUSHIBP; - out_html("<DD>"); + out_html("<dd>"); curpos=0; still_dd=0; } @@ -3074,13 +3074,13 @@ scan_troff(char *c, int san, char **result) { /* san : stop at newline */ case '\n': if (h[-1] == '\n' && fillout) { intbuff[ibp++]='<'; - intbuff[ibp++]='P'; + intbuff[ibp++]='p'; intbuff[ibp++]='>'; } if (contained_tab && fillout) { intbuff[ibp++]='<'; - intbuff[ibp++]='B'; - intbuff[ibp++]='R'; + intbuff[ibp++]='b'; + intbuff[ibp++]='r'; intbuff[ibp++]='>'; } contained_tab=0; @@ -3106,12 +3106,12 @@ scan_troff(char *c, int san, char **result) { /* san : stop at newline */ curpos++; } } else { - out_html("<TT>"); + out_html("<tt>"); while (curpos < tabstops[curtab]) { out_html(" "); curpos++; } - out_html("</TT>"); + out_html("</tt>"); } } } @@ -3120,7 +3120,7 @@ scan_troff(char *c, int san, char **result) { /* san : stop at newline */ if (*h == ' ' && (h[-1] == '\n' || usenbsp)) { FLUSHIBP; if (!usenbsp && fillout) { - out_html("<BR>"); + out_html("<br>"); curpos=0; } usenbsp=fillout; @@ -3192,12 +3192,12 @@ static void error_page(char *s, char *t, ...) { va_list p; - printf("<HTML><HEAD><TITLE>%s</TITLE></HEAD>\n" - "<BODY>\n<H1>%s</H1>\n", s, s); + printf("<html><head><title>%s</title></head>\n" + "<body>\n<h1>%s</h1>\n", s, s); va_start(p, t); vfprintf(stdout, t, p); va_end(p); - printf("</BODY></HTML>\n"); + printf("</body></html>\n"); abort(); } @@ -3394,20 +3394,20 @@ main(int argc, char **argv) { out_html(change_to_size(0)); if (!fillout) { fillout=1; - out_html("</PRE>"); + out_html("</pre>"); } out_html(NEWLINE); if (output_possible) { /* for mosaic users */ - printf("<HR>\n<A NAME=\"index\"> </A><H2>Index</H2>\n<DL>\n"); + printf("<hr>\n<a name=\"index\"> </a><h2>Index</h2>\n<dl>\n"); if (manidx) { manidx[mip]=0; printf("%s", manidx); } - while (subs--) printf("</DL>\n"); - printf("</DL>\n"); + while (subs--) printf("</dl>\n"); + printf("</dl>\n"); print_sig(); - printf("</BODY>\n</HTML>\n"); + printf("</body>\n</html>\n"); } else { if (!filename) filename = fname; @@ -3416,7 +3416,7 @@ main(int argc, char **argv) { "The requested file %s is not a valid (unformatted) " "man page.\nIf the file is a formatted manpage, " "you could try to load the\n" - "<A HREF=\"file://localhost%s\">plain file</A>.\n", + "<a href=\"file://localhost%s\">plain file</a>.\n", filename, filename); else error_page("Invalid Manpage", |