# HG changeset patch # User Paul Boddie # Date 1688161696 -7200 # Node ID 26fd94b671cfb2a3aa53bb99f22a1ba0fa77aa6b # Parent e272b98a1aa36dbfc0bccc2695de2d98343e184b Fixed parser object re-use. diff -r e272b98a1aa3 -r 26fd94b671cf moinformat/parsers/moin.py --- a/moinformat/parsers/moin.py Fri Jun 30 22:06:08 2023 +0200 +++ b/moinformat/parsers/moin.py Fri Jun 30 23:48:16 2023 +0200 @@ -56,15 +56,14 @@ formats = ["moin", "wiki"] - def __init__(self, metadata, parsers=None, root=None): + # Principal parser methods. + + def parse(self, s): """ - Initialise the parser with the given 'metadata' and optional 'parsers'. - An optional 'root' indicates the document-level parser. + Parse page text 's'. Pages consist of regions delimited by markers. """ - ParserBase.__init__(self, metadata, parsers, root) - # Record certain node occurrences for later evaluation. self.macros = [] @@ -77,13 +76,7 @@ self.link_targets = [] - # Principal parser methods. - - def parse(self, s): - - """ - Parse page text 's'. Pages consist of regions delimited by markers. - """ + # Obtain the token stream and a region to populate. self.items = self.get_items(s) self.region = Region([], type="moin")