paul@106 | 1 | #!/usr/bin/env python |
paul@106 | 2 | |
paul@106 | 3 | """ |
paul@106 | 4 | Line break macro for Moin compatibility. |
paul@106 | 5 | |
paul@106 | 6 | Copyright (C) 2018 Paul Boddie <paul@boddie.org.uk> |
paul@106 | 7 | |
paul@106 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@106 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@106 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@106 | 11 | version. |
paul@106 | 12 | |
paul@106 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@106 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@106 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@106 | 16 | details. |
paul@106 | 17 | |
paul@106 | 18 | You should have received a copy of the GNU General Public License along with |
paul@106 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@106 | 20 | """ |
paul@106 | 21 | |
paul@106 | 22 | from moinformat.macros.common import Macro |
paul@106 | 23 | from moinformat.tree.moin import LineBreak |
paul@106 | 24 | |
paul@106 | 25 | class LineBreakMacro(Macro): |
paul@106 | 26 | |
paul@106 | 27 | "A line break macro." |
paul@106 | 28 | |
paul@106 | 29 | name = "BR" |
paul@106 | 30 | |
paul@106 | 31 | def evaluate(self): |
paul@106 | 32 | |
paul@106 | 33 | "Evaluate the macro, producing a line break node." |
paul@106 | 34 | |
paul@106 | 35 | # Replace the macro node with the line break. |
paul@106 | 36 | |
paul@110 | 37 | macro = self.node |
paul@110 | 38 | macro.parent.replace(macro, LineBreak()) |
paul@106 | 39 | |
paul@106 | 40 | macro = LineBreakMacro |
paul@106 | 41 | |
paul@106 | 42 | # vim: tabstop=4 expandtab shiftwidth=4 |