From: Václav Slavík Date: Sat, 4 May 2002 10:50:48 +0000 (+0000) Subject: added CSS stylesheets support to tex2rtf X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6d8b260cc3c78b8b5923c71f3a9a36e5169c445c added CSS stylesheets support to tex2rtf git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp index 7e3a6b8d6d..d690fc0ac6 100644 --- a/utils/tex2rtf/src/htmlutil.cpp +++ b/utils/tex2rtf/src/htmlutil.cpp @@ -652,6 +652,24 @@ void OutputBodyStart(void) OutputFont(); } +void HTMLHead() +{ + TexOutput(""); + if (htmlStylesheet) { + TexOutput(""); + } +}; + +void HTMLHeadTo(FILE* f) +{ + if (htmlStylesheet) + fprintf(f,"",htmlStylesheet); + else + fprintf(f,""); +} + // 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(""); + HTMLHead(); + TexOutput("<title>"); OutputCurrentSection(); // Repeat section header TexOutput("\n"); OutputBodyStart(); @@ -751,7 +770,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) if (htmlWorkshopFiles) HTMLWorkshopAddToContents(1, topicName, SectionsName); SetCurrentOutput(Sections); - TexOutput(""); + HTMLHead(); + TexOutput("<title>"); OutputCurrentSection(); TexOutput("\n"); OutputBodyStart(); @@ -844,7 +864,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName); SetCurrentOutput(Subsections); - TexOutput(""); + HTMLHead(); + TexOutput("<title>"); OutputCurrentSection(); TexOutput("\n"); OutputBodyStart(); @@ -924,7 +945,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName); SetCurrentOutput(Subsubsections); - TexOutput(""); + HTMLHead(); + TexOutput("<title>"); OutputCurrentSection(); TexOutput("\n"); OutputBodyStart(); @@ -2690,7 +2712,8 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) else sprintf(titleBuf, "%s_contents.html", FileNameFromPath(FileRoot)); - TexOutput(""); + HTMLHead(); + TexOutput("<title>"); TexOutput(ReferencesNameString); TexOutput("\n"); OutputBodyStart(); @@ -2968,17 +2991,19 @@ bool HTMLGo(void) if (DocumentTitle) { SetCurrentOutput(tmpTitle); - TexOutput("\n\n"); + HTMLHead(); + TexOutput("\n<HEAD><TITLE>"); TraverseChildrenFromChunk(DocumentTitle); TexOutput("\n"); } else { SetCurrentOutput(tmpTitle); + HTMLHeadTo(tmpTitle); if (contentsString) - fprintf(tmpTitle, "%s\n\n", contentsString); + fprintf(tmpTitle, "%s\n\n", contentsString); else - fprintf(tmpTitle, "%s\n\n", FileNameFromPath(FileRoot)); + fprintf(tmpTitle, "%s\n\n", FileNameFromPath(FileRoot)); } // Output frame information @@ -3161,8 +3186,10 @@ void GenerateHTMLWorkshopFiles(char *fname) fprintf(f, "\n" - "\n" - "\n" + "\n"); + HTMLHeadTo(f); + fprintf(f, + "\n" "\n" "\n" "\n" @@ -3237,8 +3264,10 @@ void HTMLWorkshopStartContents() fprintf(HTMLWorkshopContents, "\n" - "\n" - "\n" + "\n"); + HTMLHeadTo(HTMLWorkshopContents); + fprintf(HTMLWorkshopContents, + "\n" "\n" "\n" "\n" diff --git a/utils/tex2rtf/src/tex2any.cpp b/utils/tex2rtf/src/tex2any.cpp index 51fdab5dbd..bfeecc2ebd 100644 --- a/utils/tex2rtf/src/tex2any.cpp +++ b/utils/tex2rtf/src/tex2any.cpp @@ -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 diff --git a/utils/tex2rtf/src/tex2any.h b/utils/tex2rtf/src/tex2any.h index 5280483dd3..236ee2c82f 100644 --- a/utils/tex2rtf/src/tex2any.h +++ b/utils/tex2rtf/src/tex2any.h @@ -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 diff --git a/utils/tex2rtf/src/texutils.cpp b/utils/tex2rtf/src/texutils.cpp index 3f58c46138..0115595936 100644 --- a/utils/tex2rtf/src/texutils.cpp +++ b/utils/tex2rtf/src/texutils.cpp @@ -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))