@@ -34,7 +34,7 @@ def mermaid(diagram=None, theme=None):
34
34
35
35
36
36
@register .tag (name = "startmermaid" )
37
- def do_startmermaid (parser , token ):
37
+ def startmermaid (parser , token ):
38
38
"""Render a mermaid diagram, using a block tag.
39
39
40
40
{% startmermaid "dark" %}
@@ -45,15 +45,13 @@ def do_startmermaid(parser, token):
45
45
This tag is identical to the {% mermaid %} simple tag but allows usage as a block.
46
46
That can be useful for longer diagrams. Specifying the theme is optional.
47
47
"""
48
- # Split the token to try to capture a theme parameter if provided
48
+
49
49
bits = token .split_contents ()
50
50
if len (bits ) > 1 :
51
- # Strip surrounding quotes
52
51
theme = ast .literal_eval (bits [1 ])
53
52
else :
54
53
theme = None
55
54
56
- # Parse everything until the end tag 'endmermaid'
57
55
nodelist = parser .parse (('endmermaid' ,))
58
56
parser .delete_first_token ()
59
57
@@ -66,8 +64,5 @@ def __init__(self, nodelist, theme):
66
64
self .theme = theme
67
65
68
66
def render (self , context ):
69
- # Render the diagram from the block
70
67
diagram_content = self .nodelist .render (context )
71
- # Pass processing on to the simple template tag
72
68
return mermaid (diagram = diagram_content , theme = self .theme )
73
-
0 commit comments