1.1 --- a/moinformat/parsers/common.py Mon Aug 06 15:55:46 2018 +0200
1.2 +++ b/moinformat/parsers/common.py Tue Aug 07 17:07:03 2018 +0200
1.3 @@ -387,9 +387,11 @@
1.4
1.5 region = Region([], level, indent, type)
1.6
1.7 - # Parse section headers, then parse according to region type.
1.8 + # Parse section headers and directives, then parse according to region
1.9 + # type.
1.10
1.11 self.parse_region_header(region)
1.12 + self.parse_region_directives(region)
1.13 self.parse_region_type(region)
1.14
1.15 return region
1.16 @@ -418,6 +420,30 @@
1.17 region.args = self.match_group("args")
1.18 region.type = region.args.split(" ", 1)[0]
1.19
1.20 + def parse_region_directives(self, region):
1.21 +
1.22 + """
1.23 + Parse any directives immediately after the region header, adding them to
1.24 + the 'region' object.
1.25 + """
1.26 +
1.27 + while True:
1.28 + preceding = self.read_until(["directive"], False)
1.29 +
1.30 + # With an immediately-appearing directive, handle its details.
1.31 +
1.32 + if preceding == "":
1.33 + handler = self.handlers.get(self.matching_pattern())
1.34 + if handler:
1.35 + handler(self, region)
1.36 + else:
1.37 + break
1.38 +
1.39 + # Otherwise, with no immediate directive (or none at all), stop.
1.40 +
1.41 + else:
1.42 + break
1.43 +
1.44 # Parsing utilities.
1.45
1.46 def parse_region_details(self, region, pattern_names, strict=False):