summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2001-12-10 17:38:13 +0000
committerSimon Tatham <anakin@pobox.com>2001-12-10 17:38:13 +0000
commit1d714283e3bc8b3f5a202a56950052e8c98d03a0 (patch)
tree182dac67f98222d41ced0fdaf5baf01856f44e00
parente695cb0dd19d1cbce0c49a71a913527a227a9e09 (diff)
downloadhalibut-1d714283e3bc8b3f5a202a56950052e8c98d03a0.zip
halibut-1d714283e3bc8b3f5a202a56950052e8c98d03a0.tar.gz
halibut-1d714283e3bc8b3f5a202a56950052e8c98d03a0.tar.bz2
halibut-1d714283e3bc8b3f5a202a56950052e8c98d03a0.tar.xz
The .CNT workaround didn't work in all cases (specifically,
top-level leaf nodes simply can't be done, because you can't lower the level of the node to 0 to compensate for the bug because the parser rejects it). A different workaround is now in place for those cases. [originally from svn r1465]
-rw-r--r--bk_whlp.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/bk_whlp.c b/bk_whlp.c
index c5ebdb9..757f4e5 100644
--- a/bk_whlp.c
+++ b/bk_whlp.c
@@ -279,16 +279,30 @@ void whlp_backend(paragraph *sourceform, keywordlist *keywords,
{
/*
* Output the .cnt entry.
+ *
+ * WinHelp has a bug involving having an internal
+ * node followed by a leaf at the same level: the
+ * leaf is output at the wrong level. We can mostly
+ * work around this by modifying the leaf level
+ * itself (see whlp_contents_write), but this
+ * doesn't work for top-level sections since we
+ * can't turn a level-1 leaf into a level-0 one. So
+ * for top-level leaf sections (Bibliography
+ * springs to mind), we output an internal node
+ * containing only the leaf for that section.
*/
int i;
paragraph *q;
+
+ /* Count up the level. */
i = 1;
for (q = p; q->parent; q = q->parent) i++;
- if (p->child) {
+
+ if (p->child || !p->parent) {
/*
- * Need two entries: one directory, and then
- * one actual link. The link is on the next
- * level down.
+ * If p has children then it needs to be a
+ * folder; if it has no parent then it needs to
+ * be a folder to work around the bug.
*/
whlp_contents_write(&state, i, rs.text, NULL);
i++;