1.1 --- a/moinformat/parsers/common.py Mon Aug 13 22:57:16 2018 +0200
1.2 +++ b/moinformat/parsers/common.py Tue Aug 14 22:36:06 2018 +0200
1.3 @@ -262,15 +262,15 @@
1.4
1.5 region_pattern_names = None
1.6
1.7 - def __init__(self, formats=None, root=None):
1.8 + def __init__(self, metadata, parsers=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. An optional 'root' indicates the document-level
1.13 - parser.
1.14 + Initialise the parser with the given 'metadata' and optional 'parsers'.
1.15 + An optional 'root' indicates the document-level parser.
1.16 """
1.17
1.18 - self.formats = formats
1.19 + self.metadata = metadata
1.20 + self.parsers = parsers
1.21 self.root = root
1.22
1.23 def get_parser(self, format_type):
1.24 @@ -279,12 +279,9 @@
1.25 Return a parser for 'format_type' or None if no suitable parser is found.
1.26 """
1.27
1.28 - if not self.formats:
1.29 - return None
1.30 -
1.31 - cls = self.formats.get(format_type)
1.32 + cls = self.parsers and self.parsers.get(format_type)
1.33 if cls:
1.34 - return cls(self.formats, self.root or self)
1.35 + return cls(self.metadata, self.parsers, self.root or self)
1.36 else:
1.37 return None
1.38