Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 知乎專欄 | Search | Email

17.2. programlisting

		
<programlisting role="c">
#include &lt;stdio.h&gt;

int
main(void)
{
    printf("hello, world\n");
}
</programlisting>

<programlisting language="java">
</programlisting>

<programlisting linenumbering="numbered" startinglinenumber="12">

</programlisting>

<programlisting linenumbering="numbered" >
<?dbhtml linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2" ?>
<?dbfo linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2" ?>
<textobject><textdata  fileref="mycode.c" /></textobject>
</programlisting>

<example><title>My program listing</title>
  <programlisting><textobject><textdata
     fileref="mycode.c" /></textobject></programlisting>
</example>

Using XInclude for text inclusions
<example><title>My program listing</title>
  <programlisting><xi:include  href="mycode.c"  parse="text"
      xmlns:xi="http://www.w3.org/2001/XInclude"/></programlisting>
</example>
		
		
		
<programlisting linenumbering="numbered" startinglinenumber="12">
<![CDATA[
#include <stdio.h>

int main(void)
{
   printf("Hello, world!\n");
   return 0;
}
]] >
</programlisting>

<programlisting linenumbering="numbered" >
	<?dbhtml linenumbering.everyNth="2" linenumbering.separator=" &gt;" linenumbering.width="2"?>
	<?dbfo linenumbering.everyNth="2"   linenumbering.separator=" &gt;" linenumbering.width="2"?>
	<textobject><textdata  fileref="mycode.c" /></textobject>
</programlisting>
		
		
		
<?php

class foo
{
	private $bar;

	public function __construct($bar)
	{
		$this->bar = $bar;
	}

	/**
	 * getFoo
	 *
	 * Returns bar if $this->bar is foo else foo .. Oo ;D
	 *
	 * @return string
	 */
	public function getFoo()
	{
		if($this->bar == 'foo')
		{
			return 'bar';
		}
		else
		{
			return 'foo';
		}
	}
}
		
		

17.2.1. Callouts

			
<screen>
bash@host:~/cvs/newbiedoc$ ls -l
total 48
<co id="perm">drwxr-sr-x    2 jesse    jesse        4096 May  4 16:26 CVS<co id="cvs">
drwxr-sr-x    3 jesse    jesse        4096 Mar 29 03:29 dev
drwxr-sr-x    3 jesse    jesse        4096 Apr  8 19:31 general
drwxr-sr-x    3 jesse    jesse        4096 Apr  9 00:15 images
</screen>

<calloutlist>
   <callout arearefs="cvs">
      <para>
      This is the CVS directory.  CVS files are stored here.
      </para>
   </callout>

   <callout arearefs="perm">
      <para>
      These are the permissions for the CVS directory.
      </para>
   </callout>
</calloutlist>