From 5cd04f27a06023ecfbe55bab2a35025301f7b799 Mon Sep 17 00:00:00 2001 From: baldurk Date: Mon, 9 Mar 2020 10:53:25 +0000 Subject: [PATCH] Fix some encoding issues with sphinx docs in htmlhelp builder --- docs/make.sh | 1 + docs/remove_lines.py | 3 +++ docs/sphinx_rtd_theme_chm_friendly/layout.html | 2 ++ 3 files changed, 6 insertions(+) diff --git a/docs/make.sh b/docs/make.sh index 23d45159e..5d11961e0 100644 --- a/docs/make.sh +++ b/docs/make.sh @@ -147,6 +147,7 @@ if [ $1 == "htmlhelp" ]; then # Copy introduction page over index.html cp $BUILDDIR/htmlhelp/introduction.html $BUILDDIR/htmlhelp/index.html # Filter out the auto-generated TOC to remove anchor links and root index.html + cp $BUILDDIR/htmlhelp/renderdoc.hhc $BUILDDIR/htmlhelp/renderdoc.hhc.bak cat $BUILDDIR/htmlhelp/renderdoc.hhc | "$PYTHON" remove_lines.py ".html#" | "$PYTHON" remove_lines.py "\"index.html\"" > $BUILDDIR/htmlhelp/tmp mv $BUILDDIR/htmlhelp/tmp $BUILDDIR/htmlhelp/renderdoc.hhc if [ -f "${HHCBUILD}" ]; then diff --git a/docs/remove_lines.py b/docs/remove_lines.py index cc9b0bead..aa030b787 100644 --- a/docs/remove_lines.py +++ b/docs/remove_lines.py @@ -14,6 +14,9 @@ def remLines(delim, above, below): WinReader = codecs.getreader('cp1252') sys.stdin = WinReader(sys.stdin.buffer) + WinWriter = codecs.getwriter('cp1252') + sys.stdout = WinWriter(sys.stdout.buffer) + buff = [] line = sys.stdin.readline() while line: diff --git a/docs/sphinx_rtd_theme_chm_friendly/layout.html b/docs/sphinx_rtd_theme_chm_friendly/layout.html index 8bf38d067..1b75e2d8a 100644 --- a/docs/sphinx_rtd_theme_chm_friendly/layout.html +++ b/docs/sphinx_rtd_theme_chm_friendly/layout.html @@ -11,7 +11,9 @@ + {% if 'htmlhelp' not in builder %} + {% endif %} {{ metatags }} {% block htmltitle %}