paul@333 | 1 | #!/usr/bin/env python |
paul@333 | 2 | |
paul@333 | 3 | """ |
paul@333 | 4 | Prettyprinted document node prettyprinter. |
paul@333 | 5 | |
paul@333 | 6 | Copyright (C) 2023 Paul Boddie <paul@boddie.org.uk> |
paul@333 | 7 | |
paul@333 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@333 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@333 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@333 | 11 | version. |
paul@333 | 12 | |
paul@333 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@333 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@333 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@333 | 16 | details. |
paul@333 | 17 | |
paul@333 | 18 | You should have received a copy of the GNU General Public License along with |
paul@333 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@333 | 20 | """ |
paul@333 | 21 | |
paul@333 | 22 | from moinformat.serialisers.pretty.common import Serialiser |
paul@333 | 23 | |
paul@333 | 24 | class PrettySerialiser(Serialiser): |
paul@333 | 25 | |
paul@333 | 26 | "Serialisation of prettyprinted document nodes for inspection." |
paul@333 | 27 | |
paul@333 | 28 | input_formats = ["pretty"] |
paul@333 | 29 | formats = ["pretty"] |
paul@333 | 30 | |
paul@333 | 31 | def node(self, node): |
paul@333 | 32 | self.out("%s%s%s\n" % (self.output.indent, node.name, |
paul@333 | 33 | len(node.nodes) and " nodes=%d" % len(node.nodes) or "")) |
paul@333 | 34 | self.container(node) |
paul@333 | 35 | |
paul@333 | 36 | serialiser = PrettySerialiser |
paul@333 | 37 | |
paul@333 | 38 | # vim: tabstop=4 expandtab shiftwidth=4 |