]> granicus.if.org Git - graphviz/commitdiff
Inline shapes.3 into shapes.html.j2
authorMark Hansen <mark@markhansen.co.nz>
Tue, 2 Jun 2020 11:06:37 +0000 (21:06 +1000)
committerMark Hansen <mark@markhansen.co.nz>
Tue, 2 Jun 2020 11:06:37 +0000 (21:06 +1000)
Now shapes.html.j2 is a complete template for the shapes.html page.

doc/infosrc/Makefile
doc/infosrc/mkshhtml.py
doc/infosrc/shapes.3 [deleted file]
doc/infosrc/templates/shapes.html.j2

index f95af5b1b64c2c5de6984232f3477ce096bbd909..8ad0c33307fbdd4608c3260318a1527e221c4810 100644 (file)
@@ -156,10 +156,8 @@ shapes : shapelist mkshapes.sh
        ./mkshapes.sh
        touch shapes
  
-shapes.html : shapes mkshhtml.py html.html shapes.3 record.gif record2.gif sdlshapes.png templates/shapes.html.j2
-       ./mkshhtml.py < shapelist > shapes.html
-       cat html.html >> shapes.html
-       cat shapes.3 >> shapes.html
+shapes.html : shapes mkshhtml.py html.html record.gif record2.gif sdlshapes.png templates/shapes.html.j2 shapelist
+       ./mkshhtml.py html.html < shapelist > shapes.html
 
 lang.html : grammar lang.1 lang.2 mklang
        ./mklang grammar gramtmp
index 57f227534c75511f27a461705816b5b137155844..7314bd8d318cc125bf505824becb2cd90a1eee2c 100755 (executable)
@@ -1,18 +1,15 @@
 #!/usr/bin/env python3
+# Generates shapes.html. Takes path to an html.html file to include as argv[1],
+# and a shapelist on stdin.
 
-from dataclasses import dataclass
 import jinja2
 import markupsafe
-import re
 import sys
-from typing import List, Dict
+from typing import List
 
-N_PER_ROW=4
+N_PER_ROW = 4
 
-shapes = []
-for line in sys.stdin:
-  shape = line.strip()
-  shapes.append(shape)
+shapes = [line.strip() for line in sys.stdin]
 
 # From https://stackoverflow.com/a/312464/171898
 def chunks(lst, n):
@@ -35,4 +32,7 @@ env = jinja2.Environment(
     undefined=jinja2.StrictUndefined,
 )
 template = env.get_template('shapes.html.j2')
-print(template.render(rows=chunks(shapes, N_PER_ROW)))
+print(template.render(
+    html=markupsafe.Markup(open(sys.argv[1]).read()),
+    rows=chunks(shapes, N_PER_ROW),
+))
diff --git a/doc/infosrc/shapes.3 b/doc/infosrc/shapes.3
deleted file mode 100644 (file)
index d9636d2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-<H2><A NAME=epsf>User-defined Nodes</A></H2>
-
-There is a third type of node shape which is specified by the user.
-Typically, these shapes rely on the details of a concrete graphics
-format. At present, shapes can be described using PostScript, via a
-file or add-on library, for use in PostScript output, or shapes can
-be specified by a bitmap-image file for use with SVG or bitmap (jpeg,
-gif, etc.) output. More information can be found on the page 
-<A HREF="../../../faq/#FaqCustShape">
-How to create custom shapes</A>.
-
-<H2><A NAME=sdlshapes>SDL Shapes for PostScript</A></H2>
-One example of user-defined node shapes is provided by Mark Rison of CSR.
-These are the <A  HREF=http://www.sdl-forum.org/SDL/index.htm>SDL</A> shapes.
-These are available as PostScript functions whose use is described in
-<A HREF="../../../faq/#ext_ps_proc"> External PostScript procedures</A>.
-The necessary PostScript library file and sample use can be found in the
-<tt>contrib/sdlshapes</tt> directory in the release. Please note the
-COPYRIGHT AND PERMISSION NOTICE contained in the library file <tt>sdl.ps</tt>.
-<P>
-The table below
-gives the shape names and the corresponding node shapes.
-<P>
-<CENTER>
-<IMG SRC=sdlshapes.png>
-</CENTER>
-</BODY>
-</HTML>
index fbdd1016aec9d393d52697db3a0f40733fdc8c95..0e3d3d44d2c784d6541b037635d5fe6a0f8ef05d 100644 (file)
@@ -278,3 +278,32 @@ See also <A HREF=attrs.html#d:penwidth>penwidth</A>.
 
 <P>
 Additional styles may be available with a specific code generator.
+{{ html -}}
+<H2><A NAME=epsf>User-defined Nodes</A></H2>
+
+There is a third type of node shape which is specified by the user.
+Typically, these shapes rely on the details of a concrete graphics
+format. At present, shapes can be described using PostScript, via a
+file or add-on library, for use in PostScript output, or shapes can
+be specified by a bitmap-image file for use with SVG or bitmap (jpeg,
+gif, etc.) output. More information can be found on the page 
+<A HREF="../../../faq/#FaqCustShape">
+How to create custom shapes</A>.
+
+<H2><A NAME=sdlshapes>SDL Shapes for PostScript</A></H2>
+One example of user-defined node shapes is provided by Mark Rison of CSR.
+These are the <A  HREF=http://www.sdl-forum.org/SDL/index.htm>SDL</A> shapes.
+These are available as PostScript functions whose use is described in
+<A HREF="../../../faq/#ext_ps_proc"> External PostScript procedures</A>.
+The necessary PostScript library file and sample use can be found in the
+<tt>contrib/sdlshapes</tt> directory in the release. Please note the
+COPYRIGHT AND PERMISSION NOTICE contained in the library file <tt>sdl.ps</tt>.
+<P>
+The table below
+gives the shape names and the corresponding node shapes.
+<P>
+<CENTER>
+<IMG SRC=sdlshapes.png>
+</CENTER>
+</BODY>
+</HTML>