Date: Mon, 6 Nov 2000 15:40:33 +0000 From: Nik Clayton <nik@freebsd.org> To: Murray Stokely <murray@osd.bsdi.com> Cc: freebsd-doc@freebsd.org Subject: Re: <programlisting> woes Message-ID: <20001106154033.A2012@canyon.nothing-going-on.org> In-Reply-To: <Pine.BSF.4.21.0011060307410.5211-100000@pike.osd.bsdi.com>; from murray@osd.bsdi.com on Mon, Nov 06, 2000 at 03:12:03AM -0800 References: <Pine.BSF.4.21.0011060307410.5211-100000@pike.osd.bsdi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Nov 06, 2000 at 03:12:03AM -0800, Murray Stokely wrote: > What's the best way to include source code within DocBook? > Currently I'm using <programlisting> but I don't want to have to > enclose my header files, and pointers within <literal> tags so that > Jade doesn't think I'm referring to non existant sgml tags (like > sys/types.h) or unknown entities (like &buffer). > I don't think that the actual code in a program listing should be > marked up, should it? For some reason I assumed a programlisting > would contain nothing but character data. Either; 1. Wrap the code in a CDATA marked section, like this; <programlisting><![ CDATA [#include <stdio.h> int main(void) { printf("hello, world\n"); }]]></programlisting> This won't work if the code you're including has ']]>' in it somewhere. 2. s/</</g in the code you include. 3. Keep it as a separate file, and use a gross hack in the stylesheets. <programlisting><inlinegraphic format="linespecifc fileref="filename.c"> </inlinegraphic></programlisting> which will pull in filename.c as the output is being processed, and do the right thing. N -- Internet connection, $19.95 a month. Computer, $799.95. Modem, $149.95. Telephone line, $24.95 a month. Software, free. USENET transmission, hundreds if not thousands of dollars. Thinking before posting, priceless. Somethings in life you can't buy. For everything else, there's MasterCard. -- Graham Reed, in the Scary Devil Monastery To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-doc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001106154033.A2012>