1.1 --- a/moinformat/serialisers/__init__.py Mon Aug 13 22:54:01 2018 +0200
1.2 +++ b/moinformat/serialisers/__init__.py Tue Aug 14 22:33:30 2018 +0200
1.3 @@ -19,11 +19,7 @@
1.4 this program. If not, see <http://www.gnu.org/licenses/>.
1.5 """
1.6
1.7 -from moinformat.links import make_linker
1.8 -from moinformat.output import make_output
1.9 from moinformat.serialisers.manifest import serialisers
1.10 -from moinformat.serialisers.moin.moin import MoinSerialiser
1.11 -from os.path import curdir
1.12
1.13 # Top-level functions.
1.14
1.15 @@ -33,36 +29,20 @@
1.16
1.17 return serialisers["%s.moin" % name]
1.18
1.19 -def make_serialiser(name, output=None, linker=None, pagename=None):
1.20 +def make_serialiser(metadata, format=None):
1.21
1.22 """
1.23 - Return a serialiser instance for the format having the given 'name'.
1.24 -
1.25 - The optional 'output' context is used to control where separate resources
1.26 - are stored, with the default being no storage of such resources.
1.27 -
1.28 - The optional 'linker' is used to control which linking scheme is used with
1.29 - the serialiser, with the default having the same name as the serialiser.
1.30 -
1.31 - The optional 'pagename' indicates the name details of the page to be
1.32 - serialised.
1.33 + Return a serialiser instance using the given 'metadata' and optional
1.34 + 'format'.
1.35 """
1.36
1.37 - output = output or make_output("standalone")
1.38 - linker = linker or make_linker(name, "")
1.39 - return get_serialiser(name)(output, serialisers, linker, pagename)
1.40 + return metadata.get_serialiser(format)
1.41
1.42 -def serialise(doc, serialiser=None):
1.43 +def serialise(doc, serialiser):
1.44
1.45 - """
1.46 - Serialise 'doc' using the given 'serialiser' instance or the Moin serialiser
1.47 - if omitted.
1.48 - """
1.49 + "Serialise 'doc' using the given 'serialiser' instance."
1.50
1.51 - if not serialiser:
1.52 - output = make_output("standalone")
1.53 - serialiser = MoinSerialiser(output, serialisers)
1.54 -
1.55 + serialiser.reset()
1.56 doc.to_string(serialiser)
1.57 return serialiser.get_output()
1.58