From: Vladimír Vondruš
Date: Fri, 22 Feb 2019 18:30:09 +0000 (+0100)
Subject: m.dot: support plaintext node shapes as well.
X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=90c0a5212afc35b5430d7014621d444c97c474cd;p=blog.git
m.dot: support plaintext node shapes as well.
---
diff --git a/pelican-plugins/dot2svg.py b/pelican-plugins/dot2svg.py
index 6c68ce41..d7984d55 100644
--- a/pelican-plugins/dot2svg.py
+++ b/pelican-plugins/dot2svg.py
@@ -42,7 +42,7 @@ _comment_src = re.compile(r"""\n""")
# Graphviz < 2.40 (Ubuntu 16.04 and older) doesn't have a linebreak between
# and
_class_src = re.compile(r"""[\n]?(?P[^<]*)
-<(?Pellipse|polygon|path) fill="(?P[^"]+)" stroke="[^"]+" """)
+<(?Pellipse|polygon|path|text)( fill="(?P[^"]+)" stroke="[^"]+")? """)
_class_dst = r"""
{title}
@@ -99,7 +99,10 @@ def dot2svg(source, size=None, attribs=''):
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(
diff --git a/pelican-plugins/m/test/dot/page-238.html b/pelican-plugins/m/test/dot/page-238.html
index e8607d6d..f3118a8f 100644
--- a/pelican-plugins/m/test/dot/page-238.html
+++ b/pelican-plugins/m/test/dot/page-238.html
@@ -67,6 +67,17 @@ and the arrowheads, nothing else. Non-default font size should be preserved.
+
+
+
Colors:
+
+
+
Colors: