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:
@@ -652,6 +652,24 @@ void OutputBodyStart(void)
|
|||||||
OutputFont();
|
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
|
// Called on start/end of macro examination
|
||||||
void HTMLOnMacro(int macroId, int no_args, bool start)
|
void HTMLOnMacro(int macroId, int no_args, bool start)
|
||||||
{
|
{
|
||||||
@@ -682,7 +700,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
|
|||||||
|
|
||||||
SetCurrentOutput(Chapters);
|
SetCurrentOutput(Chapters);
|
||||||
|
|
||||||
TexOutput("<head><title>");
|
HTMLHead();
|
||||||
|
TexOutput("<title>");
|
||||||
OutputCurrentSection(); // Repeat section header
|
OutputCurrentSection(); // Repeat section header
|
||||||
TexOutput("</title></head>\n");
|
TexOutput("</title></head>\n");
|
||||||
OutputBodyStart();
|
OutputBodyStart();
|
||||||
@@ -751,7 +770,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
|
|||||||
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(1, topicName, SectionsName);
|
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(1, topicName, SectionsName);
|
||||||
|
|
||||||
SetCurrentOutput(Sections);
|
SetCurrentOutput(Sections);
|
||||||
TexOutput("<head><title>");
|
HTMLHead();
|
||||||
|
TexOutput("<title>");
|
||||||
OutputCurrentSection();
|
OutputCurrentSection();
|
||||||
TexOutput("</title></head>\n");
|
TexOutput("</title></head>\n");
|
||||||
OutputBodyStart();
|
OutputBodyStart();
|
||||||
@@ -844,7 +864,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
|
|||||||
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName);
|
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(2, topicName, SubsectionsName);
|
||||||
SetCurrentOutput(Subsections);
|
SetCurrentOutput(Subsections);
|
||||||
|
|
||||||
TexOutput("<head><title>");
|
HTMLHead();
|
||||||
|
TexOutput("<title>");
|
||||||
OutputCurrentSection();
|
OutputCurrentSection();
|
||||||
TexOutput("</title></head>\n");
|
TexOutput("</title></head>\n");
|
||||||
OutputBodyStart();
|
OutputBodyStart();
|
||||||
@@ -924,7 +945,8 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
|
|||||||
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);
|
if (htmlWorkshopFiles) HTMLWorkshopAddToContents(3, topicName, SubsubsectionsName);
|
||||||
|
|
||||||
SetCurrentOutput(Subsubsections);
|
SetCurrentOutput(Subsubsections);
|
||||||
TexOutput("<head><title>");
|
HTMLHead();
|
||||||
|
TexOutput("<title>");
|
||||||
OutputCurrentSection();
|
OutputCurrentSection();
|
||||||
TexOutput("</title></head>\n");
|
TexOutput("</title></head>\n");
|
||||||
OutputBodyStart();
|
OutputBodyStart();
|
||||||
@@ -2690,7 +2712,8 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
|
|||||||
else
|
else
|
||||||
sprintf(titleBuf, "%s_contents.html", FileNameFromPath(FileRoot));
|
sprintf(titleBuf, "%s_contents.html", FileNameFromPath(FileRoot));
|
||||||
|
|
||||||
TexOutput("<head><title>");
|
HTMLHead();
|
||||||
|
TexOutput("<title>");
|
||||||
TexOutput(ReferencesNameString);
|
TexOutput(ReferencesNameString);
|
||||||
TexOutput("</title></head>\n");
|
TexOutput("</title></head>\n");
|
||||||
OutputBodyStart();
|
OutputBodyStart();
|
||||||
@@ -2968,17 +2991,19 @@ bool HTMLGo(void)
|
|||||||
if (DocumentTitle)
|
if (DocumentTitle)
|
||||||
{
|
{
|
||||||
SetCurrentOutput(tmpTitle);
|
SetCurrentOutput(tmpTitle);
|
||||||
TexOutput("\n<HTML>\n<HEAD><TITLE>");
|
HTMLHead();
|
||||||
|
TexOutput("\n<HEAD><TITLE>");
|
||||||
TraverseChildrenFromChunk(DocumentTitle);
|
TraverseChildrenFromChunk(DocumentTitle);
|
||||||
TexOutput("</TITLE></HEAD>\n");
|
TexOutput("</TITLE></HEAD>\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetCurrentOutput(tmpTitle);
|
SetCurrentOutput(tmpTitle);
|
||||||
|
HTMLHeadTo(tmpTitle);
|
||||||
if (contentsString)
|
if (contentsString)
|
||||||
fprintf(tmpTitle, "<HEAD><TITLE>%s</TITLE></HEAD>\n\n", contentsString);
|
fprintf(tmpTitle, "<TITLE>%s</TITLE></HEAD>\n\n", contentsString);
|
||||||
else
|
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
|
// Output frame information
|
||||||
@@ -3161,8 +3186,10 @@ void GenerateHTMLWorkshopFiles(char *fname)
|
|||||||
|
|
||||||
fprintf(f,
|
fprintf(f,
|
||||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
|
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
|
||||||
"<HTML>\n"
|
"<HTML>\n");
|
||||||
"<HEAD>\n"
|
HTMLHeadTo(f);
|
||||||
|
fprintf(f,
|
||||||
|
"\n"
|
||||||
"<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
|
"<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
|
||||||
"<!-- Sitemap 1.0 -->\n"
|
"<!-- Sitemap 1.0 -->\n"
|
||||||
"</HEAD><BODY>\n"
|
"</HEAD><BODY>\n"
|
||||||
@@ -3237,8 +3264,10 @@ void HTMLWorkshopStartContents()
|
|||||||
|
|
||||||
fprintf(HTMLWorkshopContents,
|
fprintf(HTMLWorkshopContents,
|
||||||
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
|
"<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
|
||||||
"<HTML>\n"
|
"<HTML>\n");
|
||||||
"<HEAD>\n"
|
HTMLHeadTo(HTMLWorkshopContents);
|
||||||
|
fprintf(HTMLWorkshopContents,
|
||||||
|
"\n"
|
||||||
"<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
|
"<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
|
||||||
"<!-- Sitemap 1.0 -->\n"
|
"<!-- Sitemap 1.0 -->\n"
|
||||||
"</HEAD><BODY>\n"
|
"</HEAD><BODY>\n"
|
||||||
|
@@ -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 winHelpContents = FALSE; // Generate .cnt file for WinHelp 4
|
||||||
bool htmlIndex = FALSE; // Generate .htx file for HTML
|
bool htmlIndex = FALSE; // Generate .htx file for HTML
|
||||||
bool htmlFrameContents = FALSE; // Use frames for HTML contents page
|
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 useHeadingStyles = TRUE; // Insert \s1, s2 etc.
|
||||||
bool useWord = TRUE; // Insert proper Word table of contents, etc etc
|
bool useWord = TRUE; // Insert proper Word table of contents, etc etc
|
||||||
int contentsDepth = 4; // Depth of Word table of contents
|
int contentsDepth = 4; // Depth of Word table of contents
|
||||||
|
@@ -240,6 +240,7 @@ extern int winHelpVersion; // Version e.g. 4 for Win95
|
|||||||
extern bool winHelpContents; // Generate .cnt file
|
extern bool winHelpContents; // Generate .cnt file
|
||||||
extern bool htmlIndex; // Generate .htx HTML index file
|
extern bool htmlIndex; // Generate .htx HTML index file
|
||||||
extern bool htmlFrameContents; // Use frames for HTML contents page
|
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 int contentsDepth; // Depth of contents for linear RTF files
|
||||||
extern bool upperCaseNames; // Filenames; default is lower case
|
extern bool upperCaseNames; // Filenames; default is lower case
|
||||||
extern char *backgroundImageString; // HTML background image
|
extern char *backgroundImageString; // HTML background image
|
||||||
|
@@ -1182,6 +1182,11 @@ char *RegisterSetting(char *settingName, char *settingValue, bool interactive)
|
|||||||
htmlWorkshopFiles = StringTobool(settingValue);
|
htmlWorkshopFiles = StringTobool(settingValue);
|
||||||
else if (StringMatch(settingName, "htmlFrameContents", FALSE, TRUE))
|
else if (StringMatch(settingName, "htmlFrameContents", FALSE, TRUE))
|
||||||
htmlFrameContents = StringTobool(settingValue);
|
htmlFrameContents = StringTobool(settingValue);
|
||||||
|
else if (StringMatch(settingName, "htmlStylesheet", FALSE, TRUE))
|
||||||
|
{
|
||||||
|
if (htmlStylesheet) delete[] htmlStylesheet;
|
||||||
|
htmlStylesheet = copystring(settingValue);
|
||||||
|
}
|
||||||
else if (StringMatch(settingName, "upperCaseNames", FALSE, TRUE))
|
else if (StringMatch(settingName, "upperCaseNames", FALSE, TRUE))
|
||||||
upperCaseNames = StringTobool(settingValue);
|
upperCaseNames = StringTobool(settingValue);
|
||||||
else if (StringMatch(settingName, "ignoreBadRefs", FALSE, TRUE))
|
else if (StringMatch(settingName, "ignoreBadRefs", FALSE, TRUE))
|
||||||
|
Reference in New Issue
Block a user