[Telepathy-commits] [telepathy-doc/master] Make it possible to do validation more sanely

Davyd Madeley davyd at madeley.id.au
Wed Mar 18 00:31:00 PDT 2009


---
 docs/book/Makefile.am        |   12 +++++++++---
 docs/book/insert-examples.py |    8 +++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/docs/book/Makefile.am b/docs/book/Makefile.am
index 37f8b86..04d3e9b 100644
--- a/docs/book/Makefile.am
+++ b/docs/book/Makefile.am
@@ -99,9 +99,15 @@ pdf/telepathy.pdf: $(MAIN)
 pdf: pdf/telepathy.pdf
 
 
-# Validate the source XML, not the one with the examples added in:
-validate: C/$(DOC_MODULE).xml
-	$(XMLLINT) --xinclude --postvalid --noout $<
+# Validate the source XML, to check for XML correctness but not DTD validation
+raw-validate: C/$(DOC_MODULE).xml
+	$(XMLLINT) --xinclude --noout $<
+
+# Validate the compiled XML for DTD correctness after validating the source XML
+# for XML well-formedness
+validate: raw-validate $(MAIN)
+	@echo "----------------------------------------------------------"
+	$(XMLLINT) --xinclude --postvalid --noout $(MAIN)
 
 include $(top_srcdir)/docs/rsync-properties.make
 include $(top_srcdir)/docs/generate-figures.make
diff --git a/docs/book/insert-examples.py b/docs/book/insert-examples.py
index f6fccc4..dde3a31 100755
--- a/docs/book/insert-examples.py
+++ b/docs/book/insert-examples.py
@@ -33,7 +33,7 @@ for example in examples:
 	nicename = example.get ('file')
 	filename = os.path.join (examplesdir, nicename)
 
-	# del (example.attrib['file']) # unset the file property
+	del example.attrib['file'] # unset the file property
 
 	# attempt to load the file
 	try:
@@ -72,7 +72,8 @@ for example in examples:
 
 	etree.SubElement (example, 'programlisting').text = etree.CDATA (contents)
 	p = etree.SubElement (example, 'para')
-	etree.SubElement (p, 'link', linkend='appendix.source-code.%s' % nicename).text = "Complete Source Code"
+	xmlname = re.sub (r'/', '.', nicename)
+	etree.SubElement (p, 'link', linkend='appendix.source-code.%s' % xmlname).text = "Complete Source Code"
 
 	f.close ()
 
@@ -80,9 +81,10 @@ for example in examples:
 appendix = doc.xpath ('/book/appendix[@id="source-code"]')[0]
 for nicename in included_files:
 	filename = os.path.join (examplesdir, nicename)
+	xmlname = re.sub (r'/', '.', nicename)
 
 	s = etree.SubElement (appendix, 'sect1',
-				id='appendix.source-code.%s' % nicename)
+				id='appendix.source-code.%s' % xmlname)
 	etree.SubElement (s, 'title').text = nicename
 
 	try:
-- 
1.5.6.5




More information about the telepathy-commits mailing list