changeset 469:e562d455cbbe

Fixed latex regressions, added html file lists.
author Jari-Matti M?kel? <jmjm@iki.fi>
date Wed, 31 Oct 2007 21:42:33 +0200
parents 7f7b2232a9eb
children e48a011e687a
files trunk/src/docgen/config/default.cfg trunk/src/docgen/document/htmlgenerator.d trunk/src/docgen/document/latexgenerator.d trunk/src/docgen/misc/textutils.d trunk/src/docgen/page/htmlwriter.d trunk/src/docgen/templates/default/html/listing.tpl trunk/src/docgen/templates/default/latex/langdef.tpl trunk/src/docgen/templates/default/latex/static/lstlang0.sty
diffstat 8 files changed, 47 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/trunk/src/docgen/config/default.cfg	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/config/default.cfg	Wed Oct 31 21:42:33 2007 +0200
@@ -22,7 +22,7 @@
   (templates
     (title "Test project")
     (versionString 1.0)
-    (copyright "(C) Me!")
+    (copyright "Crashtest dummy")
     (paperSize a4paper)
     (shortFileNames false)
     (templateStyle default)
--- a/trunk/src/docgen/document/htmlgenerator.d	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/document/htmlgenerator.d	Wed Oct 31 21:42:33 2007 +0200
@@ -98,6 +98,17 @@
   void generateListings() {
     writeSimpleFile(docFileNames[4], {
       docWriter.generateListingSection(modules);
+
+      char[][] contents;
+
+      foreach(mod; modules) {
+        auto FQN = mod.moduleFQN;
+        auto dstFname = replace(mod.moduleFQN.dup, '.', '_') ~ ".html";
+        contents ~= `<a href="` ~ dstFname ~ `">` ~ FQN ~ "</a>";
+      }
+
+      docWriter.addList(contents, false);
+
       docWriter.generateCustomPage("pagetemplate2", docgen_version);
     });
 
--- a/trunk/src/docgen/document/latexgenerator.d	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/document/latexgenerator.d	Wed Oct 31 21:42:33 2007 +0200
@@ -20,7 +20,6 @@
   auto depGraphFile = "depgraph.dot";
   auto listingFile = "files.tex";
   auto modulesFile = "modules.tex";
-  auto langDefFile = "lstlang0.sty";
 
   public:
 
@@ -45,7 +44,6 @@
     generateClasses();
     generateModules();
     generateDependencies();
-    generateLangDef();
     generateMakeFile(docFileName, "pdf");
   }
 
@@ -71,13 +69,6 @@
   }
 
   /**
-   * Generates D language definition file.
-   */
-  void generateLangDef() {
-    writeSimpleFile(langDefFile, { docWriter.generateCustomPage("langdef"); });
-  }
-
-  /**
    * Generates documentation for classes.
    */
   void generateClasses() {
--- a/trunk/src/docgen/misc/textutils.d	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/misc/textutils.d	Wed Oct 31 21:42:33 2007 +0200
@@ -9,6 +9,7 @@
 {
   char[] result;
   result.length = text.length;
+  result.length = 0;
   foreach(c; text)
     switch(c)
     {
--- a/trunk/src/docgen/page/htmlwriter.d	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/page/htmlwriter.d	Wed Oct 31 21:42:33 2007 +0200
@@ -10,8 +10,6 @@
 import tango.text.convert.Sprint;
 import tango.io.FilePath;
 
-// TODO: this is mostly broken now
-
 /**
  * Writes a HTML document skeleton.
  */
@@ -76,8 +74,8 @@
     auto content = super.getTemplate(name);
 
     foreach(pageName; [
-      "firstpage"[], "toc"[], "classes"[], "modules"[], "listings"[],
-      "dependencies"[], "lastpage"[] ]) {
+      "firstpage"[], "toc"[], "classes"[], "modules"[], "listing"[],
+      "listings"[], "dependencies"[], "lastpage"[] ]) {
       if (name == pageName) {
         auto sprint = new Sprint!(char)(5120);
         char[] title = factory.options.templates.title ~ " ";
@@ -86,6 +84,7 @@
           case "toc": title ~= "TOC"; break;
           case "classes": title ~= "Class index"; break;
           case "modules": title ~= "Module index"; break;
+          case "listing": title ~= "File contents"; break;
           case "listings": title ~= "File index"; break;
           case "dependencies": title ~="Dependencies"; break;
         }
@@ -103,11 +102,17 @@
       switch(item) {
         case "(": print(ordered ? "<ol>" : "<ul>"); continue;
         case ")": print(ordered ? "</ol>" : "</ul>"); continue;
-        default: print("<li>")(xml_escape(item))("</li>");
+        default: print("<li>")(item)("</li>");
       }
     }
   }
 
+  override void addListing(char[] moduleName, char[] contents, bool inline) {
+    print.format(getTemplate("listing"), moduleName, contents);
+
+    footer();
+  }
+
   protected:
 
   /**
--- a/trunk/src/docgen/templates/default/html/listing.tpl	Wed Oct 31 20:15:16 2007 +0200
+++ b/trunk/src/docgen/templates/default/html/listing.tpl	Wed Oct 31 21:42:33 2007 +0200
@@ -1,1 +1,2 @@
-<pre style="dcode">{}</pre>
+<h1>{0} Contents</h1>
+<pre style="dcode">{1}</pre>
--- a/trunk/src/docgen/templates/default/latex/langdef.tpl	Wed Oct 31 20:15:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-%%
-%% D definition (c) 2007 Jari-Matti Mäkelä
-%%
-\lst@definelanguage{D}%
-  {morekeywords={abstract,alias,align,asm,assert,auto,body,bool,break,%
-      byte,case,cast,catch,cdouble,cent,cfloat,char,class,const,continue,%
-      creal,dchar,debug,default,delegate,delete,deprecated,do,double,%
-      else,enum,export,extern,false,final,finally,float,for,foreach,%
-      foreach_reverse,function,goto,idouble,if,ifloat,import,in,inout,%
-      int,interface,invariant,ireal,is,lazy,long,macro,mixin,module,new,%
-      null,out,override,package,pragma,private,protected,public,real,ref,%
-      return,scope,short,static,struct,super,switch,synchronized,template,%
-      this,throw,true,try,typedef,typeid,typeof,ubyte,ucent,uint,ulong,%
-      union,unittest,ushort,version,void,volatile,wchar,while,with},%
-   sensitive,%
-
-   morecomment=[s]{/*}{*/},%
-   morecomment=[n]{/+}{+/},%
-   morecomment=[l]//,%
-   morestring=[b]",%
-   morestring=[b]`%
-  }[keywords,comments,strings]%
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/trunk/src/docgen/templates/default/latex/static/lstlang0.sty	Wed Oct 31 21:42:33 2007 +0200
@@ -0,0 +1,22 @@
+%%
+%% D definition (c) 2007 Jari-Matti Mäkelä
+%%
+\lst@definelanguage{D}%
+  {morekeywords={abstract,alias,align,asm,assert,auto,body,bool,break,%
+      byte,case,cast,catch,cdouble,cent,cfloat,char,class,const,continue,%
+      creal,dchar,debug,default,delegate,delete,deprecated,do,double,%
+      else,enum,export,extern,false,final,finally,float,for,foreach,%
+      foreach_reverse,function,goto,idouble,if,ifloat,import,in,inout,%
+      int,interface,invariant,ireal,is,lazy,long,macro,mixin,module,new,%
+      null,out,override,package,pragma,private,protected,public,real,ref,%
+      return,scope,short,static,struct,super,switch,synchronized,template,%
+      this,throw,true,try,typedef,typeid,typeof,ubyte,ucent,uint,ulong,%
+      union,unittest,ushort,version,void,volatile,wchar,while,with},%
+   sensitive,%
+
+   morecomment=[s]{/*}{*/},%
+   morecomment=[n]{/+}{+/},%
+   morecomment=[l]//,%
+   morestring=[b]",%
+   morestring=[b]`%
+  }[keywords,comments,strings]%