1.1 --- a/moinformat/parsers/moin.py Tue Jul 24 18:45:32 2018 +0200
1.2 +++ b/moinformat/parsers/moin.py Tue Jul 24 23:36:13 2018 +0200
1.3 @@ -19,6 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 +from moinformat.macros import get_macro
1.8 from moinformat.parsers.common import ParserBase, get_patterns, \
1.9 excl, expect, group, optional, recur, \
1.10 repeat
1.11 @@ -86,6 +87,27 @@
1.12
1.13
1.14
1.15 + # Macro evaluation.
1.16 +
1.17 + def evaluate_macros(self):
1.18 +
1.19 + "Evaluate the macro nodes in the document."
1.20 +
1.21 + for node in self.macros:
1.22 +
1.23 + # Obtain a class for the named macro.
1.24 +
1.25 + macro_cls = get_macro(node.name)
1.26 + if not macro_cls:
1.27 + continue
1.28 +
1.29 + # Instantiate the class and evaluate the macro.
1.30 +
1.31 + macro = macro_cls(node, self.region)
1.32 + macro.evaluate()
1.33 +
1.34 +
1.35 +
1.36 # Parser methods supporting different page features.
1.37
1.38 def parse_attrname(self, attrs):