");
+ for (index = 0; index < length; index++)
+ {
+ if (table[index].Line_type == '-')
+ continue;
+// if (table[index].Line_type != 'N') printf("%c %s\n", table[index].Line_type, table[index].Text);
+ if (table[index].Line_type == 'S')
+ fprintf(f, "
");
+ else if (table[index].Line_type == 'T' && !(index > 1 && table[index-2].Line_type == 'T'))
+ fprintf(f, "", hlevel);
+
+ if (table[index].Line_type == 'K')
+ {
+ char keytmp[64];
+ snprintf(keytmp, sizeof(keytmp), "%s", Keyboard_default_shortcut(table[index].Line_parameter));
+ fprintf(f, table[index].Text, keytmp);
+ }
+ else
+ {
+ const char * prefix = "";
+ char * link = strstr(table[index].Text, "http://");
+ if (link == NULL)
+ {
+ link = strstr(table[index].Text, "www.");
+ prefix = "http://";
+ }
+ if (link != NULL)
+ {
+ char * link_end = strchr(link, ' ');
+ if (link_end == NULL)
+ {
+ link_end = strchr(link, ')');
+ if (link_end == NULL)
+ link_end = link + strlen(link);
+ }
+ fprintf(f, "%.*s", (int)(link - table[index].Text), table[index].Text);
+ fprintf(f, "%.*s%s", prefix,
+ (int)(link_end - link), link, (int)(link_end - link), link, link_end);
+ }
+ else
+ {
+ // print the string and escape < and > characters
+ const char * text = table[index].Text;
+ while (text[0] != '\0')
+ {
+ size_t i = strcspn(text, "<>");
+ if (text[i] == '\0')
+ { // no character to escape
+ fprintf(f, "%s", text);
+ break;
+ }
+ if (i > 0)
+ fprintf(f, "%.*s", (int)i, text);
+ switch(text[i])
+ {
+ case '<':
+ fprintf(f, "<");
+ break;
+ case '>':
+ fprintf(f, ">");
+ break;
+ }
+ // continue with the remaining of the string
+ text += i + 1;
+ }
+ }
+ }
+
+ if (table[index].Line_type == 'S')
+ fprintf(f, "");
+ else if (table[index].Line_type == 'T')
+ {
+ if (index < length-2 && table[index+2].Line_type == 'T')
+ fprintf(f, " ");
+ else
+ {
+ fprintf(f, "", hlevel);
+ if (hlevel == 1)
+ hlevel++;
+ }
+ }
+ if (table[index].Line_type != 'T')
+ fprintf(f, "\n");
+ // fprintf(f, "
\n");
+ }
+ fprintf(f, "
");
+ fprintf(f, "\n");
+ fprintf(f, "\n");
+ return title;
+}
+
+///
+/// Export the help to HTML files
+static int Export_help(const char * path)
+{
+ FILE * f;
+ FILE * findex;
+ char filename[MAX_PATH_CHARACTERS];
+ unsigned int i;
+
+ snprintf(filename, sizeof(filename), "%s/index.html", path);
+ //GFX2_Log(GFX2_INFO, "Creating %s\n", filename);
+ findex = fopen(filename, "w");
+ if (findex == NULL)
+ {
+ fprintf(stderr, "Cannot save index HTML file %s\n", filename);
+ return -1;
+ }
+ fprintf(findex, "\n");
+ fprintf(findex, "\n");
+ fprintf(findex, "\n");
+ fprintf(findex, "