From 1c03dae120dc47a3652b7d18a7d51511d2bf383e Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Mon, 14 Dec 2020 14:01:47 +0100 Subject: guard against API change in new Sphinx version --- _exts/typescriptdomain.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/_exts/typescriptdomain.py b/_exts/typescriptdomain.py index 68777645..f9af1b01 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) -- cgit v1.2.3