X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c103ca4b4d594119a4209e095beb597156ab52e4..eefc691533295ee9ffbdb166c5684bdc361b53da:/utils/tex2rtf/src/htmlutil.cpp?ds=sidebyside diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp index f95065016d..ea8b6efc2e 100644 --- a/utils/tex2rtf/src/htmlutil.cpp +++ b/utils/tex2rtf/src/htmlutil.cpp @@ -181,7 +181,7 @@ void ReopenFile(FILE **fd, char **fileName) { if (*fd) { - fprintf(*fd, "\n\n"); + fprintf(*fd, "\n\n"); fclose(*fd); } fileId ++; @@ -583,6 +583,17 @@ char *ParseColourString(char *bkStr, bool *isPicture) else return NULL; } +void OutputFont(void) +{ + // Output + TexOutput("\n"); +} + // Output start of block void OutputBodyStart(void) { @@ -637,6 +648,26 @@ void OutputBodyStart(void) } } TexOutput(">\n"); + + 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 @@ -669,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(); @@ -707,8 +739,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) // Add this section title to the list of keywords if (htmlIndex) { - OutputCurrentSectionToString(wxBuffer); - AddKeyWordForTopic(topicName, wxBuffer, ConvertCase(currentFileName)); + OutputCurrentSectionToString(wxTex2RTFBuffer); + AddKeyWordForTopic(topicName, wxTex2RTFBuffer, ConvertCase(currentFileName)); } } break; @@ -738,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(); @@ -769,8 +802,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) // Add this section title to the list of keywords if (htmlIndex) { - OutputCurrentSectionToString(wxBuffer); - AddKeyWordForTopic(topicName, wxBuffer, currentFileName); + OutputCurrentSectionToString(wxTex2RTFBuffer); + AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName); } } break; @@ -831,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(); @@ -876,8 +910,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) // Add this section title to the list of keywords if (htmlIndex) { - OutputCurrentSectionToString(wxBuffer); - AddKeyWordForTopic(topicName, wxBuffer, currentFileName); + OutputCurrentSectionToString(wxTex2RTFBuffer); + AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName); } } @@ -911,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(); @@ -954,8 +989,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) // Add this section title to the list of keywords if (htmlIndex) { - OutputCurrentSectionToString(wxBuffer); - AddKeyWordForTopic(topicName, wxBuffer, currentFileName); + OutputCurrentSectionToString(wxTex2RTFBuffer); + AddKeyWordForTopic(topicName, wxTex2RTFBuffer, currentFileName); } } } @@ -1027,7 +1062,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start) if (inTabular) { // End cell, start cell - TexOutput(""); + + TexOutput(""); // Start new row and cell, setting alignment for the first cell. if (currentColumn < noColumns) @@ -1051,6 +1087,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start) else sprintf(buf, "\n"); TexOutput(buf); + OutputFont(); } else TexOutput("&"); @@ -1099,12 +1136,13 @@ void HTMLOnMacro(int macroId, int no_args, bool start) else sprintf(buf, "\n"); TexOutput(buf); + OutputFont(); } else { // End cell and row // Start new row and cell - TexOutput("\n\n"); + TexOutput("\n\n"); } break; } @@ -1906,7 +1944,11 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) { if (helpRefText) TraverseChildrenFromChunk(helpRefText); - TexOutput(" (REF NOT FOUND)"); + if (!ignoreBadRefs) + TexOutput(" (REF NOT FOUND)"); + wxString errBuf; + errBuf.Printf("Warning: unresolved reference '%s'", refName); + OnInform((char *)errBuf.c_str()); } } else TexOutput("??"); @@ -1984,7 +2026,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) { TexOutput(""); + TexOutput("\""); TexOutput(alignment); TexOutput(">"); delete[] inlineFilename; } } @@ -2090,6 +2132,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) descriptionItemArg = GetArgChunk(); return FALSE; } + return TRUE; } case ltTWOCOLITEM: case ltTWOCOLITEMRULED: @@ -2110,8 +2153,9 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) TexOutput(buf); } else TexOutput("\n\n"); + OutputFont(); } else - TexOutput("\n\n"); + TexOutput("\n\n"); } if (arg_no == 2) { @@ -2123,8 +2167,9 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) TexOutput(buf); } else TexOutput("\n\n"); + OutputFont(); } else - TexOutput("\n\n"); + TexOutput("\n\n"); } return TRUE; break; @@ -2626,6 +2671,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start) if (compatibilityMode) { TexOutput("\n"); + OutputFont(); /* for (int i = 0; i < noColumns; i++) { @@ -2666,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(); @@ -2905,25 +2952,25 @@ bool HTMLGo(void) if (Chapters) { - fprintf(Chapters, "\n\n"); + fprintf(Chapters, "\n\n"); fclose(Chapters); Chapters = NULL; } if (Sections) { - fprintf(Sections, "\n\n"); + fprintf(Sections, "\n\n"); fclose(Sections); Sections = NULL; } if (Subsections && !combineSubSections) { - fprintf(Subsections, "\n\n"); + fprintf(Subsections, "\n\n"); fclose(Subsections); Subsections = NULL; } if (Subsubsections && !combineSubSections) { - fprintf(Subsubsections, "\n\n"); + fprintf(Subsubsections, "\n\n"); fclose(Subsubsections); Subsubsections = NULL; } @@ -2944,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 @@ -2991,7 +3040,7 @@ bool HTMLGo(void) fclose(fd); } - fprintf(tmpTitle, "\n\n"); + fprintf(tmpTitle, "\n\n"); if (htmlFrameContents) { @@ -3137,8 +3186,10 @@ void GenerateHTMLWorkshopFiles(char *fname) fprintf(f, "\n" - "\n" - "\n" + "\n"); + HTMLHeadTo(f); + fprintf(f, + "\n" "\n" "\n" "\n" @@ -3213,8 +3264,10 @@ void HTMLWorkshopStartContents() fprintf(HTMLWorkshopContents, "\n" - "\n" - "\n" + "\n"); + HTMLHeadTo(HTMLWorkshopContents); + fprintf(HTMLWorkshopContents, + "\n" "\n" "\n" "\n"