xml – DocBook:指定代码或标记

前端之家收集整理的这篇文章主要介绍了xml – DocBook:指定代码或标记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
您可以使用< equation>指定方程式.以及其他几个,但必须使用什么标记来指定代码?更具体地说,PHP,HTML,CSS和 Javascript?是否有可以与OxygenXML一起使用的插件自动添加这些功能?我需要以PDF格式输出.
我正在开发一个使用docbook的项目,并在PHP中有示例.

PHP中的示例使用programlisting标记,如下所示:

  1. <programlisting language="PHP"><![CDATA[<?PHP
  2.  
  3. // Here goes the PHP code
  4.  
  5. ]]></programlisting>

请注意语言属性.
稍后由另一个工具使用它来添加语法着色,在生成输出时(对于HTML输出,至少)

对于不是特定于一种编程语言的示例,例如配置文件,我们使用screen标记;例如,对于Apache相关配置文件的一部分,一个例子是:

  1. <screen><![CDATA[# Setup Listening Port
  2. NameVirtualHost *:80
  3.  
  4. # Ensure "localhost" is preserved unchanged pointed
  5. # to the default document root for our system.
  6. <VirtualHost *:80>
  7. ServerName localhost
  8. DocumentRoot /var/www
  9. </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.

所以,这两个看起来很合适.

猜你在找的XML相关文章