Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Bringing Together a BoostBook Document 集合成一個 BoostBook 文檔

Linking in BoostBook 在 BoostBook 中的鏈接

Linking in BoostBook 在 BoostBook 中的鏈接

How one links to another element in BoostBook depends greatly on the nature of the element linked and how the link should appear. There are three general linking elements: <xref>, <link>, and <ulink>. Additionally, there are linking elements for referencing specific types of entities, such as classes (<classname>), functions (<functionname>), or libraries (<libraryname>).
如 何鏈接到 BoostBook 中的其它元素,這非常取決於被鏈接元素的本身特性和該鏈接如何出現。有三種常用的鏈接元素:<xref>, <link> 和 <ulink>。另外,還有引向特定實體類型的鏈接元素,如類(<classname>), 函數(<functionname>) 或庫(<libraryname>)。

The <xref> element references elements that have an id attribute and a title. The actual link text is composed from title and type of the element referenced. To link to a particular ID, create an <xref> element with the linkend attribute set to the ID of the intended target. For instance, this section's ID is boostbook.linking, so we create a reference it to with <xref linkend="boostbook.linking"/>, which will look like this in the text: the section called 「Linking in BoostBook」.
<xref> 元素引用帶有 id 屬性和標題的元素。實際的鏈接文本由被引用元素的標題和類型組成。要鏈接到一個特定的 ID,請創建一個 <xref> 元素,帶有 linkend 屬性並設為指定目標的 ID。例如,本節的 ID 是 boostbook.linking,所以我們用 <xref linkend="boostbook.linking"/> 來創建一個引用引向本節,在文本中它看起來如下:the section called 「Linking in BoostBook」.

The <link> element references an ID in the same way as <xref>, except that <link> does not generate any text for the link, so text must be supplied within the element. For instance, we can again link to this chapter but this time specify our own text with <link linkend="boostbook.linking">like this</link>. This markup will result in a link to this chapter that looks like this.
<link> 元素以和 <xref> 一樣的方式引用一個 ID,不過 <link> 不生成任何文本,所以文本必須在元素內部提供。例如,我們可以再一次鏈接到本節,不過這次我們通過 <link linkend="boostbook.linking">like this</link> 來指定自己的文本。這個標記將生成一個到本節的鏈接,看起來如:like this

The <ulink> element references a URL that is outside of the DocBook document. The url attribute contains the URL to link to, and the element data provides the link text.For instance, we can link to the the Boost web site with <ulink url="http://www.boost.org">Boost</ulink>, which appears in the document like this: Boost.
<ulink> 元素引用一個在 DocBook 文檔之外的 URL。其 url 屬性包含鏈至的 URL,且元素數據提供鏈接文本。例如,我們可以通過 <ulink url="http://www.boost.org">Boost</ulink> 鏈接到 Boost 網站,在文檔中會出現:Boost

The <classname>, <functionname>, <methodname>, and <libraryname> link to classes, functions, methods, and libraries, respectively. The text of each element gives both the name of the element to link to and the link text. For instance, we can link to the Function library with <libraryname>Function</libraryname>, which results in the following: Function. In cases where the displayed text is different from the actual name, the alt attribute can be specified. For instance, the following XML element references the boost::function class template but displays the text function: <classname alt="boost::function">function</classname>.
<classname>, <functionname>, <methodname> 和 <libraryname> 分別鏈接至類、函數、方法和庫。每個元素的文本同時給出鏈至元素的名字和鏈接文本。例如,我們可以通過 <libraryname>Function</libraryname> 鏈接至 Function 庫,這將生成:Function。如果要顯示不同於實際名字的文本,則要指定 alt 屬性。例如,以下 XML 元素引用 boost::function 類模板,但顯示文本 function: <classname alt="boost::function">function</classname>.


PrevUpHomeNext