Skip to content

Commit

Permalink
Merge pull request #61 from sbesson/docutils_0.18.1
Browse files Browse the repository at this point in the history
Docutils 0.18.1: stylesheet vs stylesheet_path
  • Loading branch information
mgedmin committed Nov 29, 2021
2 parents 4e2b8d0 + 10ddcc0 commit aabdc56
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/restview/restviewhttp.py
Expand Up @@ -456,12 +456,17 @@ def rest_to_html(self, rest_input, settings=None, mtime=None, filename=None):
writer.translator_class = SyntaxHighlightingHTMLTranslator
if self.stylesheets:
stylesheet_dirs = writer.default_stylesheet_dirs + [DATA_PATH]
# docutils can't embed http:// or https:// URLs
embed_stylesheet = '//' not in self.stylesheets
settings_overrides = {'stylesheet': self.stylesheets,
'stylesheet_path': None,
'stylesheet_dirs': stylesheet_dirs,
'embed_stylesheet': embed_stylesheet}
if '//' not in self.stylesheets:
settings_overrides = {'stylesheet': None,
'stylesheet_path': self.stylesheets,
'stylesheet_dirs': stylesheet_dirs,
'embed_stylesheet': True}
else:
# docutils can't embed http:// or https:// URLs
settings_overrides = {'stylesheet': self.stylesheets,
'stylesheet_path': None,
'stylesheet_dirs': stylesheet_dirs,
'embed_stylesheet': False}
else:
settings_overrides = {}
settings_overrides['syntax_highlight'] = 'short'
Expand Down

0 comments on commit aabdc56

Please sign in to comment.