HTML4.01規範-文本(1)

9 Text

The following sections discuss issues surrounding the structuring of text. Elements that present text (alignment elements, font elements, style sheets, etc.) are discussed elsewhere in the specification. For information about characters, please consult the section on the document character set.express

本章下面的部分將圍繞文本的結構進行討論。展示文本的元素(對齊方式元素,字體元素,樣式表等)在本規範的其餘地方討論。想要獲取關於字符的信息,請參考文檔字符集部分。app

9.1 White space

The document character set includes a wide variety of white space characters. Many of these are typographic elements used in some applications to produce particular visual spacing effects. In HTML, only the following characters are defined as white space characters:ide

文檔字符集中包含了不少空白字符。他們當中不少都是在一些應用中產生特殊視覺空白效果的排版元素。在HTML中,只有下面的字符被定義成空白字符:工具

  • ASCII space ( )
  • ASCII tab (	)
  • ASCII form feed ()
  • Zero-width space (​)

  • ASCII 空格 ( )
  • ASCII 製表符 (	)
  • ASCII 換頁符 ()
  • 零寬度空格 (​)

Line breaks are also white space characters. Note that although 
 and 
 are defined in [ISO10646] to unambiguously separate lines and paragraphs, respectively, these do not constitute line breaks in HTML, nor does this specification include them in the more general category of white space characters.字體

折行也是空白字符。請注意雖然在[ISO10646]中字符 
 和
定義用來分離行和段落,但它們在HTML中並不做爲折行使用,本規範也沒有將它們做爲空白字符來對待。ui

This specification does not indicate the behavior, rendering or otherwise, of space characters other than those explicitly identified here as white space characters. For this reason, authors should use appropriate elements and styles to achieve visual formatting effects that involve white space, rather than space characters.this

除了在這裏將全部的字符標記爲空白字符外,本規範不規定空白字符的行爲,如展示或其餘的行爲。因爲這個緣由,做者應該使用合適的元素以及樣式表來得到空白的視覺格式效果,而不是使用空白字符。搜索引擎

For all HTML elements except PRE, sequences of white space separate "words" (we use the term "word" here to mean "sequences of non-white space characters"). When formatting text, user agents should identify these words and lay them out according to the conventions of the particular written language (script) and target medium.

對於除了PRE之外的全部HTML元素,空白符的序列分隔」單詞「(咱們這裏使用」單詞「的含義是」非空白符的字符序列「)。當格式化文本時,用戶代理應該識別出這些單詞而且根據相應書寫語言以及目標介質來將它們展現出來。

This layout may involve putting space between words (called inter-word space), but conventions for inter-word space vary from script to script. For example, in Latin scripts, inter-word space is typically rendered as an ASCII space ( ), while in Thai it is a zero-width word separator (​). In Japanese and Chinese, inter-word space is not typically rendered at all.

這種展現可能包含在單詞之間放置空格(叫作 詞間空格),可是詞間空格的約定會根據腳本的不一樣而不一樣。例如,在拉丁腳本中,詞間空格一般被做爲ASCII空格( )來展示,然而在泰國語中將會是零寬度單詞分隔符(​)。在日文和中文中,詞間空格一般不會被展示。

Note that a sequence of white spaces between words in the source document may result in an entirely different rendered inter-word spacing (except in the case of the PRE element). In particular, user agents should collapse input white space sequences when producing output inter-word space. This can and should be done even in the absence of language information (from the lang attribute, the HTTP "Content-Language" header field (see [RFC2616], section 14.12), user agent settings, etc.).

請注意除了PRE元素外,在源文檔中詞間的空白符序列可能在展示時會出現徹底不一樣的詞間空白。特別的,用戶代理應該在產生詞間空白時,瓦解掉輸入的空白符序列。及時缺乏語言信息(該語言信息從lang屬性,HTTP "Content-Language" 頭字段(參考[RFC2616], 14.12部分),用戶代理設置等等),這樣的操做也應該被執行。

The PRE element is used for preformatted text, where white space is significant.

PRE元素被用於預格式化的文本,在哪裏空白符是不會被瓦解的。

In order to avoid problems with SGML line break rules and inconsistencies among extant implementations, authors should not rely on user agents to render white space immediately after a start tag or immediately before an end tag. Thus, authors, and in particular authoring tools, should write:

爲了不與SGML折行規則相關的問題以及在不一樣實現的不一致性,做者應該依賴用戶代理來展現出如今緊鄰開始標籤以後空白或者緊鄰結束標籤以前的空白。因此,做者以及使用某種撰寫工具應該寫成:

  <P>We offer free <A>technical support</A> for subscribers.</P>

