paul@38 | 1 | #!/usr/bin/env python |
paul@38 | 2 | |
paul@38 | 3 | """ |
paul@38 | 4 | Moin wiki serialisers. |
paul@38 | 5 | |
paul@46 | 6 | Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk> |
paul@38 | 7 | |
paul@38 | 8 | This program is free software; you can redistribute it and/or modify it under |
paul@38 | 9 | the terms of the GNU General Public License as published by the Free Software |
paul@38 | 10 | Foundation; either version 3 of the License, or (at your option) any later |
paul@38 | 11 | version. |
paul@38 | 12 | |
paul@38 | 13 | This program is distributed in the hope that it will be useful, but WITHOUT |
paul@38 | 14 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
paul@38 | 15 | FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
paul@38 | 16 | details. |
paul@38 | 17 | |
paul@38 | 18 | You should have received a copy of the GNU General Public License along with |
paul@38 | 19 | this program. If not, see <http://www.gnu.org/licenses/>. |
paul@38 | 20 | """ |
paul@38 | 21 | |
paul@40 | 22 | from moinformat.serialisers.manifest import serialisers |
paul@85 | 23 | from moinformat.serialisers.moin.moin import MoinSerialiser |
paul@38 | 24 | |
paul@38 | 25 | # Top-level functions. |
paul@38 | 26 | |
paul@38 | 27 | def serialise(doc, serialiser=MoinSerialiser): |
paul@46 | 28 | |
paul@46 | 29 | "Serialise 'doc' using 'serialiser' or the Moin serialiser if omitted." |
paul@46 | 30 | |
paul@38 | 31 | l = [] |
paul@85 | 32 | doc.to_string(serialiser(l.append, serialisers)) |
paul@38 | 33 | return "".join(l) |
paul@38 | 34 | |
paul@38 | 35 | # vim: tabstop=4 expandtab shiftwidth=4 |