From: Michael Smith Date: Thu, 19 Jul 2007 07:17:45 +0000 (+0000) Subject: Fixed a bug that caused broken links in some TOCs. X-Git-Tag: release/1.79.1~6^2~1916 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fce093affad6261af0e23a52d701a1edba93320d;p=docbook-dsssl Fixed a bug that caused broken links in some TOCs. This change affects the code for generating links in HTML output. It adds a new optional "toc.context" parameter to the href.target template, and based on the value of that parameter, handles link-generation in TOCs differently under a certain condition. The gory details: The code now checks to see if the output dir of any file being linked to in a particular TOC is different from the output dir the TOC is written to. If it is different, we do not call the trim.common.uri.paths[1] template. The reason is that, given the following case: 1. we are chunking into separate dirs 2. output for the TOC is written to current dir, but the file being linked to is written to some subdir "foo". For that case, links to that file in that TOC did not show the correct path - they omitted the "foo". The cause of that problem was that the trim.common.uri.paths template was being called under all conditions. But it's apparent that we don't want to call trim.common.uri.paths in the case where a linked file is being written to a different directory than the TOC that contains the link, because doing so will cause a necessary (not redundant) directory-name part of the link to get inadvertently trimmed, resulting in a broken link to that file. Thus, the conditional check was added to catch this case and to handle it differently [1] The purpose of the trim.common.uri.paths template is to prevent cases where, if we didn't call it, we end up with unnecessary, redundant directory names getting output; for example, "foo/foo/refname.html". --- diff --git a/xsl/html/autotoc.xsl b/xsl/html/autotoc.xsl index 767f1a66d..fabb2ecc7 100644 --- a/xsl/html/autotoc.xsl +++ b/xsl/html/autotoc.xsl @@ -331,6 +331,7 @@ + @@ -524,7 +525,9 @@ - + + + @@ -547,6 +550,7 @@ + @@ -574,6 +578,7 @@ + @@ -644,7 +649,9 @@ - + + + diff --git a/xsl/html/chunk-common.xsl b/xsl/html/chunk-common.xsl index a6669e33b..f368af134 100644 --- a/xsl/html/chunk-common.xsl +++ b/xsl/html/chunk-common.xsl @@ -1027,32 +1027,100 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - @@ -1060,13 +1128,11 @@ - - @@ -1074,7 +1140,6 @@ - -