From 3618ffee49d9f9169c9fd48820ed9f949ac83e72 Mon Sep 17 00:00:00 2001
From: John Darrington <john@darrington.wattle.id.au>
Date: Thu, 8 Jul 2010 15:24:11 +0200
Subject: [PATCH] Replace unknown XML entities with their numerical
 counterpart.

Texinfo seems to produce XML entities (such as &copy;) which
are not valid (although they are valid for HTML).  We work
around such problems by post-processing with sed. Here, we
replace these unknown entities with their numeric counterparts.
Such is the advice given at
http://www.dwheeler.com/essays/quotes-in-html.html
---
 doc/automake.mk | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/doc/automake.mk b/doc/automake.mk
index b31aa769b4..af99930f87 100644
--- a/doc/automake.mk
+++ b/doc/automake.mk
@@ -56,7 +56,18 @@ $(srcdir)/doc/pspp.xml: doc/pspp.texinfo $(doc_pspp_TEXINFOS)
 	@$(MKDIR_P)  doc
 	$(MAKEINFO) $(AM_MAKEINFOFLAGS) --docbook -I $(top_srcdir) \
 		$(top_srcdir)/doc/pspp.texinfo -o - \
-		| $(SED) 's/Time-&-Date/Time-\&amp;-Date/g' > $@
+		| $(SED) -e 's/Time-&-Date/Time-\&amp;-Date/g' \
+		-e 's/&ldquo;/\&#8220;/g' \
+		-e 's/&rdquo;/\&#8221;/g' \
+		-e 's/&lsquo;/\&#8216;/g' \
+		-e 's/&rsquo;/\&#8217;/g' \
+		-e 's/&mdash;/\&#8212;/g' \
+		-e 's/&ndash;/\&#8242;/g' \
+		-e 's/&copy;/\&#0169;/g' \
+		-e 's/&minus;/\&#8722;/g' \
+		-e 's/&hellip;/\&#8230;/g' \
+		-e 's/&period;/./g' \
+		> $@
 	$(XMLLINT) --output /dev/null $@ 2>&1 2> /dev/null || ( $(RM) $@ && false )
 
 docbookdir = $(docdir)
-- 
2.30.2