]> granicus.if.org Git - graphviz/commitdiff
Move arrows.html generation into jinja2 templates.
authorMark Hansen <markhansen@google.com>
Tue, 2 Mar 2021 10:23:08 +0000 (21:23 +1100)
committerMark Hansen <markhansen@google.com>
Tue, 2 Mar 2021 10:23:08 +0000 (21:23 +1100)
In preparation for moving this to Jekyll repo.

doc/infosrc/Makefile
doc/infosrc/arrows.1 [deleted file]
doc/infosrc/mkarrowshtml.py [new file with mode: 0755]
doc/infosrc/mkarrowtbl.sh
doc/infosrc/templates/arrows.html.j2 [moved from doc/infosrc/arrows.2 with 80% similarity]

index 65beecdbbe38c1213a8f9721ec7aeac1001abf0d..9404240d59762cb5560e65aee1d4d8938a6349a5 100644 (file)
@@ -85,6 +85,8 @@ HTML = \
        shapes.html \
        arrows.html \
        schema.html \
+       arrow_grammar.html \
+       arrow_table.html \
        brewer_colors.html \
        svg_colors.html \
        x11_colors.html
@@ -145,13 +147,14 @@ shapes.html : shapes mkshhtml.py record.gif record2.gif sdlshapes.png templates/
 grammar.html : grammar mklang
        ./mklang grammar grammar.html
 
-arrows.html : arrow_grammar arrows.1 arrows.2 mkarrowtbl.sh mklang $(AGIF) $(A2GIF)
-       ./mklang arrow_grammar gramtmp
-       cat arrows.1 > arrows.html
-       cat gramtmp >> arrows.html
-       cat arrows.2 >> arrows.html
-       ./mkarrowtbl.sh $(A2GIF) >> arrows.html
-       rm gramtmp
+arrow_grammar.html: mklang arrow_grammar
+       ./mklang arrow_grammar arrow_grammar.html
+
+arrow_table.html: mkarrowtbl.sh $(A2GIF)
+       ./mkarrowtbl.sh $(A2GIF) >> arrow_table.html
+
+arrows.html : mkarrowshtml.py arrow_grammar.html arrow_table.html $(AGIF)
+       ./mkarrowshtml.py arrow_grammar.html arrow_table.html  > arrows.html
 
 mklang : mklang.y
        yacc mklang.y
diff --git a/doc/infosrc/arrows.1 b/doc/infosrc/arrows.1
deleted file mode 100644 (file)
index 88acccf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<!--
-    This is a generated document.  Do not edit.
--->
-<HTML VERSION="2.0">
-<HEAD>
-<TITLE>Arrow Shapes</TITLE>
-</HEAD>
-<BODY BGCOLOR=white>
-<A NAME="top"></A>
-<H1 ALIGN=CENTER>Arrow Shapes</H1>
-<HR>
-Arrow shapes can be specified and named using the following simple
-grammar. 
-Terminals are shown in bold font and nonterminals in italics.
-Literal characters are given in single quotes.
-Square brackets [ and ] enclose optional items.
-Vertical bars | separate alternatives.
-<TABLE>
diff --git a/doc/infosrc/mkarrowshtml.py b/doc/infosrc/mkarrowshtml.py
new file mode 100755 (executable)
index 0000000..a52da6a
--- /dev/null
@@ -0,0 +1,12 @@
+#!/usr/bin/env python3
+# Generates arrows.html.
+
+import markupsafe
+import sys
+import templates
+
+template = templates.env().get_template('arrows.html.j2')
+print(template.render(
+    arrow_grammar=markupsafe.Markup(open(sys.argv[1]).read()),
+    arrow_table=markupsafe.Markup(open(sys.argv[2]).read()),
+))
index 393de111334fa4278b2b376ed7375ab83ae095db..6e6c1105a403fbf5c45e129711dc07019ef1cf85 100755 (executable)
@@ -22,9 +22,6 @@ function closeLine
   echo "  </TR>"
 }
 
-echo "<CENTER>"
-echo "<TABLE>"
-
 while (( $# > 0 ))
 do
   ARROW=${1%.*}        # abc_arrowname
@@ -50,9 +47,3 @@ do
 done
 
 closeLine
-
-echo "</TABLE>"
-echo "</CENTER>"
-echo "</BODY>"
-echo "</HTML>"
-
similarity index 80%
rename from doc/infosrc/arrows.2
rename to doc/infosrc/templates/arrows.html.j2
index 7986d74b59080a839de900d165df395595b49f5c..513301a6268e4df7fbe516372c7a89518874633d 100644 (file)
@@ -1,3 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<!--
+    This is a generated document.  Do not edit.
+-->
+<HTML VERSION="2.0">
+<HEAD>
+<TITLE>Arrow Shapes</TITLE>
+</HEAD>
+<BODY BGCOLOR=white>
+<A NAME="top"></A>
+<H1 ALIGN=CENTER>Arrow Shapes</H1>
+<HR>
+Arrow shapes can be specified and named using the following simple
+grammar. 
+Terminals are shown in bold font and nonterminals in italics.
+Literal characters are given in single quotes.
+Square brackets [ and ] enclose optional items.
+Vertical bars | separate alternatives.
+<TABLE>
+{{ arrow_grammar }}
 </TABLE>
 <P>
 The primitive shapes are:
@@ -85,3 +105,11 @@ The following display contains the 42 combinations possible with a single
 arrow shape. The node attached to the arrow is not drawn but would appear
 on the right side of the edge.
 <P>
+<CENTER>
+<TABLE>
+{{ arrow_table }}
+</TABLE>
+</CENTER>
+</BODY>
+</HTML>
+