diff options
author | Florian Dold <florian@dold.me> | 2020-12-14 14:01:47 +0100 |
---|---|---|
committer | Florian Dold <florian@dold.me> | 2020-12-14 14:01:47 +0100 |
commit | 1c03dae120dc47a3652b7d18a7d51511d2bf383e (patch) | |
tree | f73759e673d10aa5ec1424e216d589611c3af369 | |
parent | cf29c27e4b3155a41106316d91f5497a068b7856 (diff) | |
download | docs-1c03dae120dc47a3652b7d18a7d51511d2bf383e.tar.gz docs-1c03dae120dc47a3652b7d18a7d51511d2bf383e.tar.bz2 docs-1c03dae120dc47a3652b7d18a7d51511d2bf383e.zip |
guard against API change in new Sphinx version
-rw-r--r-- | _exts/typescriptdomain.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/_exts/typescriptdomain.py b/_exts/typescriptdomain.py index 6877764..f9af1b0 100644 --- a/_exts/typescriptdomain.py +++ b/_exts/typescriptdomain.py @@ -405,6 +405,8 @@ class LinkingHtmlFormatter(HtmlFormatter): ): return value + if self._bridge.docname is None: + return value if xref is None: return value content = caption if caption is not None else value @@ -509,10 +511,11 @@ class MyPygmentsBridge(PygmentsBridge): def highlight_block( self, source, lang, opts=None, force=False, location=None, **kwargs ): - docname, line = location - self.line = line - self.path = self.builder.env.doc2path(docname) - self.docname = docname + if isinstance(location, tuple): + docname, line = location + self.line = line + self.path = self.builder.env.doc2path(docname) + self.docname = docname return super().highlight_block(source, lang, opts, force, location, **kwargs) |