X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b63b07a809f9a3d22596d4971ef5c8971153823a..15d83f726c215b06f2fdd15ece40d66d2f16a01d:/utils/tex2rtf/src/htmlutil.cpp?ds=inline
diff --git a/utils/tex2rtf/src/htmlutil.cpp b/utils/tex2rtf/src/htmlutil.cpp
index cc8187395f..5b357eda1a 100644
--- a/utils/tex2rtf/src/htmlutil.cpp
+++ b/utils/tex2rtf/src/htmlutil.cpp
@@ -874,6 +874,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
 
           if ( combineSubSections && !subsectionStarted )
           {
+            fflush(Sections);
+              
             // Read old .con file in at this point
             wxChar buf[256];
             wxStrcpy(buf, CurrentSectionFile);
@@ -910,7 +912,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName);
             SetCurrentOutput(Subsections);
 
-	    HTMLHead();
+            HTMLHead();
             TexOutput(_T("
"));
             OutputCurrentSection();
             TexOutput(_T("\n"));
@@ -991,7 +993,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
             if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);
 
             SetCurrentOutput(Subsubsections);
-	    HTMLHead();
+            HTMLHead();
             TexOutput(_T(""));
             OutputCurrentSection();
             TexOutput(_T("\n"));
@@ -1133,7 +1135,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
         else
           wxSnprintf(buf, sizeof(buf), _T("\n"));
         TexOutput(buf);
-		OutputFont();
+        OutputFont();
       }
       else
         TexOutput(_T("&"));
@@ -1182,7 +1184,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
       else
         wxSnprintf(buf, sizeof(buf), _T(" | \n| "));
       TexOutput(buf);
-	  OutputFont();
+      OutputFont();
     }
     else
     {
@@ -1649,6 +1651,11 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
   {
     if (start)
     {
+      // NB: if this is uncommented, the table of contents
+      // completely disappears. If left commented, it's in the wrong
+      // place.
+      //fflush(Titlepage);
+
       FILE *fd = wxFopen(ContentsName, _T("r"));
       if (fd)
       {
@@ -1659,6 +1666,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
           ch = getc(fd);
         }
         fclose(fd);
+        fflush(Titlepage);
       }
       else
       {
@@ -1971,15 +1979,15 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
             // If a filename is supplied, use it, otherwise try to
             // use the filename associated with the reference (from this document).
             if (helpRefFilename)
-	        {
+            {
               TraverseChildrenFromChunk(helpRefFilename);
               TexOutput(_T("#"));
-	        }
+            }
             else if (refFilename)
-	        {
+            {
               TexOutput(ConvertCase(refFilename));
               TexOutput(_T("#"));
-	        }
+            }
             TexOutput(refName);
             TexOutput(_T("\">"));
             if (helpRefText)
@@ -2059,7 +2067,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           // If we have found the existing filename, make the inline
           // image point to the original file (could be PS, for example)
           if (originalFilename && (wxStrcmp(inlineFilename, originalFilename) != 0))
-	  {
+          {
             TexOutput(_T(""));
@@ -2068,17 +2076,17 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
             TexOutput(_T("\""));
             TexOutput(alignment); 
             TexOutput(_T(">"));
-	  }
+          }
           else
 #endif
-	  {
+          {
             TexOutput(_T(" );) "));
             delete[] inlineFilename;
-	  }
+          }
         }
         else
         {
@@ -2195,27 +2203,36 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
     {
       if ( start ) {
         // DHS
-	if (TwoColWidthA > -1) {
+        if (TwoColWidthA > -1)
+        {
           wxChar buf[100];
           wxSnprintf(buf, sizeof(buf), _T("\n | 
| \n"),TwoColWidthA);
           TexOutput(buf);
-        } else
+        }
+        else
+        {
           TexOutput(_T("\n | 
| \n"));
-		OutputFont();
+        }
+        OutputFont();
       }  else
             TexOutput(_T("\n\n"));
     }
     if (arg_no == 2)
     {
       // DHS
-      if ( start ) {
-	if (TwoColWidthB > -1) {
+      if ( start )
+      {
+        if (TwoColWidthB > -1)
+        {
           wxChar buf[100];
           wxSnprintf(buf, sizeof(buf), _T("\n | \n"),TwoColWidthB);
           TexOutput(buf);
-        } else 
-           TexOutput(_T("\n | \n"));
-		OutputFont();
+        }
+        else 
+        {
+          TexOutput(_T("\n | \n"));
+        }
+        OutputFont();
       }  else
            TexOutput(_T("\n | 
\n"));
     }
@@ -2701,7 +2718,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
         if (compatibilityMode)
         {
           TexOutput(_T("\n| "));
-		  OutputFont();
+          OutputFont();
 /*
           for (int i = 0; i < noColumns; i++)
           {
@@ -2797,7 +2814,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
           {
             wxStrcpy(buf2, _T("#000000"));
             wxChar buf[100];
-			wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
+            wxSnprintf(buf, sizeof(buf), _T("Could not find colour name %s"), name);
             OnError(buf);
           }
           TexOutput(_T(""));
+        HTMLHead();
+        TexOutput(_T("\n"));
         TraverseChildrenFromChunk(DocumentTitle);
         TexOutput(_T("\n"));
       }
       else
       {
         SetCurrentOutput(tmpTitle);
-	HTMLHeadTo(tmpTitle);
+        HTMLHeadTo(tmpTitle);
         if (contentsString)
           wxFprintf(tmpTitle, _T("%s\n\n"), contentsString);
         else
@@ -3049,6 +3066,7 @@ bool HTMLGo(void)
 
       // Output  to temporary title page
       OutputBodyStart();
+      fflush(tmpTitle);
 
       // Concat titlepage
       FILE *fd = wxFopen(TitlepageName, _T("r"));
@@ -3123,7 +3141,7 @@ void GenerateHTMLIndexFile(wxChar *fname)
     return;
 
   TopicTable.BeginFind();
-  wxNode *node = TopicTable.Next();
+  wxHashTable::Node *node = TopicTable.Next();
   while (node)
   {
     TexTopic *texTopic = (TexTopic *)node->GetData();
@@ -3223,7 +3241,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
       _T(" \n"));
 
   TopicTable.BeginFind();
-  wxNode *node = TopicTable.Next();
+  wxHashTable::Node *node = TopicTable.Next();
   while (node)
   {
     TexTopic *texTopic = (TexTopic *)node->GetData();
@@ -3239,7 +3257,7 @@ void GenerateHTMLWorkshopFiles(wxChar *fname)
             _T("  \n")
             _T("  \n")
             _T("  \n"),
-	    texTopic->filename, topicName, s);
+        texTopic->filename, topicName, s);
         node1 = node1->GetNext();
       }
     }
@@ -3271,10 +3289,10 @@ void HTMLWorkshopAddToContents(int level, wxChar *s, wxChar *file)
             _T("  \n"));
   HTMLWorkshopLastLevel = level;
 }
 |