]> Shamusworld >> Repos - ardour-manual-diverged/commitdiff
Added automagically generated Table of Contents.
authorShamus Hammons <jlhamm@acm.org>
Tue, 10 Jan 2017 23:02:05 +0000 (17:02 -0600)
committerShamus Hammons <jlhamm@acm.org>
Tue, 10 Jan 2017 23:02:05 +0000 (17:02 -0600)
munge
munge.cpp
source/css/app.css
source/index.html

diff --git a/munge b/munge
index 1d4393115dddb73099990780e6a12aab3a81ff9b..3a9d3f504f0c42b9fdb801d392ae4d28d9c49eb6 100755 (executable)
Binary files a/munge and b/munge differ
index 81bc38d2cf2ffa00aef7cc289d346d4a799680cf..e8c095d10dbc2dea323101dd4ffccc962d497933 100644 (file)
--- a/munge.cpp
+++ b/munge.cpp
@@ -11,7 +11,6 @@
 #include <string.h>
 #include <sys/stat.h>          // For mkdir()
 #include <sys/types.h>
-//#include <unistd.h>
 
 
 void MakeFilename(char * fn)
@@ -26,6 +25,8 @@ void MakeFilename(char * fn)
                        fn[i] |= 0x20;
                else if (fn[i] >= 'a' && fn[i] <= 'z')
                        ;
+               else if (fn[i] >= '0' && fn[i] <= '9')
+                       ;
                else
                        fn[i] = '_';
        }
@@ -40,13 +41,22 @@ int main(int argc, char * argv[])
 
        if (master == NULL)
        {
-               printf("Could not open master doc file!\n");
+               printf("Could not open master doc (master-doc.txt) file!\n");
+               return -1;
+       }
+
+       FILE * toc = fopen("_manual/00_toc.html", "w");
+
+       if (toc == NULL)
+       {
+               printf("Could not open TOC file!\n");
+               fclose(master);
                return -1;
        }
 
-       // Remove contents of _manual before writing into it...
-//     remove("./_manual/*.html");
-//     return 0;
+       fprintf(toc, "---\n");
+       fprintf(toc, "title: Ardour Table of Contents\n");
+       fprintf(toc, "---\n\n");
 
        char buffer[1024000], keyword[1024], token[1024];
        char title[1024], shortTitle[1024], inclFile[1024], style[1024];
@@ -56,6 +66,7 @@ int main(int argc, char * argv[])
        bool first = true;
        FILE * newFile = NULL;
        char level1File[1024], level2File[1024], level3File[1024], temp[1024];
+       char partFN[1024], chapterFN[1024], scLink[4096];
 
        while (!feof(master))
        {
@@ -73,7 +84,7 @@ int main(int argc, char * argv[])
                                printf(" (%d lines)\n", sectionLineCount);
                        }
 
-                       // Reset the "short" title
+                       // Reset the "short" title, include file & sytle
                        shortTitle[0] = 0;
                        inclFile[0] = 0;
                        style[0] = 0;
@@ -123,9 +134,6 @@ int main(int argc, char * argv[])
                                {
                                        // We hit the end of our keyword block, now do something
                                        // about it... :-P
-//                                     for(int i=0; i<level; i++)
-//                                             printf("\t");
-
                                        if (level == 0)
                                                printf("\nPart %s: ", roman[part]);
                                        else if (level == 1)
@@ -147,6 +155,11 @@ int main(int argc, char * argv[])
                                                MakeFilename(temp);
                                                sprintf(level1File, "_manual/%02d_%s", part, temp);
                                                mkdir(level1File, 0777);
+
+                                               // Set up the "part" level of TOC link
+                                               sprintf(partFN, "%s", temp);
+                                               fprintf(toc, "<h2>Part %s: %s</h2>\n", roman[part], title);
+
                                                // Make the file expected at this level...
                                                sprintf(temp, "%s.html", level1File);
                                                FILE * tfp = fopen(temp, "w");
@@ -166,6 +179,11 @@ int main(int argc, char * argv[])
                                                MakeFilename(temp);
                                                sprintf(level2File, "%s/%02d_%s", level1File, chapter, temp);
                                                mkdir(level2File, 0777);
+
+                                               // Set up the "chapter" part of the TOC link
+                                               sprintf(chapterFN, "%s", temp);
+                                               fprintf(toc, "  <p id=chapter>Ch. %d:&nbsp;&nbsp;<a href=\"/%s/%s/\">%s</a></p>\n", chapter, partFN, chapterFN, title);
+
                                                // Make the file expected at this level...
                                                sprintf(temp, "%s.html", level2File);
                                                FILE * tfp = fopen(temp, "w");
@@ -189,6 +207,10 @@ int main(int argc, char * argv[])
                                                if (newFile != NULL)
                                                        fclose(newFile);
 
+                                               // Make the link
+                                               sprintf(scLink, "/%s/%s/%s/", partFN, chapterFN, temp);
+                                               fprintf(toc, "    <a id=subchapter href=\"%s\">%s</a><br />\n", scLink, title);
+
                                                if (strlen(inclFile) > 0)
                                                {
                                                        // Copy the include file to the appropriate spot...
@@ -229,13 +251,14 @@ int main(int argc, char * argv[])
                else
                {
                        if ((level == 2) && (newFile != NULL))
-                               fprintf(newFile, "%s\n", buffer);//*/
+                               fprintf(newFile, "%s\n", buffer);
                }
        }
 
        printf("\n\nProcessed %i lines.\n", lineCount);
 
        fclose(master);
+       fclose(toc);
 
        if (newFile)
                fclose(newFile);
index 114abf35daafe42d1f6b63d32eddf7c64cbfa21f..6fa18f96271eb4b8b9585861c3080b0ee6b436db 100644 (file)
@@ -322,7 +322,20 @@ kbd.mouse {
 }
 */
 
-kbd.menu,kbd.option,kbd.optoff {
+kbd.optoff, kbd.option {
+    border:none;
+    background-color:transparent;  
+}
+
+kbd.optoff:after {
+    content:url('/images/checkbox-unchecked.png');  
+}
+
+kbd.option:after {
+    content:url('/images/checkbox-checked.png');
+}
+
+kbd.menu {
     border:none;
     background-color:transparent;
     font-weight:bold;
@@ -330,22 +343,10 @@ kbd.menu,kbd.option,kbd.optoff {
     white-space:normal;
 }
 
-kbd.option:after,kbd.optoff:after {
-    font-family:mono;
-    font-weight:lighter;
-    text-align:center;
-    border:solid 1px black;
-    margin-left:0.3em;
-}
-kbd.option:after {
-    content:'X';
 
-}
 kbd.osc {
 }
-kbd.optoff:after {
-    content:'    ';
-}
+
 
 
 kbd.fader, kbd.knob, kbd.button {
@@ -534,5 +535,7 @@ samp:after {
   }
 }
 
+#chapter { padding-top: 1em; padding-left: 1em; }
 
+#subchapter { padding-left: 4em; }
 
index d961baa3ccfc7c21b36593b1a99c3415a2053c4a..5778a1290be59b05516c9bfce6d9af29feb2377e 100644 (file)
@@ -1,6 +1,6 @@
 <html>
 <head>
-<meta http-equiv="refresh" content="0; url=/introduction-to-ardour/"/>
+<meta http-equiv="refresh" content="0; url=/toc/"/>
 </head>
 <body>
 </body>