paul@101 | 1 | #!/usr/bin/env python |
paul@101 | 2 | |
paul@101 | 3 | """ |
paul@101 | 4 | Moin Graphviz region serialiser. |
paul@101 | 5 | |
paul@331 | 6 | Copyright (C) 2018, 2021, 2023 Paul Boddie <paul@boddie.org.uk> |
paul@101 | 7 | |
paul@101 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@101 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@101 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@101 | 11 | version. |
paul@101 | 12 | |
paul@101 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@101 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@101 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@101 | 16 | details. |
paul@101 | 17 | |
paul@101 | 18 | You should have received a copy of the GNU General Public License along with |
paul@101 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@101 | 20 | """ |
paul@101 | 21 | |
paul@101 | 22 | from moinformat.serialisers.common import Serialiser |
paul@101 | 23 | |
paul@101 | 24 | class MoinGraphvizSerialiser(Serialiser): |
paul@101 | 25 | |
paul@101 | 26 | "Serialisation of the page." |
paul@101 | 27 | |
paul@301 | 28 | input_formats = ["graphviz", "dot"] |
paul@301 | 29 | formats = ["moin", "wiki"] |
paul@301 | 30 | |
paul@331 | 31 | def block(self, block): |
paul@331 | 32 | self.container(block) |
paul@101 | 33 | |
paul@331 | 34 | def directive(self, directive): |
paul@331 | 35 | if directive.directive: |
paul@331 | 36 | self.out("#%s\n" % directive.directive) |
paul@188 | 37 | else: |
paul@331 | 38 | self.out("//%s%s\n" % ( |
paul@331 | 39 | directive.value and "%s=" % directive.key or directive.key, |
paul@331 | 40 | directive.value or "")) |
paul@101 | 41 | |
paul@101 | 42 | def text(self, text): |
paul@331 | 43 | self.out(text.s) |
paul@101 | 44 | |
paul@101 | 45 | serialiser = MoinGraphvizSerialiser |
paul@101 | 46 | |
paul@101 | 47 | # vim: tabstop=4 expandtab shiftwidth=4 |