From: Fabian Keil <fk@fabiankeil.de>
Date: Wed, 31 Aug 2011 13:36:15 +0000 (+0000)
Subject: Add a dok-tidy target to clean up the messy HTML generated by the other dok targets
X-Git-Tag: v_3_0_18~118
X-Git-Url: http://www.privoxy.org/gitweb/@default-cgi@/faq/%22https:/developer-manual/static/@default-cgi@edit-actions-remove-url?a=commitdiff_plain;h=10ba3c68a71fbaca8613684755a98232a5c5765b;p=privoxy.git

Add a dok-tidy target to clean up the messy HTML generated by the other dok targets

Not yet connected to any other target,
but probably should be after some testing.
---

diff --git a/GNUmakefile.in b/GNUmakefile.in
index a7510942..f1ff246b 100644
--- a/GNUmakefile.in
+++ b/GNUmakefile.in
@@ -1,6 +1,6 @@
 # Note:  Makefile is built automatically from Makefile.in
 #
-# $Id: GNUmakefile.in,v 1.198 2011/08/26 16:11:59 fabiankeil Exp $
+# $Id: GNUmakefile.in,v 1.199 2011/08/26 16:12:34 fabiankeil Exp $
 #
 # Written by and Copyright (C) 2001-2010 members of the
 # Privoxy team. http://www.privoxy.org/
@@ -142,6 +142,7 @@ PERL       = perl
 DOC_DIR    = doc/source
 DOC_TMP    = $(DOC_DIR)/tmp
 DOC_STATUS = @DOC_STATUS@
+TIDY       = tidy -modify -indent -clean -wrap 78
 
 # Program to do LF->CRLF
 #
@@ -657,6 +658,22 @@ dok-get:
 	$(WGET) http://www.privoxy.org/docs/$(DOC_FILE) ;\
 	$(TAR) -zxvf $(DOC_FILE)
 
+#############################################################################
+#
+# Try to clean up the generated HTML files.
+#
+# The files are a such a mess that some of them require two tidy runs
+# in row as the first abort prematurely. The vanilla tidy output renders
+# poorly as it contains a bit too much white-space, so we additionally run
+# the files through perl to fix this again.
+#
+#############################################################################
+dok-tidy:
+	for html_file in `find doc/webserver -name "*.html"`; do \
+		$(TIDY) $$html_file || $(TIDY) $$html_file; \
+		$(PERL) -i\'\' -e 's@^\s*<br>\s*$$@@; s@ +$$@@;' -n -p $$html_file; \
+	done
+
 
 #############################################################################
 # Source file dependencies