From e042d5bc7ee104be4004d2f7a5f253ef814314ba Mon Sep 17 00:00:00 2001 From: Bert Burgemeister Date: Sun, 19 Jun 2016 14:36:26 +0200 Subject: [PATCH] Improve web page build process - Clean up dependencies in Makefile. - Introduce a table of contents. - Automatically check for dead links. - Various minor edits. --- .gitignore | 2 +- Makefile | 166 ++++++++++++++++++++++++++-------------- widget-examples/colorbutton.ui | 1 + widget-examples/drawingarea.txt | 10 +++ widget-examples/eventbox.ui | 2 + widget-examples/label.ui | 2 + widget-examples/plug.ui | 2 + widget-examples/socket.ui | 7 +- widget-examples/spinner.ui | 2 + widget-examples/statusbar.ui | 2 +- www-template/a-hrefs.xsl | 19 +++++ www-template/index-toc.xsl | 67 ++++++++++++++++ www-template/index.html | 109 +++++++++++++------------- www-template/style.css | 2 +- 14 files changed, 276 insertions(+), 117 deletions(-) create mode 100644 www-template/a-hrefs.xsl create mode 100644 www-template/index-toc.xsl diff --git a/.gitignore b/.gitignore index a37bd9a..3510afd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,11 +4,11 @@ *.err *.gmon *.gprof +*.jpg *.log *.pdf *.ps *.svg -*.txt *fifo *~ \#*# diff --git a/Makefile b/Makefile index 00a2ffe..ddce7f4 100644 --- a/Makefile +++ b/Makefile @@ -68,14 +68,33 @@ clean: ###################################################################### VERSION != (which git >/dev/null && git describe --tags || echo "NONE") | cut -d "-" -f 1 CODE_VERSION != awk '/\#define VERSION/{print $$3}' pipeglade.c | tr -d '"' -NEWS_VERSION != awk '/^[0-9]+.[0-9]+.[0-9]+ .*(.+)/{print $$1}' NEWS | head -n1 -NEWS_DATE != awk '/^[0-9]+.[0-9]+.[0-9]+ .*(.+)/{print substr($$2, 2, 10)}' NEWS | head -n1 +NEWS_VERSION != awk '/^[0-9]+\.[0-9]+\.[0-9]+ .*([0-9]+-[01][0-9]-[0-3][0-9])/{print $$1}' NEWS | head -n1 +NEWS_DATE != awk '/^[0-9]+\.[0-9]+\.[0-9]+ .*([0-9]+-[01][0-9]-[0-3][0-9])/{print substr($$2, 2, 10)}' NEWS | head -n1 TODAY != date +%F MANPAGE_DATE != grep "^\.Dd " pipeglade.1 MANPAGE_TODAY != date '+.Dd %B %e, %Y' | awk '{print $$1, $$2, $$3, $$4}' .SUFFIXES: .ui .svg .jpg +# Create a new git tag only if there is a NEWS headline in the format +# 1.2.3 (2015-03-22) + +# where 1.2.3 matches the current pipeglade version and the date is of +# today, and if pipeglade.1 has today's date in its .Dd line. +# (NEWS headlines are lines that start at column 0.) +git-tag: + @if test "$(NEWS_DATE)" != "$(TODAY)"; then \ + echo "NEWS: $(NEWS_DATE) != $(TODAY)"; false; \ + fi + @if test "$(NEWS_VERSION)" != "$(CODE_VERSION)"; then \ + echo "NEWS: $(NEWS_VERSION) != $(CODE_VERSION)"; false; \ + fi + @if test "$(MANPAGE_DATE)" != "$(MANPAGE_TODAY)"; then \ + echo "MANPAGE: $(MANPAGE_DATE) != $(MANPAGE_TODAY)"; false; \ + fi + git tag $(CODE_VERSION); + + # Extract a list of actions from source code... prog-actions: @awk -F\" '/eql\((ud->)?action, \"[a-zA-Z0-9_-]+\"/{print $$2}' pipeglade.c | sort -u @@ -102,85 +121,118 @@ done-list: # Prepare the www directory -gh-pages: clean gh-pages/index.html gh-pages/pipeglade.1.html gh-pages/clock.svg ${SNAPSHOTS} +GH_PAGES_SIMPLE = style.css CNAME README robots.txt +GH_PAGES_PUBLIC = ${GH_PAGES_SIMPLE} pipeglade.1.html pipeglade.1.pdf clock.jpg clock.ui.txt clock.sh.txt 404.html +GH_PAGES_TEMP = LICENSE gallery.html index-hrefs +.if ${.MAKE.LEVEL} == 0 +WIDGETS != make man-widgets +.endif +WIDGET_TXTS != ls -1 widget-examples | grep "\.txt$$" +SNAPSHOTS = ${WIDGETS:C|(.*)|gh-pages/\1.jpg|} -gh-pages/index.html: pipeglade gh-pages/pipeglade.1.html www-template/index.html Makefile gh-pages/gallery.html - cp clock.sh gh-pages/clock.sh.txt - cp clock.ui gh-pages/clock.ui.txt - cp LICENSE gh-pages/ - echo -e '/@/\ns//\>/\n,s/^$$/

