From 37fde1f3f15c190b5989f245a8138a00555f5089 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 7 Apr 2019 19:10:22 +0900 Subject: [PATCH] Fix #6229: htmlhelp builder generates invalid .hhc file --- CHANGES | 5 +++ sphinxcontrib/htmlhelp/__init__.py | 11 ++---- sphinxcontrib/htmlhelp/templates/project.hhc | 41 ++++++++------------ 3 files changed, 26 insertions(+), 31 deletions(-) diff --git a/CHANGES b/CHANGES index 7c2b392..a719780 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,8 @@ +Release 1.0.2 (unreleased) +========================== + +* #6229: htmlhelp builder generates invalid .hhc file + Release 1.0.1 (2019-02-15) ========================== diff --git a/sphinxcontrib/htmlhelp/__init__.py b/sphinxcontrib/htmlhelp/__init__.py index 671425e..a257607 100644 --- a/sphinxcontrib/htmlhelp/__init__.py +++ b/sphinxcontrib/htmlhelp/__init__.py @@ -98,8 +98,7 @@ def __init__(self, document: document) -> None: self.depth = 0 def append(self, text: str) -> None: - indent = ' ' * (self.depth - 1) - self.body.append(indent + text) + self.body.append(text) def astext(self) -> str: return '\n'.join(self.body) @@ -122,18 +121,16 @@ def depart_bullet_list(self, node: Element) -> None: self.append('') def visit_list_item(self, node: Element) -> None: - self.append('
  • ') + self.append('
  • ') self.depth += 1 def depart_list_item(self, node: Element) -> None: self.depth -= 1 - self.append('') def visit_reference(self, node: Element) -> None: title = chm_htmlescape(node.astext(), True) - self.append('') - self.append(' ' % title) - self.append(' ' % node['refuri']) + self.append(' ' % title) + self.append(' ' % node['refuri']) self.append('') raise nodes.SkipNode diff --git a/sphinxcontrib/htmlhelp/templates/project.hhc b/sphinxcontrib/htmlhelp/templates/project.hhc index c1096e7..49410e3 100644 --- a/sphinxcontrib/htmlhelp/templates/project.hhc +++ b/sphinxcontrib/htmlhelp/templates/project.hhc @@ -1,31 +1,24 @@ {%- macro sitemap(name, docname) -%} - - + + {%- endmacro -%} - - - - - - - - - -
      -
    • - {{ sitemap(short_title, master_doc)|indent(8) }} -
    • - {%- for indexname, indexcls, content, collapse in domain_indices %} -
    • - {{ sitemap(indexcls.localname, indexname)|indent(8) }} -
    • - {%- endfor %} - {{ body|indent(6) }} -
    - - + + + + + + + + +
      +
    • {{ sitemap(short_title, master_doc) }} +{%- for indexname, indexcls, content, collapse in domain_indices %} +
    • {{ sitemap(indexcls.localname, indexname) }} +{%- endfor %} +{{ body }} +