# dvisvgm 2.6 has a different order of attributes. According to the changelog,
# the SVGs can be now hashed, which hopefully means that the output won't
# change every second day again. Hopefully.
+#
+# dvisvgm 2.12 does not necessarily specify the patch version number.
_patch26_src = re.compile(r"""<\?xml version='1\.0' encoding='UTF-8'\?>
-<!-- This file was generated by dvisvgm \d+\.\d+\.\d+ -->
+<!-- This file was generated by dvisvgm \d+\.\d+(\.\d+)? -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='(?P<width>[^']+)pt' height='(?P<height>[^']+)pt' viewBox='(?P<viewBox>[^']+)'>
""")
viewBox=match.group('viewBox'),
attribs=attribs,
formula=html.escape(formula))
+
# There are two incompatible preambles, if the first fails try the second
svg, found = _patch_src.subn(repl, svg)
if not found:
svg, found = _patch26_src.subn(repl, svg)
- assert found
+ assert found, "dvisgm preamble is incompatible with this version of m.css"
# Make element IDs unique
global counter