1.1 --- a/xmlparser.py Fri Jun 16 17:06:10 2017 +0200
1.2 +++ b/xmlparser.py Fri Jun 16 17:07:06 2017 +0200
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Confluence Wiki XML/XHTML syntax parsing.
1.6
1.7 -Copyright (C) 2012, 2013, 2015 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2012, 2013, 2015, 2017 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This software is free software; you can redistribute it and/or
1.11 modify it under the terms of the GNU General Public License as
1.12 @@ -206,7 +206,7 @@
1.13
1.14 # Remember macro information for use within the element.
1.15
1.16 - if name == "ac:macro":
1.17 + if name in ("ac:macro", "ac:structured-macro"):
1.18 self.macros.append(self.attributes[-1].get("ac:name"))
1.19 self.macro_parameters.append({})
1.20
1.21 @@ -233,7 +233,7 @@
1.22
1.23 # Discard macro state.
1.24
1.25 - if name == "ac:macro":
1.26 + if name in ("ac:macro", "ac:structured-macro"):
1.27 self.macros.pop()
1.28 self.macro_parameters.pop()
1.29
1.30 @@ -401,8 +401,11 @@
1.31 # Some macros affect the formatting of their contents, whereas other
1.32 # simpler macros are handled here.
1.33
1.34 - elif name == "ac:macro":
1.35 + elif name in ("ac:macro", "ac:structured-macro"):
1.36 conversion = macrotypes.get(self.macros[-1])
1.37 +
1.38 + # Produce the converted macro.
1.39 +
1.40 if conversion:
1.41 parameters = {"content" : text}
1.42 parameters.update(self.macro_parameters[-1])
1.43 @@ -410,11 +413,21 @@
1.44 if argnames:
1.45 confargname, moinargname = argnames
1.46 parameters["args"] = quote_macro_argument("%s=%s" % (moinargname, self.macro_parameters[-1][confargname]))
1.47 +
1.48 + # Obtain the Moin macro with parameters substituted.
1.49 +
1.50 text = conversion % parameters
1.51 if self.macros[-1] == "anchor" and self.forbids_macros():
1.52 self.held_anchors.append(text)
1.53 text = ""
1.54
1.55 + # Warn about macros that are not converted.
1.56 +
1.57 + elif not macro_rich_text_styles.has_key(self.macros[-1]):
1.58 + print >>sys.stderr, "No conversion possible for macro", self.macros[-1]
1.59 + print >>sys.stderr, "Macro has arguments", self.macro_parameters[-1]
1.60 + print >>sys.stderr
1.61 +
1.62 # Handle the common cases for parameterised and unparameterised
1.63 # substitutions.
1.64