# Graphviz < 2.40 (Ubuntu 16.04 and older) doesn't have a linebreak between <g>
# and <title>
_class_src = re.compile(r"""<g id="(edge|node)\d+" class="(?P<type>edge|node)(?P<classes>[^"]*)">[\n]?<title>(?P<title>[^<]*)</title>
-<(?P<element>ellipse|polygon|path) fill="(?P<fill>[^"]+)" stroke="[^"]+" """)
+<(?P<element>ellipse|polygon|path|text)( fill="(?P<fill>[^"]+)" stroke="[^"]+")? """)
_class_dst = r"""<g class="{classes}">
<title>{title}</title>
def element_repl(match):
classes = ['m-' + match.group('type')] + match.group('classes').replace('-', '-').split()
# distinguish between solid and filled nodes
- if match.group('type') == 'node' and match.group('fill') == 'none':
+ if ((match.group('type') == 'node' and match.group('fill') == 'none') or
+ # a plaintext node is also flat
+ match.group('element') == 'text'
+ ):
classes += ['m-flat']
return _class_dst.format(
</g>
</svg>
</div>
+<div class="m-graph">
+<svg style="width: 5.625rem; height: 2.750rem;" viewBox="0.00 0.00 90.00 44.00">
+<g transform="scale(1 1) rotate(0) translate(4 40)">
+<title>More shapes</title>
+<g class="m-node m-flat">
+<title>d</title>
+<text text-anchor="middle" x="41" y="-14.2">outsider</text>
+</g>
+</g>
+</svg>
+</div>
<p>Colors:</p>
<div class="m-graph">
<svg style="width: 5.750rem; height: 8.500rem;" viewBox="0.00 0.00 92.38 135.54">
</g>
</svg>
</div>
+<div class="m-graph">
+<svg style="width: 5.562rem; height: 2.750rem;" viewBox="0.00 0.00 89.00 44.00">
+<g transform="scale(1 1) rotate(0) translate(4 40)">
+<title>More shapes</title>
+<g class="m-node m-flat">
+<title>d</title>
+<text text-anchor="middle" x="40.5" y="-14.2">outsider</text>
+</g>
+</g>
+</svg>
+</div>
<p>Colors:</p>
<div class="m-graph">
<svg style="width: 5.688rem; height: 8.500rem;" viewBox="0.00 0.00 91.38 135.54">