and not:

而不是:

  <P>We offer free<A> technical support </A>for subscribers.</P>

9.2 Structured text

9.2.1 Phrase elements: EM, STRONG, DFN, CODE, SAMP, KBD, VAR, CITE, ABBR, and ACRONYM

<!ENTITY % phrase "EM | STRONG | DFN | CODE |
                   SAMP | KBD | VAR | CITE | ABBR | ACRONYM" >
<!ELEMENT (%fontstyle;|%phrase;) - - (%inline;)*>
<
!ATTLIST (%fontstyle;|%phrase;)
  %attrs;                              -- %coreattrs, %i18n, %events --
  >

Start tag: required, End tag: required

開始標籤:必須,結束標籤:必須

Attributes defined elsewhere

在其餘地方定義的屬性

Phrase elements add structural information to text fragments. The usual meanings of phrase elements are following:

短語型元素向文本段落中添加結構化信息。短語型元素的通常含義以下:

EM:
Indicates emphasis
表示強調.
STRONG:
Indicates stronger emphasis
表示突出強調.
CITE:
Contains a citation or a reference to other sources
承載一個引證或者一個指向其餘資源的引用.
DFN:
Indicates that this is the defining instance of the enclosed term
表示術語定義.
CODE:
Designates a fragment of computer code
表示一段計算機代碼.
SAMP:
Designates sample output from programs, scripts, etc
表示從程序,腳本等中輸出的例子.
KBD:
Indicates text to be entered by the user
表示用戶輸入的文本.
VAR:
Indicates an instance of a variable or program argument
表示一個變量或程序參數的實例.
ABBR:
Indicates an abbreviated form (e.g., WWW, HTTP, URI, Mass., etc.)
表示一個縮寫形式(好比:WWW,HTTP,URI,Mass,等).
ACRONYM:
Indicates an acronym (e.g., WAC, radar, etc.)
表示一個首字母縮寫形式(例如:WAC,radar等).

EM and STRONG are used to indicate emphasis. The other phrase elements have particular significance in technical documents. These examples illustrate some of the phrase elements:

EM以及STRONG用來表示強調。其餘的短語型元素在技術文檔中會有很是大的用處。下面的例子展現了一些短語型元素:

As <CITE>Harry S. Truman</CITE> said,

<Q lang="en-us">The buck stops here.</Q>



More information can be found in <CITE>[ISO-0000]</CITE>.


Please refer to the following reference number in future
correspondence: <STRONG>1-234-55</STRONG>

The presentation of phrase elements depends on the user agent. Generally, visual user agents present EM text in italics and STRONG text in bold font. Speech synthesizer user agents may change the synthesis parameters, such as volume, pitch and rate accordingly.

短語型元素的展示依賴於用戶代理。通常來講,可視化用戶代理用斜體表示EM,用粗體表示STRONG。語音合成器型用戶代理可能會改變合成參數,例如會相應地音量,音高以及頻率等。

The ABBR and ACRONYM elements allow authors to clearly indicate occurrences of abbreviations and acronyms. Western languages make extensive use of acronyms such as "GmbH", "NATO", and "F.B.I.", as well as abbreviations like "M.", "Inc.", "et al.", "etc.". Both Chinese and Japanese use analogous abbreviation mechanisms, wherein a long name is referred to subsequently with a subset of the Han characters from the original occurrence. Marking up these constructs provides useful information to user agents and tools such as spell checkers, speech synthesizers, translation systems and search-engine indexers.

ABBR和ACRONYM元素容許用戶清晰的表示縮寫和首字母縮寫形式。但願語言彙總會大量使用首字母縮寫:例如,"GmbH", "NATO", 和 "F.B.I.",另外也會大量使用縮寫,好比:"M.", "Inc.", "et al.", "etc."。中文和日語也使用相似的縮寫機制,即:一個長名字來引用一個段話。對這些構件進行標記能夠爲用戶代理及工具(例如:拼寫檢查,語言合成,翻譯系統以及搜索引擎的索引器)提供不少有用信息。

The content of the ABBR and ACRONYM elements specifies the abbreviated expression itself, as it would normally appear in running text. The title attribute of these elements may be used to provide the full or expanded form of the expression.

ABBR和ACRONYM元素的內容表示縮寫自己,它一般顯示在正式文本中。這些元素的title屬性能夠被用來提偶那個縮寫的縮寫前內容。

Here are some sample uses of ABBR:

下面是使用ABBR的一些例子:

  <P>   
