PHP中的示例使用programlisting
标记,如下所示:
<programlisting language="php"><![CDATA[<?php // Here goes the PHP code ]]></programlisting>
请注意语言属性.
稍后由另一个工具使用它来添加语法着色,在生成输出时(对于HTML输出,至少)
对于不是特定于一种编程语言的示例,例如配置文件,我们使用screen
标记;例如,对于Apache相关配置文件的一部分,一个例子是:
<screen><![CDATA[# Setup Listening Port NameVirtualHost *:80 # Ensure "localhost" is preserved unchanged pointed # to the default document root for our system. <VirtualHost *:80> ServerName localhost DocumentRoot /var/www </VirtualHost>]]></screen>
引用他们的文件:
A programlisting is a verbatim
environment for program source or
source fragment listings. The
programlistings are often placed in
examples or figures so that they can
be cross-referenced from the text.
而且:
A screen is a verbatim environment for
displaying text that the user might
see on a computer terminal. It is
often used to display the results of a
command.Having less specific semantic
overtones,screen is often used
wherever a verbatim presentation is
desired,but the semantic of
programlisting is inappropriate.
所以,这两个看起来很合适.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。