1.1 --- a/moinformat/serialisers/__init__.py Thu Jul 26 20:09:48 2018 +0200
1.2 +++ b/moinformat/serialisers/__init__.py Thu Jul 26 20:30:14 2018 +0200
1.3 @@ -19,11 +19,30 @@
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.serialisers.manifest import serialisers
1.9 from moinformat.serialisers.moin.moin import MoinSerialiser
1.10
1.11 # Top-level functions.
1.12
1.13 +def get_serialiser(name):
1.14 +
1.15 + "Return the main serialiser class for the format having the given 'name'."
1.16 +
1.17 + return serialisers["%s.moin" % name]
1.18 +
1.19 +def make_serialiser(name, linker=None):
1.20 +
1.21 + """
1.22 + Return a serialiser instance for the format having the given 'name'.
1.23 +
1.24 + The optional 'linker' is used to control which linking scheme is used with
1.25 + the serialiser, with the default having the same name as the serialiser.
1.26 + """
1.27 +
1.28 + linker = linker or make_linker(name, "")
1.29 + return get_serialiser(name)(formats=serialisers, linker=linker)
1.30 +
1.31 def serialise(doc, serialiser=None):
1.32
1.33 """