<ABBR title="World Wide Web">WWW</ABBR>   
<ABBR lang="fr"          title="Soci&eacute;t&eacute; Nationale des Chemins de Fer">      SNCF   </ABBR>   
<ABBR lang="es" title="Do&ntilde;a">Do&ntilde;a</ABBR>   <ABBR title="Abbreviation">abbr.</ABBR> 

Note that abbreviations and acronyms often have idiosyncratic pronunciations. For example, while "IRS" and "BBC" are typically pronounced letter by letter, "NATO" and "UNESCO" are pronounced phonetically. Still other abbreviated forms (e.g., "URI" and "SQL") are spelled out by some people and pronounced as words by other people. When necessary, authors should use style sheets to specify the pronunciation of an abbreviated form.

請注意縮寫和首字母縮寫一般有特定的發音。例如,「IRS」和"BBC"典型地發音是一個字母一個字母,"NATO"和 "UNESCO"就會以單詞的形式發音。跟進一步,其餘的一些縮寫形式(例如:"URI"和"SQL")有的人會按字母讀出,有些會按單詞發音。若是有必要,做者應該使用樣式表來指定一個縮寫形式的發音。

9.2.2 Quotations: The BLOCKQUOTE and Q elements

<!ELEMENT BLOCKQUOTE - - (%block;|SCRIPT)+ -- long quotation -->

<!ATTLIST BLOCKQUOTE

  %attrs;                              -- %coreattrs, %i18n, %events --
  
cite        %URI;          #IMPLIED  -- URI for source document or msg --
  >

<!ELEMENT Q - - (%inline;)*            -- short inline quotation -->

<!ATTLIST Q
 %attrs;                              -- %coreattrs, %i18n, %events --
 cite        %URI;          #IMPLIED  -- URI for source document or msg --
  >

Start tag: required, End tag: required

開始標籤:必須,結束標籤:必須

Attribute definitions

屬性定義

cite = uri [CT]
The value of this attribute is a URI that designates a source document or message. This attribute is intended to give information about the source from which the quotation was borrowed
該屬性的值是一個指向某個源文檔或消息的URI。該屬性試圖給出引文出自的源頭。

 

These two elements designate quoted text. BLOCKQUOTE is for long quotations (block-level content) and Q is intended for short quotations (inline content) that don't require paragraph breaks.

這兩個元素指定引文。BLOCKQUOTE用於長引文(塊級別內容),Q用於不須要產生新段落的短引文(行內內容)。

This example formats an excerpt from "The Two Towers", by J.R.R. Tolkien, as a blockquote.

下面的例子將J.R.R. Tolkien 的「雙塔奇兵」中的節選做爲blockquote。

<BLOCKQUOTE cite="http://www.mycom.com/tolkien/twotowers.html">

<P>They went in single file, running like hounds on a strong scent,
and an eager light was in their eyes. Nearly due west the broad
swath of the marching Orcs tramped its ugly slot; the sweet grass
of Rohan had been bruised and blackened as they passed.</P>

</BLOCKQUOTE>

Rendering quotations

引文的展示

Visual user agents generally render BLOCKQUOTE as an indented block.

可視化用戶代理一般會將BLOCKAUOTE展示成縮進塊。

Visual user agents must ensure that the content of the Q element is rendered with delimiting quotation marks. Authors should not put quotation marks at the beginning and end of the content of a Q element.

可視化用戶代理必須保證Q元素的內容以引號進行標記展現。做者不該該在Q元素內容的開始和結尾放置引號。

User agents should render quotation marks in a language-sensitive manner (see the lang attribute). Many languages adopt different quotation styles for outer and inner (nested) quotations, which should be respected by user-agents.

用戶代理應該根據以語言感知的方式來展現引號(參看lang屬性)。許多語言對外部和內部引號都有不一樣的引用樣式,用戶代理必須知足這種狀況。

The following example illustrates nested quotations with the Q element.

下面的例子展現了使用Q元素進行嵌套式引用。

John said, <Q lang="en-us">I saw Lucy at lunch, she told me
<Q lang="en-us">Mary wants you
to get some ice cream on your way home.</Q> I think I will get
some at Ben and Jerry's, on Gloucester Road.</Q>

Since the language of both quotations is American English, user agents should render them appropriately, for example with single quote marks around the inner quotation and double quote marks around the outer quotation:

因爲兩個引用都是語言都是美國英語,用戶代理應該適當地展現他們,例如,在內部的引文采用單引號,在外部的引文采用雙引號。

  John said, "I saw Lucy at lunch, she told me 'Mary wants you
  to get some ice cream on your way home.' I think I will get some
  at Ben and Jerry's, on Gloucester Road."
相關文章
相關標籤/搜索