1.1 --- a/moinformat/serialisers/html.py Sat Jul 14 16:17:36 2018 +0200
1.2 +++ b/moinformat/serialisers/html.py Sat Jul 14 23:37:30 2018 +0200
1.3 @@ -25,6 +25,19 @@
1.4
1.5 "Serialisation of the page."
1.6
1.7 + def _region_tag(self, type):
1.8 +
1.9 + # NOTE: Need to support types in general.
1.10 +
1.11 + type = type.split()[0]
1.12 +
1.13 + if type == "inline":
1.14 + return "tt"
1.15 + elif type in (None, "python"):
1.16 + return "pre"
1.17 + else:
1.18 + return "span"
1.19 +
1.20 def start_region(self, level, indent, type):
1.21 l = []
1.22 out = l.append
1.23 @@ -36,13 +49,14 @@
1.24
1.25 # NOTE: Encode type details for CSS.
1.26
1.27 - if type:
1.28 - out("type-%s" % escape_attr(type))
1.29 + out("type-%s" % escape_attr(type or "opaque"))
1.30
1.31 - self.out("<span class='%s'>" % " ".join(l))
1.32 + tag = self._region_tag(type)
1.33 + self.out("<%s class='%s'>" % (tag, " ".join(l)))
1.34
1.35 def end_region(self, level, indent, type):
1.36 - self.out("</span>")
1.37 + tag = self._region_tag(type)
1.38 + self.out("</%s>" % tag)
1.39
1.40 def start_block(self):
1.41 self.out("<p>")