From e06a57f34fa36e132a78ce9ece3934da7cb86fca Mon Sep 17 00:00:00 2001 From: Marius Vikhammer Date: Mon, 9 Dec 2019 14:30:29 +0800 Subject: [PATCH] doc: Changed toc filter reg.ex to be non-greedy Stops the parsing from crashing when the content contains a ":", e.g. in web-links --- docs/extensions/toctree_filter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/extensions/toctree_filter.py b/docs/extensions/toctree_filter.py index 2f537a5fea..8cdb13cdbf 100644 --- a/docs/extensions/toctree_filter.py +++ b/docs/extensions/toctree_filter.py @@ -24,12 +24,13 @@ class TocTreeFilt(TocTree): when it scan the src/ directory, so it's also necessary to make sure that the files are covered by the exclude_patterns list in conf.py """ - RE_PATTERN = re.compile(r'^\s*:(.+):\s*(.+)$') + RE_PATTERN = re.compile(r'^\s*:(.+?):\s*(.+)$') def run(self): # Remove all TOC entries that should not be on display env = self.state.document.settings.env self.content = [self.filter_entry(env, e) for e in self.content if e is not None] + return super(TocTreeFilt, self).run() def filter_entry(self, env, entry):