From 90c0a5212afc35b5430d7014621d444c97c474cd Mon Sep 17 00:00:00 2001
From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?=
Date: Fri, 22 Feb 2019 19:30:09 +0100
Subject: [PATCH] m.dot: support plaintext node shapes as well.
---
pelican-plugins/dot2svg.py | 7 +++++--
pelican-plugins/m/test/dot/page-238.html | 11 +++++++++++
pelican-plugins/m/test/dot/page.html | 11 +++++++++++
pelican-plugins/m/test/dot/page.rst | 4 ++++
4 files changed, 31 insertions(+), 2 deletions(-)
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: