[gtkmm] book: Including example code - a solution



I have discovered XInclude, which can include example code in DocBook.
See the attached patch for an example.

So that problem is solved, but we will need to remove the LGPL license
comment blocks from the example code to avoid cluttering up the book.
Does anyone have an alternative solution?

-- 
Murray Cumming
murray usa net
www.murrayc.com
? xinclude.patch
? figures/.xvpics
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gtkmm-root/doc-tutorial/Makefile.am,v
retrieving revision 1.15
diff -u -r1.15 Makefile.am
--- Makefile.am	16 Nov 2002 03:09:00 -0000	1.15
+++ Makefile.am	29 Nov 2002 14:46:18 -0000
@@ -13,7 +13,7 @@
 # The new XML DocBook way:
 html/index.html: $(docbook_docs)
 	-rm -rf html
-	xsltproc -o html/ --catalogs $(DOCBOOK_STYLESHEET) $<
+	xsltproc -o html/ --xinclude --catalogs $(DOCBOOK_STYLESHEET) $<
 
 gtkmm-tut-html.tar.gz: html/index.html
 	tar cf - figures html | gzip -c --best >$@
Index: gtkmm-tut.xml
===================================================================
RCS file: /cvs/gnome/gtkmm-root/doc-tutorial/gtkmm-tut.xml,v
retrieving revision 1.71
diff -u -r1.71 gtkmm-tut.xml
--- gtkmm-tut.xml	28 Nov 2002 14:06:04 -0000	1.71
+++ gtkmm-tut.xml	29 Nov 2002 14:46:22 -0000
@@ -8,7 +8,7 @@
   <!ENTITY url_examples_base "../../../examples/book/">
 ]>
 
-<book>
+<book xmlns:xi="http://www.w3.org/2001/XInclude";>
 
 <bookinfo>
 
@@ -223,6 +223,10 @@
 
 <para>
 <emphasis>Source location: examples/base/base.cc</emphasis>
+
+<programlisting>
+<xi:include href="../../examples/base/base.cc" parse="text"/>
+</programlisting>
 
 <programlisting>
 #include &lt;gtkmm.h&gt;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]