# HG changeset patch # User Paul Boddie # Date 1555364520 -7200 # Node ID b310a5ca9290fb45838fb989009a36217dbad1c7 # Parent a5355652a61ec6c29f054f8f4c0914584e0f435b Added an initial version of the Verbatim macro. diff -r a5355652a61e -r b310a5ca9290 moinformat/macros/verbatim.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/moinformat/macros/verbatim.py Mon Apr 15 23:42:00 2019 +0200 @@ -0,0 +1,42 @@ +#!/usr/bin/env python + +""" +Verbatim macro for Moin compatibility. + +Copyright (C) 2019 Paul Boddie + +This program is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free Software +Foundation; either version 3 of the License, or (at your option) any later +version. + +This program is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public License along with +this program. If not, see . +""" + +from moinformat.macros.common import Macro +from moinformat.tree.moin import Verbatim + +class VerbatimMacro(Macro): + + "A verbatim text macro." + + name = "Verbatim" + + def evaluate(self): + + "Evaluate the macro, producing a verbatim text node." + + # Replace the macro node with the verbatim node. + + macro = self.node + macro.parent.replace(macro, Verbatim(",".join(self.node.args))) + +macro = VerbatimMacro + +# vim: tabstop=4 expandtab shiftwidth=4 diff -r a5355652a61e -r b310a5ca9290 tests/test_macros.tree --- a/tests/test_macros.tree Mon Apr 15 23:41:18 2019 +0200 +++ b/tests/test_macros.tree Mon Apr 15 23:42:00 2019 +0200 @@ -18,3 +18,8 @@ Text Macro Text + Break + Block + Text + Macro + Text diff -r a5355652a61e -r b310a5ca9290 tests/test_macros.tree-exp --- a/tests/test_macros.tree-exp Mon Apr 15 23:41:18 2019 +0200 +++ b/tests/test_macros.tree-exp Mon Apr 15 23:42:00 2019 +0200 @@ -33,3 +33,8 @@ Text LineBreak Text + Break + Block + Text + Verbatim + Text diff -r a5355652a61e -r b310a5ca9290 tests/test_macros.txt --- a/tests/test_macros.txt Mon Apr 15 23:41:18 2019 +0200 +++ b/tests/test_macros.txt Mon Apr 15 23:42:00 2019 +0200 @@ -7,3 +7,5 @@ == Subheading == More<
>text. + +Some <>.