1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Converts Latex to HTML
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
13 #pragma implementation
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
30 #if !WXWIN_COMPATIBILITY_2_4
31 static inline wxChar
* copystring(const wxChar
* s
)
32 { return wxStrcpy(new wxChar
[wxStrlen(s
) + 1], s
); }
35 extern wxHashTable TexReferences
;
38 extern void DecToHex(int, wxChar
*);
39 void GenerateHTMLIndexFile(wxChar
*fname
);
41 void GenerateHTMLWorkshopFiles(wxChar
*fname
);
42 void HTMLWorkshopAddToContents(int level
, wxChar
*s
, wxChar
*file
);
43 void HTMLWorkshopStartContents();
44 void HTMLWorkshopEndContents();
46 void OutputContentsFrame(void);
48 #include "readshg.h" // Segmented hypergraphics parsing
50 wxChar
*ChaptersName
= NULL
;
51 wxChar
*SectionsName
= NULL
;
52 wxChar
*SubsectionsName
= NULL
;
53 wxChar
*SubsubsectionsName
= NULL
;
54 wxChar
*TitlepageName
= NULL
;
55 wxChar
*lastFileName
= NULL
;
56 wxChar
*lastTopic
= NULL
;
57 wxChar
*currentFileName
= NULL
;
58 wxChar
*contentsFrameName
= NULL
;
60 static TexChunk
*descriptionItemArg
= NULL
;
61 static TexChunk
*helpRefFilename
= NULL
;
62 static TexChunk
*helpRefText
= NULL
;
63 static int indentLevel
= 0;
64 static int citeCount
= 1;
65 extern FILE *Contents
;
66 FILE *FrameContents
= NULL
;
67 FILE *Titlepage
= NULL
;
68 // FILE *FrameTitlepage = NULL;
70 bool subsectionStarted
= FALSE
;
72 // Which column of a row are we in? (Assumes no nested tables, of course)
73 int currentColumn
= 0;
75 // Are we in verbatim mode? If so, format differently.
76 static bool inVerbatim
= FALSE
;
78 // Need to know whether we're in a table or figure for benefit
79 // of listoffigures/listoftables
80 static bool inFigure
= FALSE
;
81 static bool inTable
= FALSE
;
83 // This is defined in the Tex2Any library.
84 extern wxChar
*BigBuffer
;
86 // DHS Two-column table dimensions.
87 static int TwoColWidthA
= -1;
88 static int TwoColWidthB
= -1;
91 class HyperReference
: public wxObject
96 HyperReference(wxChar
*name
, wxChar
*file
)
98 if (name
) refName
= copystring(name
);
99 if (file
) refFile
= copystring(file
);
103 class TexNextPage
: public wxObject
108 TexNextPage(wxChar
*theLabel
, wxChar
*theFile
)
110 label
= copystring(theLabel
);
111 filename
= copystring(theFile
);
120 wxHashTable
TexNextPages(wxKEY_STRING
);
122 static wxChar
*CurrentChapterName
= NULL
;
123 static wxChar
*CurrentChapterFile
= NULL
;
124 static wxChar
*CurrentSectionName
= NULL
;
125 static wxChar
*CurrentSectionFile
= NULL
;
126 static wxChar
*CurrentSubsectionName
= NULL
;
127 static wxChar
*CurrentSubsectionFile
= NULL
;
128 static wxChar
*CurrentSubsubsectionName
= NULL
;
129 static wxChar
*CurrentSubsubsectionFile
= NULL
;
130 static wxChar
*CurrentTopic
= NULL
;
132 static void SetCurrentTopic(wxChar
*s
)
134 if (CurrentTopic
) delete[] CurrentTopic
;
135 CurrentTopic
= copystring(s
);
138 void SetCurrentChapterName(wxChar
*s
, wxChar
*file
)
140 if (CurrentChapterName
) delete[] CurrentChapterName
;
141 CurrentChapterName
= copystring(s
);
142 if (CurrentChapterFile
) delete[] CurrentChapterFile
;
143 CurrentChapterFile
= copystring(file
);
145 currentFileName
= CurrentChapterFile
;
149 void SetCurrentSectionName(wxChar
*s
, wxChar
*file
)
151 if (CurrentSectionName
) delete[] CurrentSectionName
;
152 CurrentSectionName
= copystring(s
);
153 if (CurrentSectionFile
) delete[] CurrentSectionFile
;
154 CurrentSectionFile
= copystring(file
);
156 currentFileName
= CurrentSectionFile
;
159 void SetCurrentSubsectionName(wxChar
*s
, wxChar
*file
)
161 if (CurrentSubsectionName
) delete[] CurrentSubsectionName
;
162 CurrentSubsectionName
= copystring(s
);
163 if (CurrentSubsectionFile
) delete[] CurrentSubsectionFile
;
164 CurrentSubsectionFile
= copystring(file
);
165 currentFileName
= CurrentSubsectionFile
;
168 void SetCurrentSubsubsectionName(wxChar
*s
, wxChar
*file
)
170 if (CurrentSubsubsectionName
) delete[] CurrentSubsubsectionName
;
171 CurrentSubsubsectionName
= copystring(s
);
172 if (CurrentSubsubsectionFile
) delete[] CurrentSubsubsectionFile
;
173 CurrentSubsubsectionFile
= copystring(file
);
174 currentFileName
= CurrentSubsubsectionFile
;
179 * Close former filedescriptor and reopen using another filename.
183 void ReopenFile(FILE **fd
, wxChar
**fileName
)
187 wxFprintf(*fd
, _T("\n</FONT></BODY></HTML>\n"));
192 if (truncateFilenames
)
193 wxSprintf(buf
, _T("%s%d.htm"), FileRoot
, fileId
);
195 wxSprintf(buf
, _T("%s%d.html"), FileRoot
, fileId
);
196 if (*fileName
) delete[] *fileName
;
197 *fileName
= copystring(wxFileNameFromPath(buf
));
198 *fd
= wxFopen(buf
, _T("w"));
199 wxFprintf(*fd
, _T("<HTML>\n"));
203 * Reopen section contents file, i.e. the index appended to each section
204 * in subsectionCombine mode
207 static wxChar
*SectionContentsFilename
= NULL
;
208 static FILE *SectionContentsFD
= NULL
;
210 void ReopenSectionContentsFile(void)
212 if ( SectionContentsFD
)
214 fclose(SectionContentsFD
);
216 if ( SectionContentsFilename
)
217 delete[] SectionContentsFilename
;
218 SectionContentsFD
= NULL
;
219 SectionContentsFilename
= NULL
;
221 // Create the name from the current section filename
222 if ( CurrentSectionFile
)
225 wxStrcpy(buf
, CurrentSectionFile
);
226 wxStripExtension(buf
);
227 wxStrcat(buf
, _T(".con"));
228 SectionContentsFilename
= copystring(buf
);
230 SectionContentsFD
= wxFopen(SectionContentsFilename
, _T("w"));
236 * Given a TexChunk with a string value, scans through the string
237 * converting Latex-isms into HTML-isms, such as 2 newlines -> <P>.
241 void ProcessText2HTML(TexChunk
*chunk
)
243 bool changed
= FALSE
;
247 int len
= wxStrlen(chunk
->value
);
250 ch
= chunk
->value
[i
];
252 // 2 newlines means \par
253 if (!inVerbatim
&& chunk
->value
[i
] == 10 && ((len
> i
+1 && chunk
->value
[i
+1] == 10) ||
254 ((len
> i
+1 && chunk
->value
[i
+1] == 13) &&
255 (len
> i
+2 && chunk
->value
[i
+2] == 10))))
257 BigBuffer
[ptr
] = 0; wxStrcat(BigBuffer
, _T("<P>\n\n")); ptr
+= 5;
261 else if (!inVerbatim
&& ch
== '`' && (len
>= i
+1 && chunk
->value
[i
+1] == '`'))
263 BigBuffer
[ptr
] = '"'; ptr
++;
267 else if (!inVerbatim
&& ch
== '`') // Change ` to '
269 BigBuffer
[ptr
] = 39; ptr
++;
273 else if (ch
== '<') // Change < to <
276 wxStrcat(BigBuffer
, _T("<"));
281 else if (ch
== '>') // Change > to >
284 wxStrcat(BigBuffer
, _T(">"));
301 chunk
->value
= copystring(BigBuffer
);
306 * Scan through all chunks starting from the given one,
307 * calling ProcessText2HTML to convert Latex-isms to RTF-isms.
308 * This should be called after Tex2Any has parsed the file,
309 * and before TraverseDocument is called.
313 void Text2HTML(TexChunk
*chunk
)
316 if (stopRunning
) return;
320 case CHUNK_TYPE_MACRO
:
322 TexMacroDef
*def
= chunk
->def
;
324 if (def
&& def
->ignore
)
327 if (def
&& (def
->macroId
== ltVERBATIM
|| def
->macroId
== ltVERB
|| def
->macroId
== ltSPECIAL
))
330 wxNode
*node
= chunk
->children
.GetFirst();
333 TexChunk
*child_chunk
= (TexChunk
*)node
->GetData();
334 Text2HTML(child_chunk
);
335 node
= node
->GetNext();
338 if (def
&& (def
->macroId
== ltVERBATIM
|| def
->macroId
== ltVERB
|| def
->macroId
== ltSPECIAL
))
345 wxNode
*node
= chunk
->children
.GetFirst();
348 TexChunk
*child_chunk
= (TexChunk
*)node
->GetData();
349 Text2HTML(child_chunk
);
350 node
= node
->GetNext();
355 case CHUNK_TYPE_STRING
:
358 ProcessText2HTML(chunk
);
365 * Add appropriate browse buttons to this page.
369 void AddBrowseButtons(wxChar
*upLabel
, wxChar
*upFilename
,
370 wxChar
*previousLabel
, wxChar
*previousFilename
,
371 wxChar
*thisLabel
, wxChar
*thisFilename
)
373 wxChar contentsReferenceBuf
[80];
374 wxChar upReferenceBuf
[80];
375 wxChar backReferenceBuf
[80];
376 wxChar forwardReferenceBuf
[80];
377 if (htmlBrowseButtons
== HTML_BUTTONS_NONE
)
380 wxChar
*contentsReference
; // no need to initialize because always assigned below
381 if (htmlBrowseButtons
== HTML_BUTTONS_TEXT
)
382 contentsReference
= ContentsNameString
;
385 // contentsReference = "<img align=center src=\"contents.gif\" BORDER=0 ALT=\"Contents\">";
386 contentsReference
= contentsReferenceBuf
;
387 wxSprintf(contentsReference
, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Contents\">"), ConvertCase(_T("contents.gif")));
390 wxChar
*upReference
; // no need to initialize because always assigned below
391 if (htmlBrowseButtons
== HTML_BUTTONS_TEXT
)
392 upReference
= UpNameString
;
395 // upReference = "<img align=center src=\"up.gif\" ALT=\"Up\">";
396 upReference
= upReferenceBuf
;
397 wxSprintf(upReference
, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Up\">"), ConvertCase(_T("up.gif")));
400 wxChar
*backReference
; // no need to initialize because always assigned below
401 if (htmlBrowseButtons
== HTML_BUTTONS_TEXT
)
402 backReference
= _T("<<");
405 // backReference = "<img align=center src=\"back.gif\" ALT=\"Previous\">";
406 backReference
= backReferenceBuf
;
407 wxSprintf(backReference
, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Previous\">"), ConvertCase(_T("back.gif")));
410 wxChar
*forwardReference
; // no need to initialize because always assigned below
411 if (htmlBrowseButtons
== HTML_BUTTONS_TEXT
)
412 forwardReference
= _T(">>");
415 // forwardReference = "<img align=center src=\"forward.gif\" ALT=\"Next\">";
416 forwardReference
= forwardReferenceBuf
;
417 wxSprintf(forwardReference
, _T("<img align=center src=\"%s\" BORDER=0 ALT=\"Next\">"), ConvertCase(_T("forward.gif")));
420 TexOutput(_T("<CENTER>"));
429 if (truncateFilenames
)
432 wxStrcpy(buf1
, ConvertCase(wxFileNameFromPath(FileRoot
)));
433 wxSprintf(buf
, _T("\n<A HREF=\"%s.%s\">%s</A> "), buf1
, ConvertCase(_T("htm")), contentsReference
);
438 wxStrcpy(buf1
, ConvertCase(wxFileNameFromPath(FileRoot
)));
439 wxSprintf(buf
, _T("\n<A HREF=\"%s%s\">%s</A> "), buf1
, ConvertCase(_T("_contents.html")), contentsReference
);
441 // TexOutput(_T("<NOFRAMES>"));
443 // TexOutput(_T("</NOFRAMES>"));
450 if (upLabel
&& upFilename
)
452 if (wxStrlen(upLabel
) > 0)
453 wxSprintf(buf
, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(upFilename
), upLabel
, upReference
);
455 wxSprintf(buf
, _T("<A HREF=\"%s\">%s</A> "), ConvertCase(upFilename
), upReference
);
456 if (wxStrcmp(upLabel
, _T("contents")) == 0)
458 // TexOutput(_T("<NOFRAMES>"));
460 // TexOutput(_T("</NOFRAMES>"));
471 if (previousLabel
&& previousFilename
)
473 wxSprintf(buf
, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(previousFilename
), previousLabel
, backReference
);
474 if (wxStrcmp(previousLabel
, _T("contents")) == 0)
476 // TexOutput(_T("<NOFRAMES>"));
478 // TexOutput(_T("</NOFRAMES>"));
485 // A placeholder so the buttons don't keep moving position
486 wxSprintf(buf
, _T("%s "), backReference
);
490 wxChar
*nextLabel
= NULL
;
491 wxChar
*nextFilename
= NULL
;
493 // Get the next page, and record the previous page's 'next' page
495 TexNextPage
*nextPage
= (TexNextPage
*)TexNextPages
.Get(thisLabel
);
498 nextLabel
= nextPage
->label
;
499 nextFilename
= nextPage
->filename
;
501 if (previousLabel
&& previousFilename
)
503 TexNextPage
*oldNextPage
= (TexNextPage
*)TexNextPages
.Get(previousLabel
);
507 TexNextPages
.Delete(previousLabel
);
509 TexNextPage
*newNextPage
= new TexNextPage(thisLabel
, thisFilename
);
510 TexNextPages
.Put(previousLabel
, newNextPage
);
518 if (nextLabel
&& nextFilename
)
520 wxSprintf(buf
, _T("<A HREF=\"%s#%s\">%s</A> "), ConvertCase(nextFilename
), nextLabel
, forwardReference
);
525 // A placeholder so the buttons don't keep moving position
526 wxSprintf(buf
, _T("%s "), forwardReference
);
531 * Horizontal rule to finish it off nicely.
534 TexOutput(_T("</CENTER>"));
535 TexOutput(_T("<HR>\n"));
537 // Update last topic/filename
539 delete[] lastFileName
;
540 lastFileName
= copystring(thisFilename
);
543 lastTopic
= copystring(thisLabel
);
546 // A colour string is either 3 numbers separated by semicolons (RGB),
547 // or a reference to a GIF. Return the filename or a hex string like #934CE8
548 wxChar
*ParseColourString(wxChar
*bkStr
, bool *isPicture
)
550 static wxChar resStr
[300];
551 wxStrcpy(resStr
, bkStr
);
552 wxStringTokenizer
tok(resStr
, _T(";"), wxTOKEN_STRTOK
);
553 if (tok
.HasMoreTokens())
555 wxString token1
= tok
.GetNextToken();
556 if (!tok
.HasMoreTokens())
563 wxString token2
= tok
.GetNextToken();
565 if (tok
.HasMoreTokens())
567 wxString token3
= tok
.GetNextToken();
569 // Now convert 3 strings into decimal numbers, and then hex numbers.
570 int red
= wxAtoi(token1
.c_str());
571 int green
= wxAtoi(token2
.c_str());
572 int blue
= wxAtoi(token3
.c_str());
574 wxStrcpy(resStr
, _T("#"));
578 wxStrcat(resStr
, buf
);
579 DecToHex(green
, buf
);
580 wxStrcat(resStr
, buf
);
582 wxStrcat(resStr
, buf
);
591 void OutputFont(void)
593 // Only output <font face> if explicitly requested by htmlFaceName= directive in
594 // tex2rtf.ini. Otherwise do NOT set the font because we want to use browser's
598 // Output <FONT FACE=...>
599 TexOutput(_T("<FONT FACE=\""));
600 TexOutput(htmlFaceName
);
601 TexOutput(_T("\">\n"));
605 // Output start of <BODY> block
606 void OutputBodyStart(void)
608 TexOutput(_T("\n<BODY"));
609 if (backgroundImageString
)
611 bool isPicture
= FALSE
;
612 wxChar
*s
= ParseColourString(backgroundImageString
, &isPicture
);
615 TexOutput(_T(" BACKGROUND=\""));
620 if (backgroundColourString
)
622 bool isPicture
= FALSE
;
623 wxChar
*s
= ParseColourString(backgroundColourString
, &isPicture
);
626 TexOutput(_T(" BGCOLOR="));
631 // Set foreground text colour, if one is specified
632 if (textColourString
)
634 bool isPicture
= FALSE
;
635 wxChar
*s
= ParseColourString(textColourString
, &isPicture
);
638 TexOutput(_T(" TEXT=")); TexOutput(s
);
641 // Set link text colour, if one is specified
642 if (linkColourString
)
644 bool isPicture
= FALSE
;
645 wxChar
*s
= ParseColourString(linkColourString
, &isPicture
);
648 TexOutput(_T(" LINK=")); TexOutput(s
);
651 // Set followed link text colour, if one is specified
652 if (followedLinkColourString
)
654 bool isPicture
= FALSE
;
655 wxChar
*s
= ParseColourString(followedLinkColourString
, &isPicture
);
658 TexOutput(_T(" VLINK=")); TexOutput(s
);
661 TexOutput(_T(">\n"));
668 TexOutput(_T("<head>"));
669 if (htmlStylesheet
) {
670 TexOutput(_T("<link rel=stylesheet type=\"text/css\" href=\""));
671 TexOutput(htmlStylesheet
);
672 TexOutput(_T("\">"));
676 void HTMLHeadTo(FILE* f
)
679 wxFprintf(f
,_T("<head><link rel=stylesheet type=\"text/css\" href=\"%s\">"),htmlStylesheet
);
681 wxFprintf(f
,_T("<head>"));
684 // Called on start/end of macro examination
685 void HTMLOnMacro(int macroId
, int no_args
, bool start
)
691 case ltCHAPTERHEADING
:
699 if (macroId
!= ltCHAPTERSTAR
)
702 SetCurrentOutput(NULL
);
703 startedSections
= TRUE
;
705 wxChar
*topicName
= FindTopicName(GetNextChunk());
706 ReopenFile(&Chapters
, &ChaptersName
);
707 AddTexRef(topicName
, ChaptersName
, ChapterNameString
);
709 SetCurrentChapterName(topicName
, ChaptersName
);
710 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(0, topicName
, ChaptersName
);
712 SetCurrentOutput(Chapters
);
715 TexOutput(_T("<title>"));
716 OutputCurrentSection(); // Repeat section header
717 TexOutput(_T("</title></head>\n"));
720 wxChar titleBuf
[200];
721 if (truncateFilenames
)
722 wxSprintf(titleBuf
, _T("%s.htm"), wxFileNameFromPath(FileRoot
));
724 wxSprintf(titleBuf
, _T("%s_contents.html"), wxFileNameFromPath(FileRoot
));
726 wxFprintf(Chapters
, _T("<A NAME=\"%s\"></A>"), topicName
);
728 AddBrowseButtons(_T(""), titleBuf
, // Up
729 lastTopic
, lastFileName
, // Last topic
730 topicName
, ChaptersName
); // This topic
732 wxFprintf(Contents
, _T("\n<LI><A HREF=\"%s#%s\">"), ConvertCase(ChaptersName
), topicName
);
734 if (htmlFrameContents
&& FrameContents
)
736 SetCurrentOutput(FrameContents
);
737 wxFprintf(FrameContents
, _T("\n<LI><A HREF=\"%s#%s\" TARGET=\"mainwindow\">"), ConvertCase(ChaptersName
), topicName
);
738 OutputCurrentSection();
739 wxFprintf(FrameContents
, _T("</A>\n"));
742 SetCurrentOutputs(Contents
, Chapters
);
743 wxFprintf(Chapters
, _T("\n<H2>"));
744 OutputCurrentSection();
745 wxFprintf(Contents
, _T("</A>\n"));
746 wxFprintf(Chapters
, _T("</H2>\n"));
748 SetCurrentOutput(Chapters
);
750 // Add this section title to the list of keywords
753 OutputCurrentSectionToString(wxTex2RTFBuffer
);
754 AddKeyWordForTopic(topicName
, wxTex2RTFBuffer
, ConvertCase(currentFileName
));
761 case ltSECTIONHEADING
:
768 subsectionStarted
= FALSE
;
770 if (macroId
!= ltSECTIONSTAR
)
773 SetCurrentOutput(NULL
);
774 startedSections
= TRUE
;
776 wxChar
*topicName
= FindTopicName(GetNextChunk());
777 ReopenFile(&Sections
, &SectionsName
);
778 AddTexRef(topicName
, SectionsName
, SectionNameString
);
780 SetCurrentSectionName(topicName
, SectionsName
);
781 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(1, topicName
, SectionsName
);
783 SetCurrentOutput(Sections
);
785 TexOutput(_T("<title>"));
786 OutputCurrentSection();
787 TexOutput(_T("</title></head>\n"));
790 wxFprintf(Sections
, _T("<A NAME=\"%s\"></A>"), topicName
);
791 AddBrowseButtons(CurrentChapterName
, CurrentChapterFile
, // Up
792 lastTopic
, lastFileName
, // Last topic
793 topicName
, SectionsName
); // This topic
795 FILE *jumpFrom
= ((DocumentStyle
== LATEX_ARTICLE
) ? Contents
: Chapters
);
797 SetCurrentOutputs(jumpFrom
, Sections
);
798 if (DocumentStyle
== LATEX_ARTICLE
)
799 wxFprintf(jumpFrom
, _T("\n<LI><A HREF=\"%s#%s\">"), ConvertCase(SectionsName
), topicName
);
801 wxFprintf(jumpFrom
, _T("\n<A HREF=\"%s#%s\"><B>"), ConvertCase(SectionsName
), topicName
);
803 wxFprintf(Sections
, _T("\n<H2>"));
804 OutputCurrentSection();
806 if (DocumentStyle
== LATEX_ARTICLE
)
807 wxFprintf(jumpFrom
, _T("</A>\n"));
809 wxFprintf(jumpFrom
, _T("</B></A><BR>\n"));
810 wxFprintf(Sections
, _T("</H2>\n"));
812 SetCurrentOutput(Sections
);
813 // Add this section title to the list of keywords
816 OutputCurrentSectionToString(wxTex2RTFBuffer
);
817 AddKeyWordForTopic(topicName
, wxTex2RTFBuffer
, currentFileName
);
823 case ltSUBSECTIONSTAR
:
824 case ltMEMBERSECTION
:
825 case ltFUNCTIONSECTION
:
831 OnError(_T("You cannot have a subsection before a section!"));
837 if (macroId
!= ltSUBSECTIONSTAR
)
840 if ( combineSubSections
&& !subsectionStarted
)
842 // Read old .con file in at this point
844 wxStrcpy(buf
, CurrentSectionFile
);
845 wxStripExtension(buf
);
846 wxStrcat(buf
, _T(".con"));
847 FILE *fd
= wxFopen(buf
, _T("r"));
858 wxFprintf(Sections
, _T("<P>\n"));
860 // Close old file, create a new file for the sub(sub)section contents entries
861 ReopenSectionContentsFile();
864 startedSections
= TRUE
;
865 subsectionStarted
= TRUE
;
867 wxChar
*topicName
= FindTopicName(GetNextChunk());
869 if ( !combineSubSections
)
871 SetCurrentOutput(NULL
);
872 ReopenFile(&Subsections
, &SubsectionsName
);
873 AddTexRef(topicName
, SubsectionsName
, SubsectionNameString
);
874 SetCurrentSubsectionName(topicName
, SubsectionsName
);
875 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(2, topicName
, SubsectionsName
);
876 SetCurrentOutput(Subsections
);
879 TexOutput(_T("<title>"));
880 OutputCurrentSection();
881 TexOutput(_T("</title></head>\n"));
884 wxFprintf(Subsections
, _T("<A NAME=\"%s\"></A>"), topicName
);
885 AddBrowseButtons(CurrentSectionName
, CurrentSectionFile
, // Up
886 lastTopic
, lastFileName
, // Last topic
887 topicName
, SubsectionsName
); // This topic
889 SetCurrentOutputs(Sections
, Subsections
);
890 wxFprintf(Sections
, _T("\n<A HREF=\"%s#%s\"><B>"), ConvertCase(SubsectionsName
), topicName
);
892 wxFprintf(Subsections
, _T("\n<H3>"));
893 OutputCurrentSection();
894 wxFprintf(Sections
, _T("</B></A><BR>\n"));
895 wxFprintf(Subsections
, _T("</H3>\n"));
897 SetCurrentOutput(Subsections
);
901 AddTexRef(topicName
, SectionsName
, SubsectionNameString
);
902 SetCurrentSubsectionName(topicName
, SectionsName
);
904 // if ( subsectionNo != 0 )
905 wxFprintf(Sections
, _T("\n<HR>\n"));
907 // We're putting everything into the section file
908 wxFprintf(Sections
, _T("<A NAME=\"%s\"></A>"), topicName
);
909 wxFprintf(Sections
, _T("\n<H3>"));
910 OutputCurrentSection();
911 wxFprintf(Sections
, _T("</H3>\n"));
913 SetCurrentOutput(SectionContentsFD
);
914 wxFprintf(SectionContentsFD
, _T("<A HREF=\"#%s\">"), topicName
);
915 OutputCurrentSection();
916 TexOutput(_T("</A><BR>\n"));
918 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(2, topicName
, SectionsName
);
919 SetCurrentOutput(Sections
);
921 // Add this section title to the list of keywords
924 OutputCurrentSectionToString(wxTex2RTFBuffer
);
925 AddKeyWordForTopic(topicName
, wxTex2RTFBuffer
, currentFileName
);
932 case ltSUBSUBSECTION
:
933 case ltSUBSUBSECTIONSTAR
:
937 if (!Subsections
&& !combineSubSections
)
939 OnError(_T("You cannot have a subsubsection before a subsection!"));
943 if (macroId
!= ltSUBSUBSECTIONSTAR
)
946 startedSections
= TRUE
;
948 wxChar
*topicName
= FindTopicName(GetNextChunk());
950 if ( !combineSubSections
)
952 SetCurrentOutput(NULL
);
953 ReopenFile(&Subsubsections
, &SubsubsectionsName
);
954 AddTexRef(topicName
, SubsubsectionsName
, SubsubsectionNameString
);
955 SetCurrentSubsubsectionName(topicName
, SubsubsectionsName
);
956 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(3, topicName
, SubsubsectionsName
);
958 SetCurrentOutput(Subsubsections
);
960 TexOutput(_T("<title>"));
961 OutputCurrentSection();
962 TexOutput(_T("</title></head>\n"));
965 wxFprintf(Subsubsections
, _T("<A NAME=\"%s\"></A>"), topicName
);
967 AddBrowseButtons(CurrentSubsectionName
, CurrentSubsectionFile
, // Up
968 lastTopic
, lastFileName
, // Last topic
969 topicName
, SubsubsectionsName
); // This topic
971 SetCurrentOutputs(Subsections
, Subsubsections
);
972 wxFprintf(Subsections
, _T("\n<A HREF=\"%s#%s\"><B>"), ConvertCase(SubsubsectionsName
), topicName
);
974 wxFprintf(Subsubsections
, _T("\n<H3>"));
975 OutputCurrentSection();
976 wxFprintf(Subsections
, _T("</B></A><BR>\n"));
977 wxFprintf(Subsubsections
, _T("</H3>\n"));
981 AddTexRef(topicName
, SectionsName
, SubsubsectionNameString
);
982 SetCurrentSubsectionName(topicName
, SectionsName
);
983 wxFprintf(Sections
, _T("\n<HR>\n"));
985 // We're putting everything into the section file
986 wxFprintf(Sections
, _T("<A NAME=\"%s\"></A>"), topicName
);
987 wxFprintf(Sections
, _T("\n<H3>"));
988 OutputCurrentSection();
989 wxFprintf(Sections
, _T("</H3>\n"));
990 /* TODO: where do we put subsubsection contents entry - indented, with subsection entries?
991 SetCurrentOutput(SectionContentsFD);
992 wxFprintf(SectionContentsFD, "<A HREF=\"#%s\">", topicName);
993 OutputCurrentSection();
994 TexOutput(_T("</A><BR>"));
996 if (htmlWorkshopFiles
) HTMLWorkshopAddToContents(2, topicName
, SectionsName
);
997 SetCurrentOutput(Sections
);
1000 // Add this section title to the list of keywords
1003 OutputCurrentSectionToString(wxTex2RTFBuffer
);
1004 AddKeyWordForTopic(topicName
, wxTex2RTFBuffer
, currentFileName
);
1013 if ( !combineSubSections
)
1014 SetCurrentOutput(Subsections
);
1016 SetCurrentOutput(Sections
);
1027 if ( !combineSubSections
)
1028 SetCurrentOutput(Subsections
);
1030 SetCurrentOutput(Sections
);
1041 if ( !combineSubSections
)
1042 SetCurrentOutput(Subsections
);
1044 SetCurrentOutput(Sections
);
1055 // TexOutput(_T("<B>void</B>"));
1059 TexOutput(_T("HARDY"));
1063 TexOutput(_T("wxCLIPS"));
1067 TexOutput(_T("&"));
1069 case ltSPECIALAMPERSAND
:
1075 // End cell, start cell
1077 TexOutput(_T("</FONT></TD>"));
1079 // Start new row and cell, setting alignment for the first cell.
1080 if (currentColumn
< noColumns
)
1084 if (TableData
[currentColumn
].justification
== 'c')
1085 wxSprintf(buf
, _T("\n<TD ALIGN=CENTER>"));
1086 else if (TableData
[currentColumn
].justification
== 'r')
1087 wxSprintf(buf
, _T("\n<TD ALIGN=RIGHT>"));
1088 else if (TableData
[currentColumn
].absWidth
)
1090 // Convert from points * 20 into pixels.
1091 int points
= TableData
[currentColumn
].width
/ 20;
1093 // Say the display is 100 DPI (dots/pixels per inch).
1094 // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
1095 int pixels
= (int)(points
* 100.0 / 72.0);
1096 wxSprintf(buf
, _T("<TD ALIGN=CENTER WIDTH=%d>"), pixels
);
1099 wxSprintf(buf
, _T("\n<TD ALIGN=LEFT>"));
1104 TexOutput(_T("&"));
1108 case ltBACKSLASHCHAR
:
1114 // End row. In fact, tables without use of \row or \ruledrow isn't supported for
1115 // HTML: the syntax is too different (e.g. how do we know where to put the first </TH>
1116 // if we've ended the last row?). So normally you wouldn't use \\ to end a row.
1117 TexOutput(_T("</TR>\n"));
1120 TexOutput(_T("<BR>\n"));
1131 // Start new row and cell, setting alignment for the first cell.
1133 if (TableData
[currentColumn
].justification
== 'c')
1134 wxSprintf(buf
, _T("<TR>\n<TD ALIGN=CENTER>"));
1135 else if (TableData
[currentColumn
].justification
== 'r')
1136 wxSprintf(buf
, _T("<TR>\n<TD ALIGN=RIGHT>"));
1137 else if (TableData
[currentColumn
].absWidth
)
1139 // Convert from points * 20 into pixels.
1140 int points
= TableData
[currentColumn
].width
/ 20;
1142 // Say the display is 100 DPI (dots/pixels per inch).
1143 // There are 72 pts to the inch. So 1pt = 1/72 inch, or 100 * 1/72 dots.
1144 int pixels
= (int)(points
* 100.0 / 72.0);
1145 wxSprintf(buf
, _T("<TR>\n<TD ALIGN=CENTER WIDTH=%d>"), pixels
);
1148 wxSprintf(buf
, _T("<TR>\n<TD ALIGN=LEFT>"));
1155 // Start new row and cell
1156 TexOutput(_T("</FONT></TD>\n</TR>\n"));
1160 // HTML-only: break until the end of the picture (both margins are clear).
1164 TexOutput(_T("<BR CLEAR=ALL>"));
1167 case ltRTFSP
: // Explicit space, RTF only
1169 case ltSPECIALTILDE
:
1183 TexOutput(_T("<UL><UL>\n"));
1185 TexOutput(_T("</UL></UL>\n"));
1191 // case ltTWOCOLLIST:
1198 if (macroId
== ltENUMERATE
)
1199 listType
= LATEX_ENUMERATE
;
1200 else if (macroId
== ltITEMIZE
)
1201 listType
= LATEX_ITEMIZE
;
1203 listType
= LATEX_DESCRIPTION
;
1205 itemizeStack
.Insert(new ItemizeStruc(listType
));
1209 TexOutput(_T("<UL>\n"));
1211 case LATEX_ENUMERATE
:
1212 TexOutput(_T("<OL>\n"));
1214 case LATEX_DESCRIPTION
:
1216 TexOutput(_T("<DL>\n"));
1223 if (itemizeStack
.GetFirst())
1225 ItemizeStruc
*struc
= (ItemizeStruc
*)itemizeStack
.GetFirst()->GetData();
1226 switch (struc
->listType
)
1229 TexOutput(_T("</UL>\n"));
1231 case LATEX_ENUMERATE
:
1232 TexOutput(_T("</OL>\n"));
1234 case LATEX_DESCRIPTION
:
1236 TexOutput(_T("</DL>\n"));
1241 delete itemizeStack
.GetFirst();
1249 TexOutput(_T("\n<TABLE>\n"));
1251 TexOutput(_T("\n</TABLE>\n"));
1261 TexOutput(_T("<P>\n"));
1264 /* For footnotes we need to output the text at the bottom of the page and
1265 * insert a reference to it. Is it worth the trouble...
1267 case ltFOOTNOTEPOPUP:
1271 TexOutput(_T("<FN>"));
1273 else TexOutput(_T("</FN>"));
1280 TexOutput(_T("<TT>"));
1281 else TexOutput(_T("</TT>"));
1289 wxSprintf(buf
, _T("<PRE>\n"));
1292 else TexOutput(_T("</PRE>\n"));
1300 TexOutput(_T("<CENTER>"));
1302 else TexOutput(_T("</CENTER>"));
1310 TexOutput(_T("{\\ql "));
1312 else TexOutput(_T("}\\par\\pard\n"));
1321 TexOutput(_T("{\\qr "));
1323 else TexOutput(_T("}\\par\\pard\n"));
1331 // Netscape extension
1332 TexOutput(_T("<FONT SIZE=2>"));
1334 else TexOutput(_T("</FONT>"));
1341 // Netscape extension
1342 TexOutput(_T("<FONT SIZE=1>"));
1344 else TexOutput(_T("</FONT>"));
1351 // Netscape extension
1352 TexOutput(_T("<FONT SIZE=3>"));
1354 else TexOutput(_T("</FONT>"));
1361 // Netscape extension
1362 TexOutput(_T("<FONT SIZE=4>"));
1364 else TexOutput(_T("</FONT>"));
1371 // Netscape extension
1372 TexOutput(_T("<FONT SIZE=5>"));
1374 else TexOutput(_T("</FONT>"));
1381 // Netscape extension
1382 TexOutput(_T("<FONT SIZE=6>"));
1384 else TexOutput(_T("</FONT>"));
1393 TexOutput(_T("<B>"));
1395 else TexOutput(_T("</B>"));
1404 TexOutput(_T("<I>"));
1406 else TexOutput(_T("</I>"));
1414 TexOutput(_T("<EM>"));
1416 else TexOutput(_T("</EM>"));
1423 TexOutput(_T("<UL>"));
1425 else TexOutput(_T("</UL>"));
1434 TexOutput(_T("<TT>"));
1436 else TexOutput(_T("</TT>"));
1442 TexOutput(_T("©"), TRUE
);
1448 TexOutput(_T("®"), TRUE
);
1454 if (start
) TexOutput(_T("<--"));
1459 if (start
) TexOutput(_T("<=="));
1464 if (start
) TexOutput(_T("-->"));
1469 if (start
) TexOutput(_T("==>"));
1472 case ltLEFTRIGHTARROW
:
1474 if (start
) TexOutput(_T("<-->"));
1477 case ltLEFTRIGHTARROW2
:
1479 if (start
) TexOutput(_T("<==>"));
1492 wxNode
*node
= itemizeStack
.GetFirst();
1495 ItemizeStruc
*struc
= (ItemizeStruc
*)node
->GetData();
1496 struc
->currentItem
+= 1;
1497 if (struc
->listType
== LATEX_DESCRIPTION
)
1499 if (descriptionItemArg
)
1501 TexOutput(_T("<DT> "));
1502 TraverseChildrenFromChunk(descriptionItemArg
);
1503 TexOutput(_T("\n"));
1504 descriptionItemArg
= NULL
;
1506 TexOutput(_T("<DD>"));
1509 TexOutput(_T("<LI>"));
1516 if (start
&& DocumentTitle
&& DocumentAuthor
)
1518 // Add a special label for the contents page.
1519 // TexOutput(_T("<CENTER>\n"));
1520 TexOutput(_T("<A NAME=\"contents\">"));
1521 TexOutput(_T("<H2 ALIGN=CENTER>\n"));
1522 TraverseChildrenFromChunk(DocumentTitle
);
1523 TexOutput(_T("</H2>"));
1524 TexOutput(_T("<P>"));
1525 TexOutput(_T("</A>\n"));
1526 TexOutput(_T("<P>\n\n"));
1527 TexOutput(_T("<H3 ALIGN=CENTER>"));
1528 TraverseChildrenFromChunk(DocumentAuthor
);
1529 TexOutput(_T("</H3><P>\n\n"));
1532 TexOutput(_T("<H3 ALIGN=CENTER>"));
1533 TraverseChildrenFromChunk(DocumentDate
);
1534 TexOutput(_T("</H3><P>\n\n"));
1536 // TexOutput(_T("\n</CENTER>\n"));
1537 TexOutput(_T("\n<P><HR><P>\n"));
1540 // Now do optional frame contents page
1541 if (htmlFrameContents && FrameContents)
1543 SetCurrentOutput(FrameContents);
1545 // Add a special label for the contents page.
1546 TexOutput(_T("<CENTER>\n"));
1547 TexOutput(_T("<H3>\n"));
1548 TraverseChildrenFromChunk(DocumentTitle);
1549 TexOutput(_T("</H3>"));
1550 TexOutput(_T("<P>"));
1551 TexOutput(_T("</A>\n"));
1552 TexOutput(_T("<P>\n\n"));
1553 TexOutput(_T("<H3>"));
1554 TraverseChildrenFromChunk(DocumentAuthor);
1555 TexOutput(_T("</H3><P>\n\n"));
1558 TexOutput(_T("<H4>"));
1559 TraverseChildrenFromChunk(DocumentDate);
1560 TexOutput(_T("</H4><P>\n\n"));
1562 TexOutput(_T("\n</CENTER>\n"));
1563 TexOutput(_T("<P><HR><P>\n"));
1565 SetCurrentOutput(Titlepage);
1578 helpRefFilename
= NULL
;
1583 case ltBIBLIOGRAPHY
:
1587 DefaultOnMacro(macroId
, no_args
, start
);
1591 DefaultOnMacro(macroId
, no_args
, start
);
1592 TexOutput(_T("</DL>\n"));
1600 TexOutput(_T("<HR>\n"));
1608 TexOutput(_T("<HR>\n"));
1612 case ltTABLEOFCONTENTS
:
1616 FILE *fd
= wxFopen(ContentsName
, _T("r"));
1622 putc(ch
, Titlepage
);
1629 TexOutput(_T("RUN TEX2RTF AGAIN FOR CONTENTS PAGE\n"));
1630 OnInform(_T("Run Tex2RTF again to include contents page."));
1638 TexOutput(_T("<"));
1644 TexOutput(_T(">"));
1651 TexOutput(_T("<BLOCKQUOTE>"));
1653 TexOutput(_T("</BLOCKQUOTE>"));
1662 TexOutput(_T("\n<CAPTION>"));
1670 if (DocumentStyle
!= LATEX_ARTICLE
)
1671 wxSprintf(figBuf
, _T("%s %d.%d: "), FigureNameString
, chapterNo
, figureNo
);
1673 wxSprintf(figBuf
, _T("%s %d: "), FigureNameString
, figureNo
);
1679 if (DocumentStyle
!= LATEX_ARTICLE
)
1680 wxSprintf(figBuf
, _T("%s %d.%d: "), TableNameString
, chapterNo
, tableNo
);
1682 wxSprintf(figBuf
, _T("%s %d: "), TableNameString
, tableNo
);
1690 TexOutput(_T("\n</CAPTION>\n"));
1692 wxChar
*topicName
= FindTopicName(GetNextChunk());
1694 int n
= inFigure
? figureNo
: tableNo
;
1696 AddTexRef(topicName
, NULL
, NULL
,
1697 ((DocumentStyle
!= LATEX_ARTICLE
) ? chapterNo
: n
),
1698 ((DocumentStyle
!= LATEX_ARTICLE
) ? n
: 0));
1704 if (start
) TexOutput(_T("ß"));
1709 if (start
) inFigure
= TRUE
;
1710 else inFigure
= FALSE
;
1715 if (start
) inTable
= TRUE
;
1716 else inTable
= FALSE
;
1720 DefaultOnMacro(macroId
, no_args
, start
);
1725 // Called on start/end of argument examination
1726 bool HTMLOnArgument(int macroId
, int arg_no
, bool start
)
1732 case ltCHAPTERHEADING
:
1735 case ltSECTIONHEADING
:
1737 case ltSUBSECTIONSTAR
:
1738 case ltSUBSUBSECTION
:
1739 case ltSUBSUBSECTIONSTAR
:
1741 case ltMEMBERSECTION
:
1742 case ltFUNCTIONSECTION
:
1744 if (!start
&& (arg_no
== 1))
1745 currentSection
= GetArgChunk();
1750 if (start
&& (arg_no
== 1))
1751 TexOutput(_T("<B>"));
1753 if (!start
&& (arg_no
== 1))
1754 TexOutput(_T("</B> "));
1756 if (start
&& (arg_no
== 2))
1758 if (!suppressNameDecoration
) TexOutput(_T("<B>"));
1759 currentMember
= GetArgChunk();
1761 if (!start
&& (arg_no
== 2))
1763 if (!suppressNameDecoration
) TexOutput(_T("</B>"));
1766 if (start
&& (arg_no
== 3))
1768 if (!start
&& (arg_no
== 3))
1774 if (start
&& (arg_no
== 1))
1775 TexOutput(_T("<B>"));
1776 if (!start
&& (arg_no
== 1))
1777 TexOutput(_T("</B> "));
1779 if (start
&& (arg_no
== 2))
1781 if (!suppressNameDecoration
) TexOutput(_T("( "));
1782 currentMember
= GetArgChunk();
1784 if (!start
&& (arg_no
== 2))
1788 if (!start
&& (arg_no
== 3))
1794 if (!start
&& (arg_no
== 1))
1797 if (start
&& (arg_no
== 2))
1798 TexOutput(_T("(*"));
1799 if (!start
&& (arg_no
== 2))
1802 if (start
&& (arg_no
== 2))
1803 currentMember
= GetArgChunk();
1805 if (start
&& (arg_no
== 3))
1807 if (!start
&& (arg_no
== 3))
1813 if (start
&& (arg_no
== 1))
1814 TexOutput(_T("<B>"));
1815 if (!start
&& (arg_no
== 1))
1816 TexOutput(_T("</B>"));
1817 if (start
&& (arg_no
== 2))
1819 TexOutput(_T("<I>"));
1821 if (!start
&& (arg_no
== 2))
1823 TexOutput(_T("</I>"));
1829 if (start
&& (arg_no
== 1))
1830 TexOutput(_T("<B>"));
1831 if (!start
&& (arg_no
== 1))
1832 TexOutput(_T("</B> ")); // This is the difference from param - one space!
1833 if (start
&& (arg_no
== 2))
1835 TexOutput(_T("<I>"));
1837 if (!start
&& (arg_no
== 2))
1839 TexOutput(_T("</I>"));
1845 if (!start
&& (arg_no
== 1))
1848 if (start
&& (arg_no
== 2))
1849 currentMember
= GetArgChunk();
1858 wxChar
*refName
= GetArgData();
1861 TexRef
*texRef
= FindReference(refName
);
1864 sec
= texRef
->sectionNumber
;
1877 if (IsArgOptional())
1879 else if ((GetNoArgs() - arg_no
) == 1)
1882 helpRefText
= GetArgChunk();
1885 else if ((GetNoArgs() - arg_no
) == 0) // Arg = 2, or 3 if first is optional
1889 TexChunk
*ref
= GetArgChunk();
1890 TexOutput(_T("<A HREF=\""));
1892 TraverseChildrenFromChunk(ref
);
1894 TexOutput(_T("\">"));
1896 TraverseChildrenFromChunk(helpRefText
);
1897 TexOutput(_T("</A>"));
1907 if (IsArgOptional())
1910 helpRefFilename
= GetArgChunk();
1913 if ((GetNoArgs() - arg_no
) == 1)
1916 helpRefText
= GetArgChunk();
1919 else if ((GetNoArgs() - arg_no
) == 0) // Arg = 2, or 3 if first is optional
1923 wxChar
*refName
= GetArgData();
1924 wxChar
*refFilename
= NULL
;
1928 TexRef
*texRef
= FindReference(refName
);
1931 if (texRef
->refFile
&& wxStrcmp(texRef
->refFile
, _T("??")) != 0)
1932 refFilename
= texRef
->refFile
;
1934 TexOutput(_T("<A HREF=\""));
1935 // If a filename is supplied, use it, otherwise try to
1936 // use the filename associated with the reference (from this document).
1937 if (helpRefFilename
)
1939 TraverseChildrenFromChunk(helpRefFilename
);
1942 else if (refFilename
)
1944 TexOutput(ConvertCase(refFilename
));
1948 TexOutput(_T("\">"));
1950 TraverseChildrenFromChunk(helpRefText
);
1951 TexOutput(_T("</A>"));
1956 TraverseChildrenFromChunk(helpRefText
);
1958 TexOutput(_T(" (REF NOT FOUND)"));
1960 errBuf
.Printf(_T("Warning: unresolved reference '%s'"), refName
);
1961 OnInform((wxChar
*)errBuf
.c_str());
1964 else TexOutput(_T("??"));
1979 wxChar
*alignment
= _T("");
1980 if (macroId
== ltIMAGEL
)
1981 alignment
= _T(" align=left");
1982 else if (macroId
== ltIMAGER
)
1983 alignment
= _T(" align=right");
1985 // Try to find an XBM or GIF image first.
1986 wxChar
*filename
= copystring(GetArgData());
1989 wxStrcpy(buf
, filename
);
1990 StripExtension(buf
);
1991 wxStrcat(buf
, _T(".xbm"));
1992 wxString f
= TexPathList
.FindValidPath(buf
);
1994 if (f
== _T("")) // Try for a GIF instead
1996 wxStrcpy(buf
, filename
);
1997 StripExtension(buf
);
1998 wxStrcat(buf
, _T(".gif"));
1999 f
= TexPathList
.FindValidPath(buf
);
2002 if (f
== _T("")) // Try for a JPEG instead
2004 wxStrcpy(buf
, filename
);
2005 StripExtension(buf
);
2006 wxStrcat(buf
, _T(".jpg"));
2007 f
= TexPathList
.FindValidPath(buf
);
2010 if (f
== _T("")) // Try for a PNG instead
2012 wxStrcpy(buf
, filename
);
2013 StripExtension(buf
);
2014 wxStrcat(buf
, _T(".png"));
2015 f
= TexPathList
.FindValidPath(buf
);
2020 wxChar
*inlineFilename
= copystring(f
);
2022 wxChar
*originalFilename
= TexPathList
.FindValidPath(filename
);
2023 // If we have found the existing filename, make the inline
2024 // image point to the original file (could be PS, for example)
2025 if (originalFilename
&& (wxStrcmp(inlineFilename
, originalFilename
) != 0))
2027 TexOutput(_T("<A HREF=\""));
2028 TexOutput(ConvertCase(originalFilename
));
2029 TexOutput(_T("\">"));
2030 TexOutput(_T("<img src=\""));
2031 TexOutput(ConvertCase(wxFileNameFromPath(inlineFilename
)));
2032 TexOutput(_T("\""));
2033 TexOutput(alignment
);
2034 TexOutput(_T("></A>"));
2039 TexOutput(_T("<img src=\""));
2040 TexOutput(ConvertCase(wxFileNameFromPath(inlineFilename
)));
2041 TexOutput(_T("\""));
2042 TexOutput(alignment
);
2044 delete[] inlineFilename
;
2049 // Last resort - a link to a PS file.
2050 TexOutput(_T("<A HREF=\""));
2051 TexOutput(ConvertCase(wxFileNameFromPath(filename
)));
2052 TexOutput(_T("\">Picture</A>\n"));
2053 wxSprintf(buf
, _T("Warning: could not find an inline XBM/GIF for %s."), filename
);
2060 // First arg is PSBOX spec (ignored), second is image file, third is map name.
2063 static wxChar
*imageFile
= NULL
;
2064 if (start
&& (arg_no
== 2))
2066 // Try to find an XBM or GIF image first.
2067 wxChar
*filename
= copystring(GetArgData());
2070 wxStrcpy(buf
, filename
);
2071 StripExtension(buf
);
2072 wxStrcat(buf
, _T(".xbm"));
2073 wxString f
= TexPathList
.FindValidPath(buf
);
2075 if (f
== _T("")) // Try for a GIF instead
2077 wxStrcpy(buf
, filename
);
2078 StripExtension(buf
);
2079 wxStrcat(buf
, _T(".gif"));
2080 f
= TexPathList
.FindValidPath(buf
);
2085 wxSprintf(buf
, _T("Warning: could not find an inline XBM/GIF for %s."), filename
);
2094 imageFile
= copystring(f
);
2097 else if (start
&& (arg_no
== 3))
2101 // First, try to find a .shg (segmented hypergraphics file)
2102 // that we can convert to a map file
2104 wxStrcpy(buf
, imageFile
);
2105 StripExtension(buf
);
2106 wxStrcat(buf
, _T(".shg"));
2107 wxString f
= TexPathList
.FindValidPath(buf
);
2111 // The default HTML file to go to is THIS file (so a no-op)
2112 SHGToMap((wxChar
*)f
.c_str(), currentFileName
);
2115 wxChar
*mapName
= GetArgData();
2116 TexOutput(_T("<A HREF=\"/cgi-bin/imagemap/"));
2120 TexOutput(_T("unknown"));
2121 TexOutput(_T("\">"));
2122 TexOutput(_T("<img src=\""));
2123 TexOutput(ConvertCase(wxFileNameFromPath(imageFile
)));
2124 TexOutput(_T("\" ISMAP></A><P>"));
2144 descriptionItemArg
= GetArgChunk();
2150 case ltTWOCOLITEMRULED
:
2153 if (start && (arg_no == 1))
2154 TexOutput(_T("\n<DT> "));
2155 if (start && (arg_no == 2))
2156 TexOutput(_T("<DD> "));
2162 if (TwoColWidthA
> -1) {
2164 wxSprintf(buf
,_T("\n<TR><TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthA
);
2167 TexOutput(_T("\n<TR><TD VALIGN=TOP>\n"));
2170 TexOutput(_T("\n</FONT></TD>\n"));
2176 if (TwoColWidthB
> -1) {
2178 wxSprintf(buf
,_T("\n<TD VALIGN=TOP WIDTH=%d>\n"),TwoColWidthB
);
2181 TexOutput(_T("\n<TD VALIGN=TOP>\n"));
2184 TexOutput(_T("\n</FONT></TD></TR>\n"));
2188 case ltNUMBEREDBIBITEM
:
2190 if (arg_no
== 1 && start
)
2192 TexOutput(_T("\n<DT> "));
2194 if (arg_no
== 2 && !start
)
2195 TexOutput(_T("<P>\n"));
2201 if (arg_no
== 1 && start
)
2203 wxChar
*citeKey
= GetArgData();
2204 TexRef
*ref
= (TexRef
*)TexReferences
.Get(citeKey
);
2207 if (ref
->sectionNumber
) delete[] ref
->sectionNumber
;
2208 wxSprintf(buf
, _T("[%d]"), citeCount
);
2209 ref
->sectionNumber
= copystring(buf
);
2212 wxSprintf(buf
, _T("\n<DT> [%d] "), citeCount
);
2217 if (arg_no
== 2 && !start
)
2218 TexOutput(_T("<P>\n"));
2222 case ltMARGINPARODD
:
2223 case ltMARGINPAREVEN
:
2229 TexOutput(_T("<HR>\n"));
2233 TexOutput(_T("<HR><P>\n"));
2237 case ltTWOCOLWIDTHA
:
2241 wxChar
*val
= GetArgData();
2242 float points
= ParseUnitArgument(val
);
2243 TwoColWidthA
= (int)((points
* 100.0) / 72.0);
2248 case ltTWOCOLWIDTHB
:
2252 wxChar
*val
= GetArgData();
2253 float points
= ParseUnitArgument(val
);
2254 TwoColWidthB
= (int)((points
* 100.0) / 72.0);
2262 case ltACCENT_GRAVE
:
2266 wxChar
*val
= GetArgData();
2272 TexOutput(_T("à"));
2275 TexOutput(_T("è"));
2278 TexOutput(_T("ì"));
2281 TexOutput(_T("ò"));
2284 TexOutput(_T("ù"));
2287 TexOutput(_T("À"));
2290 TexOutput(_T("È"));
2293 TexOutput(_T("Ì"));
2296 TexOutput(_T("Ò"));
2299 TexOutput(_T("Ì"));
2308 case ltACCENT_ACUTE
:
2312 wxChar
*val
= GetArgData();
2318 TexOutput(_T("á"));
2321 TexOutput(_T("é"));
2324 TexOutput(_T("í"));
2327 TexOutput(_T("ó"));
2330 TexOutput(_T("ú"));
2333 TexOutput(_T("ý"));
2336 TexOutput(_T("Á"));
2339 TexOutput(_T("É"));
2342 TexOutput(_T("Í"));
2345 TexOutput(_T("Ó"));
2348 TexOutput(_T("Ú"));
2351 TexOutput(_T("Ý"));
2360 case ltACCENT_CARET
:
2364 wxChar
*val
= GetArgData();
2370 TexOutput(_T("â"));
2373 TexOutput(_T("ê"));
2376 TexOutput(_T("î"));
2379 TexOutput(_T("ô"));
2382 TexOutput(_T("û"));
2385 TexOutput(_T("Â"));
2388 TexOutput(_T("Ê"));
2391 TexOutput(_T("Î"));
2394 TexOutput(_T("Ô"));
2397 TexOutput(_T("Î"));
2406 case ltACCENT_TILDE
:
2410 wxChar
*val
= GetArgData();
2419 TexOutput(_T("ã"));
2422 TexOutput(_T("ñ"));
2425 TexOutput(_T("õ"));
2428 TexOutput(_T("Ã"));
2431 TexOutput(_T("Ñ"));
2434 TexOutput(_T("Õ"));
2443 case ltACCENT_UMLAUT
:
2447 wxChar
*val
= GetArgData();
2453 TexOutput(_T("ä"));
2456 TexOutput(_T("ë"));
2459 TexOutput(_T("ï"));
2462 TexOutput(_T("ö"));
2465 TexOutput(_T("ü"));
2468 TexOutput(_T("ÿ"));
2471 TexOutput(_T("Ä"));
2474 TexOutput(_T("Ë"));
2477 TexOutput(_T("Ï"));
2480 TexOutput(_T("Ö"));
2483 TexOutput(_T("Ü"));
2486 TexOutput(_T("Ÿ"));
2499 wxChar
*val
= GetArgData();
2505 TexOutput(_T("å"));
2508 TexOutput(_T("Å"));
2521 wxChar
*val
= GetArgData();
2524 bool isPicture
= FALSE
;
2525 ParseColourString(val
, &isPicture
);
2528 if (backgroundImageString
)
2529 delete[] backgroundImageString
;
2530 backgroundImageString
= copystring(val
);
2534 if (backgroundColourString
)
2535 delete[] backgroundColourString
;
2536 backgroundColourString
= copystring(val
);
2542 case ltBACKGROUNDIMAGE
:
2546 wxChar
*val
= GetArgData();
2549 if (backgroundImageString
)
2550 delete[] backgroundImageString
;
2551 backgroundImageString
= copystring(val
);
2556 case ltBACKGROUNDCOLOUR
:
2560 wxChar
*val
= GetArgData();
2563 if (backgroundColourString
)
2564 delete[] backgroundColourString
;
2565 backgroundColourString
= copystring(val
);
2574 wxChar
*val
= GetArgData();
2577 if (textColourString
)
2578 delete[] textColourString
;
2579 textColourString
= copystring(val
);
2588 wxChar
*val
= GetArgData();
2591 if (linkColourString
)
2592 delete[] linkColourString
;
2593 linkColourString
= copystring(val
);
2598 case ltFOLLOWEDLINKCOLOUR
:
2602 wxChar
*val
= GetArgData();
2605 if (followedLinkColourString
)
2606 delete[] followedLinkColourString
;
2607 followedLinkColourString
= copystring(val
);
2612 case ltACCENT_CADILLA
:
2616 wxChar
*val
= GetArgData();
2622 TexOutput(_T("ç"));
2625 TexOutput(_T("Ç"));
2636 case ltFOOTNOTEPOPUP:
2646 case ltSUPERTABULAR
:
2652 currentRowNumber
= 0;
2655 tableVerticalLineLeft
= FALSE
;
2656 tableVerticalLineRight
= FALSE
;
2658 wxChar
*alignString
= copystring(GetArgData());
2659 ParseTableArgument(alignString
);
2661 TexOutput(_T("<TABLE BORDER>\n"));
2663 // Write the first row formatting for compatibility
2664 // with standard Latex
2665 if (compatibilityMode
)
2667 TexOutput(_T("<TR>\n<TD>"));
2670 for (int i = 0; i < noColumns; i++)
2672 currentWidth += TableData[i].width;
2673 wxSprintf(buf, _T("\\cellx%d"), currentWidth);
2676 TexOutput(_T("\\pard\\intbl\n"));
2679 delete[] alignString
;
2684 else if (arg_no
== 2 && !start
)
2686 TexOutput(_T("</TABLE>\n"));
2691 case ltTHEBIBLIOGRAPHY
:
2693 if (start
&& (arg_no
== 1))
2695 ReopenFile(&Chapters
, &ChaptersName
);
2696 AddTexRef(_T("bibliography"), ChaptersName
, _T("bibliography"));
2697 SetCurrentSubsectionName(_T("bibliography"), ChaptersName
);
2701 SetCurrentOutput(Chapters
);
2703 wxChar titleBuf
[150];
2704 if (truncateFilenames
)
2705 wxSprintf(titleBuf
, _T("%s.htm"), wxFileNameFromPath(FileRoot
));
2707 wxSprintf(titleBuf
, _T("%s_contents.html"), wxFileNameFromPath(FileRoot
));
2710 TexOutput(_T("<title>"));
2711 TexOutput(ReferencesNameString
);
2712 TexOutput(_T("</title></head>\n"));
2715 wxFprintf(Chapters
, _T("<A NAME=\"%s\">\n<H2>%s"), _T("bibliography"), ReferencesNameString
);
2716 AddBrowseButtons(_T("contents"), titleBuf
, // Up
2717 lastTopic
, lastFileName
, // Last topic
2718 _T("bibliography"), ChaptersName
); // This topic
2720 SetCurrentOutputs(Contents
, Chapters
);
2721 wxFprintf(Contents
, _T("\n<LI><A HREF=\"%s#%s\">"), ConvertCase(ChaptersName
), "bibliography");
2723 wxFprintf(Contents
, _T("%s</A>\n"), ReferencesNameString
);
2724 wxFprintf(Chapters
, _T("</H2>\n</A>\n"));
2726 SetCurrentOutput(Chapters
);
2729 if (!start
&& (arg_no
== 2))
2736 /* Build up list of keywords associated with topics */
2739 // wxChar *entry = GetArgData();
2741 OutputChunkToString(GetArgChunk(), buf
);
2744 AddKeyWordForTopic(CurrentTopic
, buf
, currentFileName
);
2758 wxChar
*name
= GetArgData();
2760 if (!FindColourHTMLString(name
, buf2
))
2762 wxStrcpy(buf2
, _T("#000000"));
2764 wxSprintf(buf
, _T("Could not find colour name %s"), name
);
2767 TexOutput(_T("<FONT COLOR=\""));
2769 TexOutput(_T("\">"));
2782 if (arg_no
== 2) TexOutput(_T("</FONT>"));
2786 case ltINSERTATLEVEL
:
2788 // This macro allows you to insert text at a different level
2789 // from the current level, e.g. into the Sections from within a subsubsection.
2792 static int currentLevelNo
= 1;
2793 static FILE* oldLevelFile
= Chapters
;
2800 oldLevelFile
= CurrentOutput1
;
2802 wxChar
*str
= GetArgData();
2803 currentLevelNo
= wxAtoi(str
);
2805 // TODO: cope with article style (no chapters)
2806 switch (currentLevelNo
)
2810 outputFile
= Chapters
;
2815 outputFile
= Sections
;
2820 outputFile
= Subsections
;
2825 outputFile
= Subsubsections
;
2835 CurrentOutput1
= outputFile
;
2851 CurrentOutput1
= oldLevelFile
;
2857 return DefaultOnArgument(macroId
, arg_no
, start
);
2869 tableVerticalLineLeft
= FALSE
;
2870 tableVerticalLineRight
= FALSE
;
2873 if (InputFile
&& OutputFile
)
2875 // Do some HTML-specific transformations on all the strings,
2877 Text2HTML(GetTopLevelChunk());
2880 if (truncateFilenames
)
2881 wxSprintf(buf
, _T("%s.htm"), FileRoot
);
2883 wxSprintf(buf
, _T("%s_contents.html"), FileRoot
);
2884 if (TitlepageName
) delete[] TitlepageName
;
2885 TitlepageName
= copystring(buf
);
2886 Titlepage
= wxFopen(buf
, _T("w"));
2888 if (truncateFilenames
)
2889 wxSprintf(buf
, _T("%s_fc.htm"), FileRoot
);
2891 wxSprintf(buf
, _T("%s_fcontents.html"), FileRoot
);
2893 contentsFrameName
= copystring(buf
);
2895 Contents
= wxFopen(TmpContentsName
, _T("w"));
2897 if (htmlFrameContents
)
2899 // FrameContents = wxFopen(TmpFrameContentsName, _T("w"));
2900 FrameContents
= wxFopen(contentsFrameName
, _T("w"));
2901 wxFprintf(FrameContents
, _T("<HTML>\n<UL>\n"));
2904 if (!Titlepage
|| !Contents
)
2906 OnError(_T("Cannot open output file!"));
2909 AddTexRef(_T("contents"), wxFileNameFromPath(TitlepageName
), ContentsNameString
);
2911 wxFprintf(Contents
, _T("<P><P><H2>%s</H2><P><P>\n"), ContentsNameString
);
2913 wxFprintf(Contents
, _T("<UL>\n"));
2915 SetCurrentOutput(Titlepage
);
2916 if (htmlWorkshopFiles
) HTMLWorkshopStartContents();
2917 OnInform(_T("Converting..."));
2920 wxFprintf(Contents
, _T("</UL>\n\n"));
2922 // SetCurrentOutput(Titlepage);
2927 // wxFprintf(Titlepage, _T("\n</BODY></HTML>\n"));
2934 wxFprintf(FrameContents
, _T("\n</UL>\n"));
2935 wxFprintf(FrameContents
, _T("</HTML>\n"));
2936 fclose(FrameContents
);
2937 FrameContents
= NULL
;
2942 wxFprintf(Chapters
, _T("\n</FONT></BODY></HTML>\n"));
2948 wxFprintf(Sections
, _T("\n</FONT></BODY></HTML>\n"));
2952 if (Subsections
&& !combineSubSections
)
2954 wxFprintf(Subsections
, _T("\n</FONT></BODY></HTML>\n"));
2955 fclose(Subsections
);
2958 if (Subsubsections
&& !combineSubSections
)
2960 wxFprintf(Subsubsections
, _T("\n</FONT></BODY></HTML>\n"));
2961 fclose(Subsubsections
);
2962 Subsubsections
= NULL
;
2964 if ( SectionContentsFD
)
2966 fclose(SectionContentsFD
);
2967 SectionContentsFD
= NULL
;
2970 // Create a temporary file for the title page header, add some info,
2971 // and concat the titlepage just generated.
2972 // This is necessary in order to put the title of the document
2973 // at the TOP of the file within <HEAD>, even though we only find out
2974 // what it is later on.
2975 FILE *tmpTitle
= wxFopen(_T("title.tmp"), _T("w"));
2980 SetCurrentOutput(tmpTitle
);
2982 TexOutput(_T("\n<HEAD><TITLE>"));
2983 TraverseChildrenFromChunk(DocumentTitle
);
2984 TexOutput(_T("</TITLE></HEAD>\n"));
2988 SetCurrentOutput(tmpTitle
);
2989 HTMLHeadTo(tmpTitle
);
2991 wxFprintf(tmpTitle
, _T("<TITLE>%s</TITLE></HEAD>\n\n"), contentsString
);
2993 wxFprintf(tmpTitle
, _T("<TITLE>%s</TITLE></HEAD>\n\n"), wxFileNameFromPath(FileRoot
));
2996 // Output frame information
2997 if (htmlFrameContents
)
2999 wxChar firstFileName
[300];
3000 if (truncateFilenames
)
3001 wxSprintf(firstFileName
, _T("%s1.htm"), FileRoot
);
3003 wxSprintf(firstFileName
, _T("%s1.html"), FileRoot
);
3005 wxFprintf(tmpTitle
, _T("<FRAMESET COLS=\"30%%,70%%\">\n"));
3007 wxFprintf(tmpTitle
, _T("<FRAME SRC=\"%s\">\n"), ConvertCase(wxFileNameFromPath(contentsFrameName
)));
3008 wxFprintf(tmpTitle
, _T("<FRAME SRC=\"%s\" NAME=\"mainwindow\">\n"), ConvertCase(wxFileNameFromPath(firstFileName
)));
3009 wxFprintf(tmpTitle
, _T("</FRAMESET>\n"));
3011 wxFprintf(tmpTitle
, _T("<NOFRAMES>\n"));
3014 // Output <BODY...> to temporary title page
3018 FILE *fd
= wxFopen(TitlepageName
, _T("r"));
3030 wxFprintf(tmpTitle
, _T("\n</FONT></BODY>\n"));
3032 if (htmlFrameContents
)
3034 wxFprintf(tmpTitle
, _T("\n</NOFRAMES>\n"));
3036 wxFprintf(tmpTitle
, _T("\n</HTML>\n"));
3039 if (wxFileExists(TitlepageName
)) wxRemoveFile(TitlepageName
);
3040 if (!wxRenameFile(_T("title.tmp"), TitlepageName
))
3042 wxCopyFile(_T("title.tmp"), TitlepageName
);
3043 wxRemoveFile(_T("title.tmp"));
3047 if (lastFileName
) delete[] lastFileName
;
3048 lastFileName
= NULL
;
3049 if (lastTopic
) delete[] lastTopic
;
3052 if (wxFileExists(ContentsName
)) wxRemoveFile(ContentsName
);
3054 if (!wxRenameFile(TmpContentsName
, ContentsName
))
3056 wxCopyFile(TmpContentsName
, ContentsName
);
3057 wxRemoveFile(TmpContentsName
);
3060 // Generate .htx file if requested
3063 wxChar htmlIndexName
[300];
3064 wxSprintf(htmlIndexName
, _T("%s.htx"), FileRoot
);
3065 GenerateHTMLIndexFile(htmlIndexName
);
3068 // Generate HTML Help Workshop files if requested
3069 if (htmlWorkshopFiles
)
3071 HTMLWorkshopEndContents();
3072 GenerateHTMLWorkshopFiles(FileRoot
);
3082 // Output .htx index file
3083 void GenerateHTMLIndexFile(wxChar
*fname
)
3085 FILE *fd
= wxFopen(fname
, _T("w"));
3089 TopicTable
.BeginFind();
3090 wxNode
*node
= TopicTable
.Next();
3093 TexTopic
*texTopic
= (TexTopic
*)node
->GetData();
3094 const wxChar
*topicName
= node
->GetKeyString();
3095 if (texTopic
->filename
&& texTopic
->keywords
)
3097 wxStringListNode
*node1
= texTopic
->keywords
->GetFirst();
3100 wxChar
*s
= (wxChar
*)node1
->GetData();
3101 wxFprintf(fd
, _T("%s|%s|%s\n"), topicName
, texTopic
->filename
, s
);
3102 node1
= node1
->GetNext();
3105 node
= TopicTable
.Next();
3116 // output .hpp, .hhc and .hhk files:
3119 void GenerateHTMLWorkshopFiles(wxChar
*fname
)
3124 /* Generate project file : */
3126 wxSprintf(buf
, _T("%s.hhp"), fname
);
3127 f
= wxFopen(buf
, _T("wt"));
3130 _T("Compatibility=1.1\n")
3131 _T("Full-text search=Yes\n")
3132 _T("Contents file=%s.hhc\n")
3133 _T("Compiled file=%s.chm\n")
3134 _T("Default Window=%sHelp\n")
3135 _T("Default topic=%s\n")
3136 _T("Index file=%s.hhk\n")
3138 wxFileNameFromPath(fname
),
3139 wxFileNameFromPath(fname
),
3140 wxFileNameFromPath(fname
),
3141 wxFileNameFromPath(TitlepageName
),
3142 wxFileNameFromPath(fname
)
3145 if (DocumentTitle
) {
3146 SetCurrentOutput(f
);
3147 TraverseChildrenFromChunk(DocumentTitle
);
3149 else wxFprintf(f
, _T("(unknown)"));
3151 wxFprintf(f
, _T("\n\n[WINDOWS]\n")
3152 _T("%sHelp=,\"%s.hhc\",\"%s.hhk\",\"%s\",,,,,,0x2420,,0x380e,,,,,0,,,"),
3153 wxFileNameFromPath(fname
),
3154 wxFileNameFromPath(fname
),
3155 wxFileNameFromPath(fname
),
3156 wxFileNameFromPath(TitlepageName
));
3159 wxFprintf(f
, _T("\n\n[FILES]\n"));
3160 wxFprintf(f
, _T("%s\n"), wxFileNameFromPath(TitlepageName
));
3161 for (int i
= 1; i
<= fileId
; i
++) {
3162 if (truncateFilenames
)
3163 wxSprintf(buf
, _T("%s%d.htm"), wxFileNameFromPath(FileRoot
), i
);
3165 wxSprintf(buf
, _T("%s%d.html"), wxFileNameFromPath(FileRoot
), i
);
3166 wxFprintf(f
, _T("%s\n"), buf
);
3170 /* Generate index file : */
3172 wxSprintf(buf
, _T("%s.hhk"), fname
);
3173 f
= wxFopen(buf
, _T("wt"));
3176 _T("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
3181 _T("<meta name=\"GENERATOR\" content=\"tex2rtf\">\n")
3182 _T("<!-- Sitemap 1.0 -->\n")
3183 _T("</HEAD><BODY>\n")
3184 _T("<OBJECT type=\"text/site properties\">\n")
3185 _T(" <param name=\"ImageType\" value=\"Folder\">\n")
3189 TopicTable
.BeginFind();
3190 wxNode
*node
= TopicTable
.Next();
3193 TexTopic
*texTopic
= (TexTopic
*)node
->GetData();
3194 const wxChar
*topicName
= node
->GetKeyString();
3195 if (texTopic
->filename
&& texTopic
->keywords
)
3197 wxStringListNode
*node1
= texTopic
->keywords
->GetFirst();
3200 wxChar
*s
= (wxChar
*)node1
->GetData();
3202 _T(" <LI> <OBJECT type=\"text/sitemap\">\n")
3203 _T(" <param name=\"Local\" value=\"%s#%s\">\n")
3204 _T(" <param name=\"Name\" value=\"%s\">\n")
3206 texTopic
->filename
, topicName
, s
);
3207 node1
= node1
->GetNext();
3210 node
= TopicTable
.Next();
3213 wxFprintf(f
, _T("</UL>\n"));
3219 static FILE *HTMLWorkshopContents
= NULL
;
3220 static int HTMLWorkshopLastLevel
= 0;
3222 void HTMLWorkshopAddToContents(int level
, wxChar
*s
, wxChar
*file
)
3226 if (level
> HTMLWorkshopLastLevel
)
3227 for (i
= HTMLWorkshopLastLevel
; i
< level
; i
++)
3228 wxFprintf(HTMLWorkshopContents
, _T("<UL>"));
3229 if (level
< HTMLWorkshopLastLevel
)
3230 for (i
= level
; i
< HTMLWorkshopLastLevel
; i
++)
3231 wxFprintf(HTMLWorkshopContents
, _T("</UL>"));
3233 SetCurrentOutput(HTMLWorkshopContents
);
3234 wxFprintf(HTMLWorkshopContents
,
3235 _T(" <LI> <OBJECT type=\"text/sitemap\">\n")
3236 _T(" <param name=\"Local\" value=\"%s#%s\">\n")
3237 _T(" <param name=\"Name\" value=\""),
3239 OutputCurrentSection();
3240 wxFprintf(HTMLWorkshopContents
,
3242 _T(" </OBJECT>\n"));
3243 HTMLWorkshopLastLevel
= level
;
3247 void HTMLWorkshopStartContents()
3250 wxSprintf(buf
, _T("%s.hhc"), FileRoot
);
3251 HTMLWorkshopContents
= wxFopen(buf
, _T("wt"));
3252 HTMLWorkshopLastLevel
= 0;
3254 wxFprintf(HTMLWorkshopContents
,
3255 _T("<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n")
3257 HTMLHeadTo(HTMLWorkshopContents
);
3258 wxFprintf(HTMLWorkshopContents
,
3260 _T("<meta name=\"GENERATOR\" content=\"tex2rtf\">\n")
3261 _T("<!-- Sitemap 1.0 -->\n")
3262 _T("</HEAD><BODY>\n")
3263 _T("<OBJECT type=\"text/site properties\">\n")
3264 _T(" <param name=\"ImageType\" value=\"Folder\">\n")
3267 _T("<LI> <OBJECT type=\"text/sitemap\">\n")
3268 _T("<param name=\"Local\" value=\"%s\">\n")
3269 _T("<param name=\"Name\" value=\"Contents\">\n</OBJECT>\n"),
3270 wxFileNameFromPath(TitlepageName
)
3276 void HTMLWorkshopEndContents()
3278 for (int i
= HTMLWorkshopLastLevel
; i
>= 0; i
--)
3279 wxFprintf(HTMLWorkshopContents
, _T("</UL>\n"));
3280 fclose(HTMLWorkshopContents
);