/\nwq' | ed -s gh-pages/LICENSE +gh-pages: gh-pages-untested test-index-hrefs + rm -f ${GH_PAGES_TEMP:S|^|gh-pages/|} + +gh-pages-untested: ${GH_PAGES_PUBLIC:S|^|gh-pages/|} ${SNAPSHOTS} gh-pages/index.html + +.for FILE in ${GH_PAGES_SIMPLE} +gh-pages/${FILE}: www-template/${FILE} + @mkdir -p gh-pages + cp ${.ALLSRC} ${.TARGET} +.endfor + +gh-pages/index.html: pipeglade gh-pages/pipeglade.1.html www-template/index.html \ + gh-pages/gallery.html gh-pages/LICENSE \ + www-template/statcounter.html www-template/index-toc.xsl Makefile + xsltproc --html -o ${.TARGET} www-template/index-toc.xsl www-template/index.html echo -e '//d\n-r gh-pages/gallery.html\nwq' | ed -s gh-pages/index.html echo -e '//d\n-r gh-pages/LICENSE\nwq' | ed -s gh-pages/index.html echo -e ',s/_PUT_VERSION_HERE_/$(VERSION)/g\nwq' | ed -s gh-pages/index.html - echo -e '/<\/body>/-r gh-pages/statcounter.html\nwq' | ed -s gh-pages/index.html - echo -e '/<\/body>/-r gh-pages/statcounter.html\nwq' | ed -s gh-pages/404.html - rm -f gh-pages/statcounter.html gh-pages/LICENSE + echo -e '/<\/body>/-r www-template/statcounter.html\nwq' | ed -s gh-pages/index.html -gh-pages/pipeglade.1.html: pipeglade.1 Makefile - mkdir -p gh-pages - cp www-template/* gh-pages/ +gh-pages/LICENSE: LICENSE Makefile + @mkdir -p gh-pages + sed 's/&/\&/g; s//\>/g; s/"/\"/g; s/'"'"'/\'/g; s|^$$|

|g' ${.TARGET} + +gh-pages/404.html: gh-pages/pipeglade.1.html Makefile www-template/statcounter.html + @mkdir -p gh-pages + cp www-template/404.html gh-pages/ + echo -e '/<\/body>/-r www-template/statcounter.html\nwq' | ed -s gh-pages/404.html + +gh-pages/clock.sh.txt gh-pages/clock.ui.txt: clock.sh clock.ui + @mkdir -p gh-pages + cp clock.sh gh-pages/clock.sh.txt + cp clock.ui gh-pages/clock.ui.txt + +gh-pages/pipeglade.1.html gh-pages/pipeglade.1.pdf: pipeglade.1 Makefile www-template/statcounter.html + @mkdir -p gh-pages mandoc -Wall -T xhtml -O style=style.css pipeglade.1 > gh-pages/pipeglade.1.html mandoc -Wall -T pdf -O paper=a4 pipeglade.1 > gh-pages/pipeglade.1.pdf - echo -e '/<\/body>/-r gh-pages/statcounter.html\nwq' | ed -s gh-pages/pipeglade.1.html + echo -e '/<\/body>/-r www-template/statcounter.html\nwq' | ed -s gh-pages/pipeglade.1.html -gh-pages/clock.svg: clock.sh clock.ui pipeglade - mkdir -p gh-pages - ./clock.sh gh-pages/clock.svg +gh-pages/clock.jpg: clock.svg + @mkdir -p gh-pages + convert "${.ALLSRC}" -frame 2 "${.TARGET}" + +clock.svg: clock.sh clock.ui pipeglade + ./clock.sh ${.TARGET} # Screenshots of the widget examples -.if ${.MAKE.LEVEL} == 0 -WIDGETS != make man-widgets -.endif -SNAPSHOTS = ${WIDGETS:C|(.*)|gh-pages/\1.jpg|} -snapshots: pipeglade ${SNAPSHOTS} Makefile .for W in ${WIDGETS} +.if exists(widget-examples/${W:S/Gtk//:tl}.txt) +gh-pages/${W:S/$/.jpg/}: widget-examples/${W:S/Gtk//:tl}.ui widget-examples/${W:S/Gtk//:tl}.txt + @echo "creating widget snapshot ${.TARGET}" + @mkdir -p gh-pages + @echo "_:load widget-examples/${W:S/Gtk//:tl}.txt" | \ + ./pipeglade -u widget-examples/${W:S/Gtk//:tl}.ui >/dev/null + @convert "${.TARGET:R}.svg" -resize 90% -frame 2 "${.TARGET}" && rm "${.TARGET:R}.svg" +.else gh-pages/${W:S/$/.jpg/}: widget-examples/${W:S/Gtk//:tl}.ui + @echo "creating widget snapshot ${.TARGET}" @mkdir -p gh-pages - @if test -e "${.ALLSRC:R}.txt"; then \ - echo "_:load ${.ALLSRC:R}.txt"; \ - else \ - echo "main:snapshot ${.TARGET:R}.svg"; echo "_:main_quit"; \ - fi | ./pipeglade -u ${.ALLSRC} >/dev/null - convert "${.TARGET:R}.svg" -resize 90% -frame 2 "${.TARGET}" && rm "${.TARGET:R}.svg" + @(echo "main:snapshot ${.TARGET:R}.svg"; echo "_:main_quit") | \ + ./pipeglade -u ${.ALLSRC} >/dev/null + @convert "${.TARGET:R}.svg" -resize 90% -frame 2 "${.TARGET}" && rm "${.TARGET:R}.svg" +.endif .endfor gh-pages/gallery.html: ${SNAPSHOTS} - for i in ${.ALLSRC:T:R}; do \ - echo "

