Re: [AD] chapters for devhelp documentation

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Mon, 2004-09-20 at 13:05 +0200, Elias Pschernig wrote:
> They seem all ok, but I had to make the same change to devhelp (yes,
> really should have checked better before). While I was at it, I made the
> attached patch which also uses the @chapter commands in the html TOC. If
> nobody thinks the html TOC looks bad with it, I'll apply it.
> 

And another one which uses @chapter in the CHM navigation, making it
easier to navigate, just like devhelp. (I guess I just broke the record
of the most replies to myself :)

-- 
Elias Pschernig
Index: docs/src/makedoc/makechm.c
===================================================================
RCS file: /cvsroot/alleg/allegro/docs/src/makedoc/makechm.c,v
retrieving revision 1.9
diff -u -r1.9 makechm.c
--- docs/src/makedoc/makechm.c	9 Jun 2003 10:58:49 -0000	1.9
+++ docs/src/makedoc/makechm.c	20 Sep 2004 21:31:41 -0000
@@ -68,6 +68,7 @@
    TOC *toc;
    int btoc_prev[TOC_SIZE];
    int section_number = -1, prev = 0, num_btoc = 0;
+   int in_chapter = 0;
    
    if (!file)
       return 1;
@@ -141,6 +142,29 @@
 	       _write_object(file, ALT_TEXT(toc), name);
 	 }
       }
+      else if ((toc->root == 2 || toc->root == 3) && !is_index) {
+         _output_btoc(file, btoc, btoc_prev, &num_btoc);
+	 if (prev == PREV_SUB)
+	    fprintf(file, "</li></ul></li>\n");
+         if (prev == PREV_ROOT)
+	    fprintf(file, "</li>\n");
+         if (in_chapter) {
+            fprintf(file, "</ul>\n");
+            in_chapter = 0;
+         }
+         if (toc->root == 2) {
+            fprintf(file, "<li><object type=\"text/sitemap\">\n");
+            fprintf(file, "<param name=\"Name\" value=\"%s\">\n", ALT_TEXT(toc));
+            fprintf(file, "</object>\n</li>\n");
+            fprintf(file, "<ul>\n");
+            in_chapter = 1;
+         }
+         prev = 0;
+      }
+   }
+
+   if (in_chapter) {
+      fprintf(file, "</ul>\n");
    }
 
    _output_btoc(file, btoc, btoc_prev, &num_btoc);
@@ -290,7 +314,7 @@
    FILE *file;
    int found_signature = 0;
    char *temp;
-   
+
    if (!strcmp(get_extension(filename), "htm"))
       html_extension = "html";
 
@@ -300,7 +324,23 @@
       printf("HTML files and put @multiplefiles in allegro._tx.\n\n");
       return 1;
    }
-      
+
+   temp = m_replace_extension(filename, "hhp");
+   printf("writing '%s'\n", temp);
+   if (_write_hhp(temp))
+      return 1;
+   free(temp);
+
+   temp = m_replace_extension(filename, "hhc");
+   printf("writing '%s'\n", temp);
+   _write_toc(temp, 0);
+   free(temp);
+
+   temp = m_replace_extension(filename, "hhk");
+   printf("writing '%s'\n", temp);
+   _write_toc(temp, 1);
+   free(temp);
+
    system("hhc.exe > tempfile");
    file = fopen("tempfile", "r");
    if (file) {
@@ -312,7 +352,7 @@
 	 found_signature++;
    }
    remove("tempfile");
-   
+
    if (!found_signature) {
       printf("\nCannot find the HTML Help Compiler necessary to generate .chm output.\n");
       printf("You can try to obtain it from Microsoft:\n");
@@ -320,22 +360,6 @@
       return 1;
    }
 
-   temp = m_replace_extension(filename, "hhp");
-   printf("writing '%s'\n", temp);
-   if (_write_hhp(temp))
-      return 1;
-   free(temp);
-   
-   temp = m_replace_extension(filename, "hhc");
-   printf("writing '%s'\n", temp);
-   _write_toc(temp, 0);
-   free(temp);
-
-   temp = m_replace_extension(filename, "hhk");
-   printf("writing '%s'\n", temp);
-   _write_toc(temp, 1);
-   free(temp);
-
    return 0;
 }
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/