Halibut: Remove filename for self relative links in htmlsingle mode

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6193 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2011-12-03 19:50:02 +00:00
parent bd797ad934
commit 33770dcd4f

View file

@ -910,7 +910,7 @@ static void xhtml_do_index_body(FILE * fp)
if (sect) if (sect)
{ {
char fragmentbuf[NAMEDFRAGMENT_MAXLEN]; char fragmentbuf[NAMEDFRAGMENT_MAXLEN];
fprintf(fp, "<a href='%s#%s'>", sect->file->filename, fprintf(fp, "<a href='%s#%s'>", conf.leaf_level ? sect->file->filename : "",
xhtml_get_fragmentname(sect, fragmentbuf)); xhtml_get_fragmentname(sect, fragmentbuf));
if (sect->para->kwtext) if (sect->para->kwtext)
{ {
@ -1227,7 +1227,7 @@ xhtml_do_contents_section_limit(FILE * fp, xhtmlsection * section, int limit)
static int static int
xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit) xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit)
{ {
char fragmentbuf[NAMEDFRAGMENT_MAXLEN], *fragment; char fragmentbuf[NAMEDFRAGMENT_MAXLEN], *fragment, *filename;
if (!section || section->level > limit) if (!section || section->level > limit)
return FALSE; return FALSE;
if (fp == NULL || section->level < 0) if (fp == NULL || section->level < 0)
@ -1244,17 +1244,18 @@ xhtml_add_contents_entry(FILE * fp, xhtmlsection * section, int limit)
fprintf(fp, "<ul>\n"); fprintf(fp, "<ul>\n");
if(chm_toc)fprintf(chm_toc, "<ul>\n"); if(chm_toc)fprintf(chm_toc, "<ul>\n");
} }
filename = conf.leaf_level ? section->file->filename : "";
fragment = xhtml_get_fragmentname(section, fragmentbuf); fragment = xhtml_get_fragmentname(section, fragmentbuf);
fprintf(fp, "<li>"); fprintf(fp, "<li>");
fprintf(fp, "<a %shref=\"%s#%s\">", fprintf(fp, "<a %shref=\"%s#%s\">",
(section->para->type == para_Chapter|| section->para->type == para_Appendix) ? "class=\"btitle\" " : "", (section->para->type == para_Chapter|| section->para->type == para_Appendix) ? "class=\"btitle\" " : "",
section->file->filename, filename,
(section->para->type == para_Chapter) ? "" : fragment); (section->para->type == para_Chapter) ? "" : fragment);
if(chm_toc)fprintf(chm_toc, "<li><OBJECT type=\"text/sitemap\"><param name=\"Local\" value=\"%s#%s\"><param name=\"Name\" value=\"", if(chm_toc)fprintf(chm_toc, "<li><OBJECT type=\"text/sitemap\"><param name=\"Local\" value=\"%s#%s\"><param name=\"Name\" value=\"",
section->file->filename, filename,
(section->para->type == para_Chapter) ? "" : fragment); (section->para->type == para_Chapter) ? "" : fragment);
if(chm_ind)fprintf(chm_ind, "<li><OBJECT type=\"text/sitemap\"><param name=\"Local\" value=\"%s#%s\"><param name=\"Name\" value=\"", if(chm_ind)fprintf(chm_ind, "<li><OBJECT type=\"text/sitemap\"><param name=\"Local\" value=\"%s#%s\"><param name=\"Name\" value=\"",
section->file->filename, filename,
(section->para->type == para_Chapter) ? "" : fragment); (section->para->type == para_Chapter) ? "" : fragment);
//%s //%s
if (section->para->type == para_Chapter if (section->para->type == para_Chapter
@ -1701,7 +1702,7 @@ static void xhtml_rdaddwc(rdstringc * rs, word * text, word * end)
{ {
char fragmentbuf[NAMEDFRAGMENT_MAXLEN]; char fragmentbuf[NAMEDFRAGMENT_MAXLEN];
rdaddsc(rs, "<a href=\""); rdaddsc(rs, "<a href=\"");
rdaddsc(rs, sect->file->filename); rdaddsc(rs, conf.leaf_level ? sect->file->filename : "");
rdaddc(rs, '#'); rdaddc(rs, '#');
rdaddsc(rs, xhtml_get_fragmentname(sect, fragmentbuf)); rdaddsc(rs, xhtml_get_fragmentname(sect, fragmentbuf));
rdaddsc(rs, "\">"); rdaddsc(rs, "\">");