"; \ - echo "

"; \ - echo " "; \ - echo -n " "; \ + echo "
"; \ + echo " "; \ + echo -n " $${i}"; \ - echo " "; \ - echo " (cf. GTK+ 3 Reference Manual)"; \ - echo "
"; \ - echo " "; \ - echo "
"; \ - echo "

"; \ + echo "
"; \ + echo " (cf. GTK+ 3 Reference Manual)"; \ + echo "
"; \ + echo " "; \ + echo "
"; \ done > ${.TARGET} -# Create a new git tag only if there is a NEWS headline in the format -# 1.2.3 (2015-03-22) -# where 1.2.3 matches the current pipeglade version and the date is of -# today, and if pipeglade.1 has today's date in its .Dd line. -# (NEWS headlines are lines that start at column 0.) -git-tag: - if test "$(NEWS_DATE)" != "$(TODAY)"; then \ - echo "NEWS: $(NEWS_DATE) != $(TODAY)"; false; \ - fi; \ - if test "$(NEWS_VERSION)" != "$(CODE_VERSION)"; then \ - echo "NEWS: $(NEWS_VERSION) != $(CODE_VERSION)"; false; \ - fi; \ - if test "$(MANPAGE_DATE)" != "$(MANPAGE_TODAY)"; then \ - echo "MANPAGE: $(MANPAGE_DATE) != $(MANPAGE_TODAY)"; false; \ - fi; \ - git tag $(CODE_VERSION); +# Do we have dead links? +gh-pages/index-hrefs: gh-pages/index.html www-template/a-hrefs.xsl + xsltproc --html www-template/a-hrefs.xsl gh-pages/index.html | grep -E "^http.?://" | grep -v "../github.com/trebb/pipeglade" > ${.TARGET} + +test-index-hrefs: gh-pages/index-hrefs + @echo "checking for dead links..." + @for i in `cat ${.ALLSRC}`; do \ + if curl -w %{http_code} -s -o /dev/null $$i | grep -q 200; then \ + echo -n "$$i "; \ + else \ + echo; echo "dead link: $$i"; \ + break; \ + fi; \ + done + @echo + # Push the www directory to Github Pages -publish: clean gh-pages +publish: gh-pages (cd gh-pages; \ git init; \ git add ./; \ diff --git a/widget-examples/colorbutton.ui b/widget-examples/colorbutton.ui index 2a518f3..914357e 100644 --- a/widget-examples/colorbutton.ui +++ b/widget-examples/colorbutton.ui @@ -6,6 +6,7 @@ False + 150 True True True diff --git a/widget-examples/drawingarea.txt b/widget-examples/drawingarea.txt index b8f15fe..e89f922 100644 --- a/widget-examples/drawingarea.txt +++ b/widget-examples/drawingarea.txt @@ -4,9 +4,19 @@ drawingarea1:set_source_rgba 1 red drawingarea1:set_line_width 1 6 drawingarea1:set_line_cap 1 round drawingarea1:stroke 1 + drawingarea1:rotate 1 3 drawingarea1:rectangle 1 50 50 90 70 drawingarea1:set_source_rgba 1 rgba(50,50,50,.5) drawingarea1:fill 1 + +drawingarea1:rotate 1 -50 +drawingarea1:move_to 1 -50 100 +drawingarea1:rel_move_for 1 w Pipeglade! +drawingarea1:set_font_face 1 italic normal STIXGeneral +drawingarea1:set_font_size 1 24 +drawingarea1:set_source_rgba 1 darkblue +drawingarea1:show_text 1 Pipeglade! + main:snapshot gh-pages/GtkDrawingArea.svg _:main_quit diff --git a/widget-examples/eventbox.ui b/widget-examples/eventbox.ui index 6772d6b..ba823d9 100644 --- a/widget-examples/eventbox.ui +++ b/widget-examples/eventbox.ui @@ -4,6 +4,8 @@ False + 150 + 100 True diff --git a/widget-examples/label.ui b/widget-examples/label.ui index 4c98dee..356a259 100644 --- a/widget-examples/label.ui +++ b/widget-examples/label.ui @@ -4,6 +4,8 @@ False + 70 + 30 True diff --git a/widget-examples/plug.ui b/widget-examples/plug.ui index ac81560..b6694a5 100644 --- a/widget-examples/plug.ui +++ b/widget-examples/plug.ui @@ -4,6 +4,8 @@ False + 20 + 20 diff --git a/widget-examples/socket.ui b/widget-examples/socket.ui index dc4ef5a..d134ced 100644 --- a/widget-examples/socket.ui +++ b/widget-examples/socket.ui @@ -4,16 +4,13 @@ False + 20 + 20 True True - - True - True - 3 - diff --git a/widget-examples/spinner.ui b/widget-examples/spinner.ui index f93a269..cc0193e 100644 --- a/widget-examples/spinner.ui +++ b/widget-examples/spinner.ui @@ -4,6 +4,8 @@ False + 40 + 30 True diff --git a/widget-examples/statusbar.ui b/widget-examples/statusbar.ui index 65707ab..abbbb7b 100644 --- a/widget-examples/statusbar.ui +++ b/widget-examples/statusbar.ui @@ -5,7 +5,7 @@ False 200 - 150 + 100 True diff --git a/www-template/a-hrefs.xsl b/www-template/a-hrefs.xsl new file mode 100644 index 0000000..4c23f54 --- /dev/null +++ b/www-template/a-hrefs.xsl @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/www-template/index-toc.xsl b/www-template/index-toc.xsl new file mode 100644 index 0000000..d9d8ef6 --- /dev/null +++ b/www-template/index-toc.xsl @@ -0,0 +1,67 @@ + + + + + + + + + +

