doc: wikiparser: Handle table of contents macro without parenthesis

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2020-08-24 15:29:39 -07:00 committed by James Valleroy
parent 64fedf1f32
commit e5c51e9bb4
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -832,6 +832,8 @@ def parse_wiki(text, context=None, begin_marker=None, end_marker=None):
>>> parse_wiki('')
[]
>>> parse_wiki('<<TableOfContents>>')
[TableOfContents()]
>>> parse_wiki('<<TableOfContents()>>')
[TableOfContents()]
>>> parse_wiki('<<TableOfContents(2)>>')
@ -1240,7 +1242,7 @@ PlainText('dialog.')])])])]
continue
# Table of Contents
match = re.match(r'<<TableOfContents\((\d*)\)>>', line)
match = re.match(r'<<TableOfContents(?:\((\d*)\))?>>', line)
if match:
level = match.group(1)
if level: