]> git.saurik.com Git - wxWidgets.git/commitdiff
added CSS stylesheets support to tex2rtf
authorVáclav Slavík <vslavik@fastmail.fm>
Sat, 4 May 2002 10:50:48 +0000 (10:50 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sat, 4 May 2002 10:50:48 +0000 (10:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/tex2rtf/src/htmlutil.cpp
utils/tex2rtf/src/tex2any.cpp
utils/tex2rtf/src/tex2any.h
utils/tex2rtf/src/texutils.cpp

index 7e3a6b8d6d06fd3f04512823b8708d3b5b39f307..d690fc0ac6824a0179ce6b2a0555b704911a1bb7 100644 (file)
@@ -652,6 +652,24 @@ void OutputBodyStart(void)
   OutputFont();
 }
 
+void HTMLHead()
+{
+  TexOutput("<head>");
+  if (htmlStylesheet) {
+    TexOutput("<link rel=stylesheet type=\"text/css\" href=\"");
+    TexOutput(htmlStylesheet);
+    TexOutput("\">");
+  }
+};
+
+void HTMLHeadTo(FILE* f)
+{
+  if (htmlStylesheet)
+    fprintf(f,"<head><link rel=stylesheet type=\"text/css\" href=\"%s\">",htmlStylesheet);
+  else
+    fprintf(f,"<head>");
+}
+
 // Called on start/end of macro examination
 void HTMLOnMacro(int macroId, int no_args, bool start)
 {
@@ -682,7 +700,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
 
       SetCurrentOutput(Chapters);
 
-      TexOutput("<head><title>");
+      HTMLHead();
+      TexOutput("<title>");
       OutputCurrentSection(); // Repeat section header
       TexOutput("</title></head>\n");
       OutputBodyStart();
@@ -751,7 +770,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
       if (htmlWorkshopFiles) HTMLWorkshopAddToContents(1, topicName, SectionsName);
 
       SetCurrentOutput(Sections);
-      TexOutput("<head><title>");
+      HTMLHead();
+      TexOutput("<title>");
       OutputCurrentSection();
       TexOutput("</title></head>\n");
       OutputBodyStart();
@@ -844,7 +864,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName);
             SetCurrentOutput(Subsections);
 
-            TexOutput("<head><title>");
+           HTMLHead();
+            TexOutput("<title>");
             OutputCurrentSection();
             TexOutput("</title></head>\n");
             OutputBodyStart();
@@ -924,7 +945,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);
 
             SetCurrentOutput(Subsubsections);
-            TexOutput("<head><title>");
+           HTMLHead();
+            TexOutput("<title>");
             OutputCurrentSection();
             TexOutput("</title></head>\n");
             OutputBodyStart();
@@ -2690,7 +2712,8 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
       else
         sprintf(titleBuf, "%s_contents.html", FileNameFromPath(FileRoot));
 
-      TexOutput("<head><title>");
+      HTMLHead();
+      TexOutput("<title>");
       TexOutput(ReferencesNameString);
       TexOutput("</title></head>\n");
       OutputBodyStart();
@@ -2968,17 +2991,19 @@ bool HTMLGo(void)
       if (DocumentTitle)
       {
         SetCurrentOutput(tmpTitle);
-        TexOutput("\n<HTML>\n<HEAD><TITLE>");
+       HTMLHead();
+        TexOutput("\n<HEAD><TITLE>");
         TraverseChildrenFromChunk(DocumentTitle);
         TexOutput("</TITLE></HEAD>\n");
       }
       else
       {
         SetCurrentOutput(tmpTitle);
+       HTMLHeadTo(tmpTitle);
         if (contentsString)
-          fprintf(tmpTitle, "<HEAD><TITLE>%s</TITLE></HEAD>\n\n", contentsString);
+          fprintf(tmpTitle, "<TITLE>%s</TITLE></HEAD>\n\n", contentsString);
         else
-          fprintf(tmpTitle, "<HEAD><TITLE>%s</TITLE></HEAD>\n\n", FileNameFromPath(FileRoot));
+          fprintf(tmpTitle, "<TITLE>%s</TITLE></HEAD>\n\n", FileNameFromPath(FileRoot));
       }
 
       // Output frame information
@@ -3161,8 +3186,10 @@ void GenerateHTMLWorkshopFiles(char *fname)
 
   fprintf(f,
       "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
-      "<HTML>\n"
-      "<HEAD>\n"
+      "<HTML>\n");
+  HTMLHeadTo(f);
+  fprintf(f,
+      "\n"
       "<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
       "<!-- Sitemap 1.0 -->\n"
       "</HEAD><BODY>\n"
@@ -3237,8 +3264,10 @@ void HTMLWorkshopStartContents()
 
   fprintf(HTMLWorkshopContents,
       "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
-      "<HTML>\n"
-      "<HEAD>\n"
+      "<HTML>\n");
+  HTMLHeadTo(HTMLWorkshopContents);
+  fprintf(HTMLWorkshopContents,
+      "\n"
       "<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
       "<!-- Sitemap 1.0 -->\n"
       "</HEAD><BODY>\n"
index 51fdab5dbd83f42ad87f553f6593413429ed52bd..bfeecc2ebdab13249b68f20373b80115eca084d3 100644 (file)
@@ -129,6 +129,7 @@ int             winHelpVersion = 3; // WinHelp Version (3 for Windows 3.1, 4 for
 bool            winHelpContents = FALSE; // Generate .cnt file for WinHelp 4
 bool            htmlIndex = FALSE; // Generate .htx file for HTML
 bool            htmlFrameContents = FALSE; // Use frames for HTML contents page
+char           *htmlStylesheet = NULL; // Use this CSS stylesheet for HTML pages
 bool            useHeadingStyles = TRUE; // Insert \s1, s2 etc.
 bool            useWord = TRUE; // Insert proper Word table of contents, etc etc
 int             contentsDepth = 4; // Depth of Word table of contents
index 5280483dd39899c55cbdc10ee5576dad85c83967..236ee2c82fae7c884f7340db0bdbfaa9072fc1cb 100644 (file)
@@ -240,6 +240,7 @@ extern int  winHelpVersion;    // Version e.g. 4 for Win95
 extern bool winHelpContents;   // Generate .cnt file
 extern bool htmlIndex;         // Generate .htx HTML index file
 extern bool htmlFrameContents; // Use frames for HTML contents page
+extern char *htmlStylesheet;   // Use this CSS stylesheet for HTML pages
 extern int  contentsDepth;     // Depth of contents for linear RTF files
 extern bool upperCaseNames;    // Filenames; default is lower case
 extern char *backgroundImageString; // HTML background image
index 3f58c461382ba08203a43783bc37e17f6553cc9b..01155959363044663c8f7ec807b851608cab19cf 100644 (file)
@@ -1182,6 +1182,11 @@ char *RegisterSetting(char *settingName, char *settingValue, bool interactive)
     htmlWorkshopFiles = StringTobool(settingValue);
   else if (StringMatch(settingName, "htmlFrameContents", FALSE, TRUE))
     htmlFrameContents = StringTobool(settingValue);
+  else if (StringMatch(settingName, "htmlStylesheet", FALSE, TRUE))
+    {
+      if (htmlStylesheet) delete[] htmlStylesheet;
+      htmlStylesheet = copystring(settingValue);
+    }
   else if (StringMatch(settingName, "upperCaseNames", FALSE, TRUE))
     upperCaseNames = StringTobool(settingValue);
   else if (StringMatch(settingName, "ignoreBadRefs", FALSE, TRUE))