+ + + + +

+
+ + + + + + + + + # + + + + + + + + + + + + + + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
diff --git a/www-template/index.html b/www-template/index.html index fe643c4..6c55130 100644 --- a/www-template/index.html +++ b/www-template/index.html @@ -1,5 +1,5 @@ - + PIPEGLADE @@ -11,11 +11,16 @@

PIPEGLADE
Graphical User Interfaces, The UNIX Way

+

+ blha balh blah + +
+

Pipeglade is a helper program that displays graphical user interfaces for other programs. It renders the GUI definition found in a GtkBuilder file (created using the - Glade Interface + Glade Interface Designer), and communicates with the main program solely via pipes or fifos.

@@ -34,95 +39,95 @@

- Widgets + Widgets of any kind can grab focus and change visibility, - sensitivity, style, + sensitivity, style, size, and tooltip.

DOCUMENTATION

Pipeglade has a manual page: - pipeglade(1)[HTML], - pipeglade(1)[PDF] + pipeglade(1)[HTML], + pipeglade(1)[PDF]
-

SOURCE CODE

- +

WIDGET GALLERY

+

EXAMPLE

- The shell script clock.sh uses + The shell script clock.sh uses pipeglade to display an analog clock on the interface defined in the GtkBuilder - file clock.ui. The script was + file clock.ui. The script was also used to generate the image below.

- +

-

WIDGET GALLERY

- +

SOURCE CODE

+

LICENSE

diff --git a/www-template/style.css b/www-template/style.css index 09201bf..6b9f116 100644 --- a/www-template/style.css +++ b/www-template/style.css @@ -16,7 +16,7 @@ div.mandoc td { vertical-align: top; } /* All table cells. */ div.mandoc p { } /* Paragraph: Pp, Lp. */ div.mandoc blockquote { margin-left: 5ex; margin-top: 0ex; margin-bottom: 0ex; } /* D1, Dl. */ div.mandoc div.section { margin-bottom: 2ex; margin-left: 5ex; } /* Sections (Sh, SH). */ -div.mandoc div.subsection { } /* Sub-sections (Ss, SS). */ +div.mandoc div.subsection { margin-bottom: 4ex; } /* Sub-sections (Ss, SS). */ div.mandoc table.synopsis { } /* SYNOPSIS section table. */ div.mandoc table.foot { } /* Document footer. */ div.mandoc td.foot-date { width: 50%; } /* Document footer: date. */ -- 2.11.4.GIT