Help browser HTML prettyifaction patch



Here's a patch that makes the HTML output from help-browser and gnome-man2html
prettier than it is. Basically all it does is set the background to white, adds
a hrule, and makes the index list at the end an ordered list and decapitalises
the index entries.

iain

diff -U2 -r /usr/local/src/tmp/gnome-core-1.1.8/help-browser/gnome-man2html/gnome-man2html.c help-browser/gnome-man2html/gnome-man2html.c
--- /usr/local/src/tmp/gnome-core-1.1.8/help-browser/gnome-man2html/gnome-man2html.c Thu Oct 21 06:43:06 1999
+++ help-browser/gnome-man2html/gnome-man2html.c        Fri Apr  7 14:35:26 2000
@@ -11,4 +11,7 @@
  * This version modified for GNOME - February 1998
  * Michael Fulbright <msf@redhat.com>
+ *
+ * Output made prettier - April 2000~~
+ * Iain Holmes  <ih@csd.abdn.ac.uk>
  */
 
@@ -1825,4 +1828,6 @@
 {
        char *c=NULL;
+       int i=1;
+
        label[3]++;
 
@@ -1833,8 +1838,8 @@
        if (level != subs) {
               if (subs) {
-                       strmaxcpy(manidx+mip, "</DL>\n", HUGE_STR_MAX - mip);
+                       strmaxcpy(manidx+mip, "</OL>\n", HUGE_STR_MAX - mip);
                        mip+=6;
                } else {
-                       strmaxcpy(manidx+mip, "<DL>\n", HUGE_STR_MAX - mip);
+                       strmaxcpy(manidx+mip, "<OL>\n", HUGE_STR_MAX - mip);
                        mip+=5;
                }
@@ -1842,5 +1847,10 @@
        subs=level;
        scan_troff(item, 1, &c);
-       sprintf(manidx+mip, "<DT><A HREF=\"%s#%s\">%s</A><DD>\n", 
+       while (c[i]) {
+         c[i] = tolower(c[i]);
+         i++;
+       }
+
+       sprintf(manidx+mip, "<LI><A HREF=\"%s#%s\">%s</A>\n", 
                ((URLbasename) ? URLbasename : ""), label, c);
        if (c)
@@ -2535,8 +2545,9 @@
                                                 "Manpage of ");
                                       out_html(wordlist[0]);
-                                       out_html("</TITLE>\n</HEAD><BODY>"
-                                                "\n<H1>");
+                                       out_html("</TITLE>\n</HEAD><BODY BGCOLOR=\"#FFFFFF\">"
+                                                
+                                                "\nName: <B>");
                                        out_html(wordlist[0]);
-                                       out_html("</H1>\nSection: ");
+                                       out_html("</B><BR>\nSection: ");
                                        if (words>4)
                                                out_html(wordlist[4]);
@@ -2546,19 +2557,25 @@
                                        out_html(" (");
                                        out_html(wordlist[1]);
+                                       out_html (")");
+#if 0
                                        if (words>2) {
                                                out_html(")<BR>Updated: ");
                                                scan_troff(wordlist[2], 
                                                           1, NULL);
-                                       } else out_html(")");
+                                       } else 
                                         out_html(")");
+
+#endif
 
-                                       out_html("\n");
+#if 0                                  
                                        printf("<BR><A HREF=\"");
                                        if (URLbasename)
                                            printf(URLbasename);
-                                        printf("#index\">Index</A>\n");
-#if 0                                  
+                                        printf("#index\">%s Table of Contents</A>\n",
+                                              wordlist[0]);
+#endif
+
                                        out_html("<BR><A HREF=\"");
-                                        out_html("#index\">Index</A>\n");
-#endif                                 
+                                        out_html("#index\">Table of Contents</A>\n");
                                        *sl='\n';
 #if 0
@@ -3646,5 +3663,5 @@
                        t++;
                printf("<HTML><HEAD><TITLE>Bad manpage.</TITLE>\n"
-                      "</HEAD><BODY>\n<H1>Bad manpage.</H1>\n"
+                      "</HEAD><BODY BGCOLOR=\"#FFFFFF\">\n<H1>Bad manpage.</H1>\n"
                       "Sorry, unable to convert the manpage.\n"
                       "</BODY></HTML>\n");
@@ -3695,16 +3712,16 @@
        if (output_possible) {
                /* &nbsp; for mosaic users */
-               fputs("<HR>\n<A NAME=\"index\">&nbsp;</A><H2>Index</H2>\n<DL>\n",
+               fputs("<HR>\n<A NAME=\"index\">&nbsp;</A><H2>Table of Contents</H2>\n<OL>\n",
                      stdout);
                manidx[mip]=0;
                fputs(manidx,stdout);
                if (subs) 
-                       fputs("</DL>\n", stdout);
-               fputs("</DL>\n", stdout);
+                       fputs("</OL>\n", stdout);
+               fputs("</OL>\n", stdout);
 /*             print_sig(); */
                fputs("</BODY>\n</HTML>\n", stdout);
        } else {
                printf("<HTML><HEAD><TITLE>Invalid Manpage</TITLE></HEAD>\n"
-                      "<BODY><H1>Invalid Manpage</H1>\n"
+                      "<BODY BGCOLOR=\"#FFFFFF\"><H1>Invalid Manpage</H1>\n"
                       "You tried to retrieve an incorrect manpage.\n"
                       "The page does not contain a manpage header and will\n"
@@ -3722,2 +3739,3 @@
        return 0;
 }
+
diff -U2 -r /usr/local/src/tmp/gnome-core-1.1.8/help-browser/toc2.c help-browser/toc2.c
--- /usr/local/src/tmp/gnome-core-1.1.8/help-browser/toc2.c     Sun Mar 19 16:30:32 2000
+++ help-browser/toc2.c Fri Apr  7 16:32:20 2000
@@ -113,5 +113,5 @@
     gint numcol, numrow;
 
-    res = g_string_new(_("<h1>Table of Contents</h1>\n"));
+    res = g_string_new(_("<BODY BGCOLOR=\"#FFFFFF\"><h1>Table of Contents</h1>\n"));
 
     /* Man Pages */
@@ -230,5 +230,5 @@
        g_string_append(res, "</tr>\n");
     }
-    g_string_append(res, "</table>\n");
+    g_string_append(res, "</table></body>\n");
     if (tablestart)
         g_string_free(tablestart, TRUE);
@@ -256,6 +256,6 @@
     gint numrow, numcol;
 
-    res = g_string_new(_("<h1>Table of Contents</h1>\n"));
-    g_string_append(res, _("<br><br><h2>Info Pages</h2>\n"));
+    res = g_string_new(_("<body bgcolor=\"#FFFFFF\"><h1>Table of Contents</h1>\n"));
+    g_string_append(res, _("<h2>Info Pages</h2>\n"));
 
     l = toc->infoTable;
@@ -298,5 +298,5 @@
        g_string_append(res, "</tr>\n");
     }
-    g_string_append(res, "</table>\n");
+    g_string_append(res, "</table></body>\n");
 #if 0
     if (1) {
@@ -320,6 +320,6 @@
     gint numcol, numrow;
 
-    res = g_string_new(_("<h1>Table of Contents</h1>\n"));
-    g_string_append(res, _("<br><br><h2>GNOME Help</h2>\n"));
+    res = g_string_new(_("<body bgcolor=\"#FFFFFF\"><h1>Table of Contents</h1>\n"));
+    g_string_append(res, _("<h2>GNOME Help</h2>\n"));
 
     l = toc->ghelpTable;
@@ -358,5 +358,5 @@
        g_string_append(res, "</tr>\n");
     }
-    g_string_append(res, "</table>\n");
+    g_string_append(res, "</table></body>\n");
 
     return res;
@@ -465,5 +465,5 @@
     gboolean foundman, foundinfo, foundghelp;
 
-    out = g_string_new(_("<HTML>\n<BODY>\n<H2>Results of the substring search "
+    out = g_string_new(_("<HTML>\n<BODY BGCOLOR=\"#ffffff\">\n<H2>Results of the substring search "
                       "for the string "));
     g_string_sprintfa(out, "&quot;%s&quot;</H2>\n", substr);





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]