1.1 --- a/moinformat/parsers/common.py Tue Jul 24 15:43:20 2018 +0200
1.2 +++ b/moinformat/parsers/common.py Tue Jul 24 18:45:13 2018 +0200
1.3 @@ -209,14 +209,16 @@
1.4
1.5 region_pattern_names = None
1.6
1.7 - def __init__(self, formats=None):
1.8 + def __init__(self, formats=None, root=None):
1.9
1.10 """
1.11 Initialise the parser with any given 'formats' mapping from region type
1.12 - names to parser objects.
1.13 + names to parser objects. An optional 'root' indicates the document-level
1.14 + parser.
1.15 """
1.16
1.17 self.formats = formats
1.18 + self.root = root
1.19
1.20 def get_parser(self, format_type):
1.21
1.22 @@ -229,7 +231,7 @@
1.23
1.24 cls = self.formats.get(format_type)
1.25 if cls:
1.26 - return cls(self.formats)
1.27 + return cls(self.formats, self.root or self)
1.28 else:
1.29 return None
1.30