added CSS stylesheets support to tex2rtf

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15363 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-05-04 10:50:48 +00:00
parent 2cf607649c
commit 6d8b260cc3
4 changed files with 48 additions and 12 deletions

View 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"

View 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

View 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

View 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))