Writing code examples in PHPDOC
| From: | Jirka Kosek | Date: | Mon, 12 Mar 2001 14:16:45 +0000 |
| Subject: | Writing code examples in PHPDOC | ||
| Groups: | php.doc | ||
| Request: | Send a blank email to phpdoc+get-969334651@lists.php.net to get a copy of this message | ||
Hi,
as PHP documentation is in XML, everywhere (even in programlistings)
characters < and & must be written as < and &. For longer code
examples it may be appropriate to use CDATA sections - in this section
XML reserved characters are not escaped:
<programlisting role="php"><![CDATA[
if ($foo < $bar)
echo "Hi!";
]]></programlisting>
With CDATA you should write it as:
<programlisting role="php">
if ($foo < $bar)
echo "Hi!";
</programlisting>
I'm writing here, because not all php-doc contributors know this XML
feature. Jade is very tolerant to errors like this because it comes from
SGML world. XML tools will crash on errors like these.
-----------------------------------------------------------------
Jirka Kosek
e-mail: jirka@kosek.cz
http://www.kosek.cz