1.1 --- a/moinformat/serialisers/__init__.py Mon Aug 06 15:44:10 2018 +0200
1.2 +++ b/moinformat/serialisers/__init__.py Mon Aug 06 15:45:11 2018 +0200
1.3 @@ -33,7 +33,7 @@
1.4
1.5 return serialisers["%s.moin" % name]
1.6
1.7 -def make_serialiser(name, output=None, linker=None):
1.8 +def make_serialiser(name, output=None, linker=None, pagename=None):
1.9
1.10 """
1.11 Return a serialiser instance for the format having the given 'name'.
1.12 @@ -43,11 +43,14 @@
1.13
1.14 The optional 'linker' is used to control which linking scheme is used with
1.15 the serialiser, with the default having the same name as the serialiser.
1.16 +
1.17 + The optional 'pagename' indicates the name details of the page to be
1.18 + serialised.
1.19 """
1.20
1.21 output = output or make_output("standalone")
1.22 linker = linker or make_linker(name, "")
1.23 - return get_serialiser(name)(output, serialisers, linker)
1.24 + return get_serialiser(name)(output, serialisers, linker, pagename)
1.25
1.26 def serialise(doc, serialiser=None):
1.27
2.1 --- a/moinformat/serialisers/common.py Mon Aug 06 15:44:10 2018 +0200
2.2 +++ b/moinformat/serialisers/common.py Mon Aug 06 15:45:11 2018 +0200
2.3 @@ -25,17 +25,18 @@
2.4
2.5 format = None # defined by subclasses
2.6
2.7 - def __init__(self, output, formats=None, linker=None):
2.8 + def __init__(self, output, formats=None, linker=None, pagename=None):
2.9
2.10 """
2.11 Initialise the serialiser with an 'output' context, an optional
2.12 - 'formats' mapping from names to serialiser classes, and an optional
2.13 - 'linker' object for translating links.
2.14 + 'formats' mapping from names to serialiser classes, an optional 'linker'
2.15 + object for translating links, and an optional 'pagename'.
2.16 """
2.17
2.18 self.output = output
2.19 self.formats = formats
2.20 self.linker = linker
2.21 + self.pagename = pagename
2.22
2.23 # Initialise a callable for use in serialisation.
2.24
2.25 @@ -52,8 +53,8 @@
2.26 pass
2.27
2.28 def __repr__(self):
2.29 - return "%s(%r, %r, %r)" % (self.__class__.__name__, self.output,
2.30 - self.formats, self.linker)
2.31 + return "%s(%r, %r, %r, %r)" % (self.__class__.__name__, self.output,
2.32 + self.formats, self.linker, self.pagename)
2.33
2.34 def get_serialiser(self, format):
2.35
2.36 @@ -84,7 +85,7 @@
2.37 if cls is self.__class__:
2.38 return self
2.39 else:
2.40 - return cls(self.output, self.formats, self.linker)
2.41 + return cls(self.output, self.formats, self.linker, self.pagename)
2.42
2.43 def escape_attr(s):
2.44