From d003a61ebec69766c259fa3183e0dfb6b6f4aa76 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 28 Feb 2021 19:13:11 +0530 Subject: [PATCH] Sadly the better fix did not work so go back to mokeypatching --- manual/latex.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/manual/latex.py b/manual/latex.py index 3ff1a66b80..1035ce8b52 100644 --- a/manual/latex.py +++ b/manual/latex.py @@ -10,17 +10,29 @@ import os from sphinx.builders.latex import LaTeXBuilder from sphinx.util.logging import getLogger +from sphinx.writers.latex import LaTeXTranslator def info(*a): getLogger(__name__).info(*a) +class FixedLaTeXTranslator(LaTeXTranslator): + # see https://github.com/sphinx-doc/sphinx/issues/8936 + + def visit_substitution_definition(self, node): + pass + + def depart_substitution_definition(self, node): + pass + + class LaTeXHelpBuilder(LaTeXBuilder): name = 'mylatex' + default_translator_class = FixedLaTeXTranslator def finish(self): - LaTeXBuilder.finish(self) + super().finish() info('Fixing Cyrillic characters...') tex = os.path.join(self.outdir, 'calibre.tex') with open(tex, 'r+b') as f: