+
+
+
+
+
+
+
+// output .hpp, .hhc and .hhk files:
+
+
+void GenerateHTMLWorkshopFiles(char *fname)
+{
+ FILE *f;
+ char buf[300];
+
+ /* Generate project file : */
+
+ sprintf(buf, "%s.hhp", fname);
+ f = fopen(buf, "wt");
+ fprintf(f,
+ "[OPTIONS]\n"
+ "Compatibility=1.1\n"
+ "Full-text search=Yes\n"
+ "Contents file=%s.hhc\n"
+ "Compiled file=%s.chm\n"
+ "Default Window=%sHelp\n"
+ "Default topic=%s\n"
+ "Index file=%s.hhk\n"
+ "Title=",
+ FileNameFromPath(fname),
+ FileNameFromPath(fname),
+ FileNameFromPath(fname),
+ FileNameFromPath(TitlepageName),
+ FileNameFromPath(fname)
+ );
+
+ if (DocumentTitle) {
+ SetCurrentOutput(f);
+ TraverseChildrenFromChunk(DocumentTitle);
+ }
+ else fprintf(f, "(unknown)");
+
+ fprintf(f, "\n\n[WINDOWS]\n"
+ "%sHelp=,\"%s.hhc\",\"%s.hhk\",\"%s\",,,,,,0x2420,,0x380e,,,,,0,,,",
+ FileNameFromPath(fname),
+ FileNameFromPath(fname),
+ FileNameFromPath(fname),
+ FileNameFromPath(TitlepageName));
+
+
+ fprintf(f, "\n\n[FILES]\n");
+ fprintf(f, "%s\n", FileNameFromPath(TitlepageName));
+ for (int i = 1; i <= fileId; i++) {
+ if (truncateFilenames)
+ sprintf(buf, "%s%d.htm", FileNameFromPath(FileRoot), i);
+ else
+ sprintf(buf, "%s%d.html", FileNameFromPath(FileRoot), i);
+ fprintf(f, "%s\n", buf);
+ }
+ fclose(f);
+
+ /* Generate index file : */
+
+ sprintf(buf, "%s.hhk", fname);
+ f = fopen(buf, "wt");
+
+ fprintf(f,
+ "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
+ "<HTML>\n"
+ "<HEAD>\n"
+ "<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
+ "<!-- Sitemap 1.0 -->\n"
+ "</HEAD><BODY>\n"
+ "<OBJECT type=\"text/site properties\">\n"
+ " <param name=\"ImageType\" value=\"Folder\">\n"
+ "</OBJECT>\n"
+ "<UL>\n");
+
+ TopicTable.BeginFind();
+ wxNode *node = NULL;
+ while ((node = TopicTable.Next()))
+ {
+ TexTopic *texTopic = (TexTopic *)node->Data();
+ const char *topicName = node->GetKeyString();
+ if (texTopic->filename && texTopic->keywords)
+ {
+ wxNode *node1 = texTopic->keywords->First();
+ while (node1)
+ {
+ char *s = (char *)node1->Data();
+ fprintf(f,
+ " <LI> <OBJECT type=\"text/sitemap\">\n"
+ " <param name=\"Local\" value=\"%s#%s\">\n"
+ " <param name=\"Name\" value=\"%s\">\n"
+ " </OBJECT>\n",
+ texTopic->filename, topicName, s);
+ node1 = node1->Next();
+ }
+ }
+ }
+
+ fprintf(f, "</UL>\n");
+ fclose(f);
+}
+
+
+
+static FILE *HTMLWorkshopContents = NULL;
+static int HTMLWorkshopLastLevel = 0;
+
+void HTMLWorkshopAddToContents(int level, char *s, char *file)
+{
+ int i;
+
+ if (level > HTMLWorkshopLastLevel)
+ for (i = HTMLWorkshopLastLevel; i < level; i++)
+ fprintf(HTMLWorkshopContents, "<UL>");
+ if (level < HTMLWorkshopLastLevel)
+ for (i = level; i < HTMLWorkshopLastLevel; i++)
+ fprintf(HTMLWorkshopContents, "</UL>");
+
+ SetCurrentOutput(HTMLWorkshopContents);
+ fprintf(HTMLWorkshopContents,
+ " <LI> <OBJECT type=\"text/sitemap\">\n"
+ " <param name=\"Local\" value=\"%s#%s\">\n"
+ " <param name=\"Name\" value=\"",
+ file, s);
+ OutputCurrentSection();
+ fprintf(HTMLWorkshopContents,
+ "\">\n"
+ " </OBJECT>\n");
+ HTMLWorkshopLastLevel = level;
+}
+
+
+void HTMLWorkshopStartContents()
+{
+ char buf[300];
+ sprintf(buf, "%s.hhc", FileRoot);
+ HTMLWorkshopContents = fopen(buf, "wt");
+ HTMLWorkshopLastLevel = 0;
+
+ fprintf(HTMLWorkshopContents,
+ "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML//EN\">\n"
+ "<HTML>\n"
+ "<HEAD>\n"
+ "<meta name=\"GENERATOR\" content=\"tex2rtf\">\n"
+ "<!-- Sitemap 1.0 -->\n"
+ "</HEAD><BODY>\n"
+ "<OBJECT type=\"text/site properties\">\n"
+ " <param name=\"ImageType\" value=\"Folder\">\n"
+ "</OBJECT>\n"
+ "<UL>\n"
+ "<LI> <OBJECT type=\"text/sitemap\">\n"
+ "<param name=\"Local\" value=\"%s\">\n"
+ "<param name=\"Name\" value=\"Contents\">\n</OBJECT>\n",
+ FileNameFromPath(TitlepageName)
+ );
+
+}
+
+
+void HTMLWorkshopEndContents()
+{
+ for (int i = HTMLWorkshopLastLevel; i >= 0; i--)
+ fprintf(HTMLWorkshopContents, "</UL>\n");
+ fclose(HTMLWorkshopContents);
+}