From: Mark Hansen Date: Mon, 1 Mar 2021 09:42:10 +0000 (+1100) Subject: Use python template to generate colors.html X-Git-Tag: 2.47.0~19^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7e1e366f2fbae44787cb95e98728711128ca0955;p=graphviz Use python template to generate colors.html One step closer to migrating this to the other repo as a jekyll file. Confirmed with diff that the only differences are extra blank lines, nothing important. --- diff --git a/doc/infosrc/Makefile b/doc/infosrc/Makefile index cab642db7..09c03378c 100644 --- a/doc/infosrc/Makefile +++ b/doc/infosrc/Makefile @@ -114,19 +114,15 @@ sdlshapes.ps : sdlshapes.dot sdlshapes.png : sdlshapes.ps ./ps_to_png.sh sdlshapes.ps sdlshapes.png -colors.html : colors.1 colors.n ../../lib/common/color_names ../../lib/common/svgcolor_names ../../lib/common/brewer_colors mkcolors.awk brewer.awk svg.awk +colors.html : ../../lib/common/color_names ../../lib/common/svgcolor_names ../../lib/common/brewer_colors mkcolors.awk brewer.awk svg.awk mkcolors.py mkdir -p colortmp awk -f brewer.awk ../../lib/common/brewer_colors - cat colors.1 > colors.html - awk -f mkcolors.awk ../../lib/common/color_names >> colors.html - echo '

The SVG color scheme

' >> colors.html + awk -f mkcolors.awk ../../lib/common/color_names > x11_colors.html awk -f svg.awk ../../lib/common/svgcolor_names > svg - awk -f mkcolors.awk svg >> colors.html - rm -rf svg - echo '

Brewer color schemes

' >> colors.html - (for f in $$(ls colortmp); do awk -f mkcolors.awk -s colortmp/$$f >> colors.html; done) - cat colors.n >> colors.html - rm -rf colortmp + awk -f mkcolors.awk svg > svg_colors.html + (for f in $$(ls colortmp); do awk -f mkcolors.awk -s colortmp/$$f; done) > brewer_colors.html + ./mkcolors.py x11_colors.html svg_colors.html brewer_colors.html > colors.html + rm -rf svg colortmp x11_colors.html svg_colors.html brewer_colors.html schema.html : jconvert.py graphviz_json_schema.json @@ -195,7 +191,7 @@ distclean : clean EXTRA_DIST = $(XGIF) mklang.y mkarrows.sh mkshapes.sh mkstyles.sh mktapers.sh \ mkarrowtbl.sh mkshhtml.py \ ps_to_png.sh arrow_grammar grammar html_grammar \ - shapelist colors.1 colors.n \ + shapelist \ shapes.1 shapes.2 shapes.3 lang.1 lang.2 arrows.1 arrows.2 \ brewer.awk mkcolors.awk svg.awk sz.awk \ colorlist.dot html1.dot html4.dot round.dot constraint.dot \ diff --git a/doc/infosrc/colors.1 b/doc/infosrc/colors.1 deleted file mode 100644 index 60aa0841a..000000000 --- a/doc/infosrc/colors.1 +++ /dev/null @@ -1,22 +0,0 @@ - - - - -Color Names - - - -

Color Names

-Color names are resolved in the context of a -color scheme. Graphviz currently -supports the X11 scheme, -the SVG scheme, and the Brewer schemes, -with X11 being the default. -

-Color names are case-insensitive. -

-The Brewer color schemes below are covered by this license. -


-

The X11 color scheme

diff --git a/doc/infosrc/mkcolors.py b/doc/infosrc/mkcolors.py new file mode 100755 index 000000000..73c8f78b6 --- /dev/null +++ b/doc/infosrc/mkcolors.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# Generates colors.html. Takes color files as args. + +import markupsafe +import sys +import templates + +template = templates.env().get_template('colors.html.j2') +print(template.render( + x11_colors=markupsafe.Markup(open(sys.argv[1]).read()), + svg_colors=markupsafe.Markup(open(sys.argv[2]).read()), + brewer_colors=markupsafe.Markup(open(sys.argv[3]).read()), +)) diff --git a/doc/infosrc/colors.n b/doc/infosrc/templates/colors.html.j2 similarity index 71% rename from doc/infosrc/colors.n rename to doc/infosrc/templates/colors.html.j2 index f707f5f10..8adebc972 100644 --- a/doc/infosrc/colors.n +++ b/doc/infosrc/templates/colors.html.j2 @@ -1,3 +1,30 @@ + + + + +Color Names + + + +

Color Names

+Color names are resolved in the context of a +color scheme. Graphviz currently +supports the X11 scheme, +the SVG scheme, and the Brewer schemes, +with X11 being the default. +

+Color names are case-insensitive. +

+The Brewer color schemes below are covered by this license. +


+

The X11 color scheme

+{{ x11_colors }} +

The SVG color scheme

+{{ svg_colors }} +

Brewer color schemes

+{{ brewer_colors }}
Apache-Style Software License for ColorBrewer software and ColorBrewer Color Schemes, Version 1.1