summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/info2html/html.c34
-rw-r--r--src/info2html/html.h1
-rw-r--r--src/info2html/main.c16
-rw-r--r--src/info2html/parse.c10
-rw-r--r--src/info2html/utils.c2
5 files changed, 39 insertions, 24 deletions
diff --git a/src/info2html/html.c b/src/info2html/html.c
index f57f5d01..90c2e2fb 100644
--- a/src/info2html/html.c
+++ b/src/info2html/html.c
@@ -19,16 +19,25 @@
#define USE_FILE_URLS
char *BaseFilename=NULL;
+char *OverrideBaseFilename=NULL;
/* print out the url for a info file */
char *form_info_tag_href( char *nodefile, char *nodename )
{
char tmp[1024];
char *escaped_nodename;
+ char *filename;
escaped_nodename = escape_html_chars( nodename );
- snprintf(tmp,sizeof(tmp),"HREF=\"info:%s#%s\"",
- ((BaseFilename) ? BaseFilename : nodefile), escaped_nodename );
+ if (!strcmp(BaseFilename, nodefile))
+ if (OverrideBaseFilename)
+ filename = OverrideBaseFilename;
+ else
+ filename = BaseFilename;
+ else
+ filename = nodefile;
+
+ snprintf(tmp,sizeof(tmp),"HREF=\"info:%s#%s\"", filename, escaped_nodename );
if (escaped_nodename)
g_free(escaped_nodename);
return g_strdup(tmp);
@@ -112,28 +121,17 @@ void write_node_link_html( FILE *f, char *nodefile, char *refname, char *ref )
char *converted_nodename;
char *href;
- if (ref)
- {
- if (strcasecmp(ref, "(dir)"))
- {
+ if (ref) {
+ if (strcasecmp(ref, "(dir)")) {
converted_nodename = g_strdup( ref );
map_spaces_to_underscores( converted_nodename );
href = form_info_tag_href(nodefile, converted_nodename);
fprintf(f,"<A %s>%s%s</A>\n", href, refname, ref);
g_free(href);
-#if 0
- fprintf(f,"<A HREF=\"../%s/%s.html\">%s%s</A>\n",
- nodefile, converted_nodename, refname, ref);
-#endif
g_free(converted_nodename);
- }
- else
- {
-#if 0
- fprintf(f,"<A HREF=\"../dir/Top.html\">%s(dir)</A>\n",refname);
-#endif
+ } else {
href = form_info_tag_href("dir", "Top");
- fprintf(f,"<A %s>%s(dir)</A>\n", href, refname);
+ fprintf(f,"<A %s>%s(dir)</A>\n",href, refname);
g_free(href);
}
@@ -545,6 +543,8 @@ void dump_html_for_node( NODE *node )
else if (body_open)
close_body_text_html( f );
+ /* put nav links at the bottom */
+ make_nav_links(f, node);
#if 0
fprintf(f,"</BODY>\n</HTML>\n");
#endif
diff --git a/src/info2html/html.h b/src/info2html/html.h
index 162829c8..3237b474 100644
--- a/src/info2html/html.h
+++ b/src/info2html/html.h
@@ -7,6 +7,7 @@
#define HEADER_SIZE_2 "H2"
extern char *BaseFilename;
+extern char *OverrideBaseFilename;
void dump_html_for_node( NODE *node );
diff --git a/src/info2html/main.c b/src/info2html/main.c
index f259f07a..a490a24b 100644
--- a/src/info2html/main.c
+++ b/src/info2html/main.c
@@ -21,6 +21,8 @@ main(int argc, char **argv)
int result;
int foundit=0;
+ char convanc[1024];
+
NODE *node;
if (!be_quiet)
@@ -46,16 +48,18 @@ main(int argc, char **argv)
*(t+1) = '\0';
+ /* convert anchor so matching works */
+ map_spaces_to_underscores(requested_nodename);
#ifdef DEBUG
fprintf(stderr, "outputting node %s\n",
requested_nodename);
#endif
aptr -= 2;
} else if (!strcmp(argv[argc-aptr+1], "-b")) {
- BaseFilename = strdup(argv[argc-aptr+2]);
+ OverrideBaseFilename = strdup(argv[argc-aptr+2]);
#ifdef DEBUG
fprintf(stderr, "outputting basefile %s\n",
- BaseFilename);
+ OverrideBaseFilename);
#endif
aptr -= 2;
}
@@ -116,8 +120,10 @@ main(int argc, char **argv)
}
/* see if this is the requested node name */
+ strncpy(convanc, node->nodename, sizeof(convanc));
+ map_spaces_to_underscores(convanc);
if (requested_nodename &&
- strcmp(requested_nodename, node->nodename)) {
+ strcmp(requested_nodename, convanc)) {
#ifdef DEBUG
fprintf(stderr, "skipping ->%s<-\n",
node->nodename);
@@ -128,7 +134,8 @@ main(int argc, char **argv)
foundit = 1;
strcpy(work_node,node->nodename);
-
+
+ BaseFilename = node->filename;
#ifdef DEBUG
printf("NEW NODE\n");
printf("\tFile:|%s|\n\tNode:|%s|\n\tNext:|%s|\n",
@@ -146,6 +153,7 @@ main(int argc, char **argv)
free(node->contents);
free(node);
+ BaseFilename = NULL;
}
}
else
diff --git a/src/info2html/parse.c b/src/info2html/parse.c
index fe960e76..67575c87 100644
--- a/src/info2html/parse.c
+++ b/src/info2html/parse.c
@@ -40,11 +40,14 @@ NODE *parse_node_line( NODE *node, char * line )
temp = line;
+ /* have trouble on (dir) file which has a slightly diferrent 'File:' line */
+ /* so currently we have a hack here */
if (!(result=parse_node_label( &temp, "File:", 0)))
return NULL;
node->filename = result;
- if (!(result=parse_node_label( &temp, "Node:", 1)))
+ /* don't allow_eof if we are looking at the 'dir' file, its a special case */
+ if (!(result=parse_node_label(&temp,"Node:",strcmp(node->filename, "dir"))))
return NULL;
node->nodename = result;
@@ -86,8 +89,11 @@ char *parse_node_label( char **line, char *label, int allow_eof )
if (end == NULL)
end = strstr( start, "\n" );
}
- else
+ else {
end = strstr( start, "," );
+ if (!end)
+ end = strstr( start, "\t" ); /* might help (dir) files */
+ }
if (end == NULL)
return NULL;
diff --git a/src/info2html/utils.c b/src/info2html/utils.c
index db0fd0b5..5de48791 100644
--- a/src/info2html/utils.c
+++ b/src/info2html/utils.c
@@ -241,7 +241,7 @@ void map_spaces_to_underscores( char *str )
case '\t':
case '`':
case '\'':
- case '/':
+ case '/':
case '\\':
case '"':
case '.':