diff options
author | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-01-16 09:19:08 +0000 |
---|---|---|
committer | milde <milde@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2023-01-16 09:19:08 +0000 |
commit | d46a5f03aa9f4a5e9ce317168d3a9695ed76e261 (patch) | |
tree | 258f63710057576696dd9ba644664a470901c3f5 /docutils | |
parent | 7d367912f045ae24e8c295c4df3a8b70acfefe5e (diff) | |
download | docutils-d46a5f03aa9f4a5e9ce317168d3a9695ed76e261.tar.gz |
Always use POSIX path in macros loading stylesheets.
Thanks to Alan G. Isaac for reporting the bug and proposing a patch.
git-svn-id: https://svn.code.sf.net/p/docutils/code/trunk/docutils@9316 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils')
-rw-r--r-- | docutils/writers/latex2e/__init__.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/docutils/writers/latex2e/__init__.py b/docutils/writers/latex2e/__init__.py index 120ab2bbc..d46272a19 100644 --- a/docutils/writers/latex2e/__init__.py +++ b/docutils/writers/latex2e/__init__.py @@ -256,8 +256,8 @@ class Writer(writers.Writer): writers.Writer.__init__(self) self.translator_class = LaTeXTranslator - # Override parent method to add latex-specific transforms def get_transforms(self): + # Override parent method to add latex-specific transforms return super().get_transforms() + [ # Convert specific admonitions to generic one writer_aux.Admonitions, @@ -1327,8 +1327,7 @@ class LaTeXTranslator(nodes.NodeVisitor): stylesheet_list = utils.get_stylesheet_list(settings) self.fallback_stylesheet = 'docutils' in stylesheet_list if self.fallback_stylesheet: - stylesheet_list = [sheet for sheet in stylesheet_list - if sheet != 'docutils'] + stylesheet_list.remove('docutils') if settings.legacy_class_functions: # docutils.sty is incompatible with legacy functions self.fallback_stylesheet = False @@ -1403,12 +1402,10 @@ class LaTeXTranslator(nodes.NodeVisitor): self.document.reporter.error(msg) return '% ' + msg.replace('\n', '\n% ') else: - self.settings.record_dependencies.add(path) + self.settings.record_dependencies.add(path.as_posix()) if is_package: # allow '@' in macro names: - content = (r'\makeatletter' - f'\n{content}\n' - r'\makeatother') + content = (f'\\makeatletter\n{content}\n\\makeatother') return (f'% embedded stylesheet: {path.as_posix()}\n' f'{content}') # Link to style file: @@ -1419,8 +1416,8 @@ class LaTeXTranslator(nodes.NodeVisitor): cmd = r'\input{%s}' if self.settings.stylesheet_path: # adapt path relative to output (cf. config.html#stylesheet-path) - path = utils.relative_path(self.settings._destination, path) - return cmd % path + return cmd % utils.relative_path(self.settings._destination, path) + return cmd % path.as_posix() def to_latex_encoding(self, docutils_encoding): """Translate docutils encoding name into LaTeX's. |