1.1 --- a/moinformat/serialisers/common.py Fri Jul 13 16:59:27 2018 +0200
1.2 +++ b/moinformat/serialisers/common.py Fri Jul 13 18:53:55 2018 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Moin serialiser support.
1.6
1.7 -Copyright (C) 2017 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2017, 2018 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -23,8 +23,15 @@
1.13
1.14 "General serialisation support."
1.15
1.16 - def __init__(self, out):
1.17 + def __init__(self, out, formats=None):
1.18 +
1.19 + """
1.20 + Initialise the serialiser with an 'out' callable and an optional
1.21 + 'formats' mapping from names to serialiser classes.
1.22 + """
1.23 +
1.24 self.out = out
1.25 + self.formats = formats
1.26 self.init()
1.27
1.28 def init(self):
1.29 @@ -33,6 +40,9 @@
1.30
1.31 pass
1.32
1.33 + def __repr__(self):
1.34 + return "%s(%r, %r)" % (self.__class__.__name__, self.out, self.formats)
1.35 +
1.36 def escape_attr(s):
1.37
1.38 "Escape XML document attribute."