html5/spec acknowledgements.html,1.1284,1.1285 infrastructure.html,1.1305,1.1306 parsing.html,1.183,1.184 references.html,1.1255,1.1256 rendering.html,1.246,1.247 single-page.html,1.117,1.118 spec.html,1.1988,1.1989 the-ruby-element.html,1.177,1.178

Update of /sources/public/html5/spec
In directory hutz:/tmp/cvs-serv23143

Modified Files:
	acknowledgements.html infrastructure.html parsing.html 
	references.html rendering.html single-page.html spec.html 
	the-ruby-element.html 
Log Message:
commit 33f2d51bb5d496a4c7c15e5eb030a8142ae40e98
Author: ianh <ianh@340c8d12-0b0e-0410-8428-c7bf67bfef74>
Date:   Mon Aug 20 22:54:46 2012 +0000

    [e] (0) additional example
    Affected topics: HTML
    
    git-svn-id: http://svn.whatwg.org/webapps@7245 340c8d12-0b0e-0410-8428-c7bf67bfef74
    (cherry picked from commit 884727018acebfedf1d26ac44827cebd112a69bf)


Index: infrastructure.html
===================================================================
RCS file: /sources/public/html5/spec/infrastructure.html,v
retrieving revision 1.1305
retrieving revision 1.1306
diff -u -d -r1.1305 -r1.1306
--- infrastructure.html	14 Sep 2012 05:13:53 -0000	1.1305
+++ infrastructure.html	14 Sep 2012 07:14:25 -0000	1.1306
@@ -1138,7 +1138,7 @@
      <li>The concept of <dfn id="base-url-change-steps">base URL change steps</dfn> and the definition of what happens when an element is <dfn id="affected-by-a-base-url-change">affected by a base URL change</dfn></li>
      <li>The concept of an element's <dfn id="concept-id" title="concept-id">unique identifier (ID)</dfn></li>
 
-     <li>The concept of a DOM <dfn id="concept-range" title="concept-range">range</dfn>.</li>
+     <li>The concept of a DOM <dfn id="concept-range" title="concept-range">range</dfn>, and the terms <dfn id="concept-range-start" title="concept-range-start">start</dfn>, <dfn id="concept-range-end" title="concept-range-end">end</dfn>, and <dfn id="concept-range-bp" title="concept-range-bp">boundary point</dfn> as applied to ranges.</li>
 
      <li><dfn id="mutationobserver"><code>MutationObserver</code></dfn> interface</li>
      <li>The <dfn id="mutationobserver-scripting-environment"><code>MutationObserver</code> <var title="">scripting environment</var></dfn> concept</li>

Index: the-ruby-element.html
===================================================================
RCS file: /sources/public/html5/spec/the-ruby-element.html,v
retrieving revision 1.177
retrieving revision 1.178
diff -u -d -r1.177 -r1.178
--- the-ruby-element.html	14 Sep 2012 01:14:39 -0000	1.177
+++ the-ruby-element.html	14 Sep 2012 07:14:28 -0000	1.178
@@ -341,7 +341,7 @@
    <dt><a href="element-definitions.html#element-dfn-contexts" title="element-dfn-contexts">Contexts in which this element can be used</a>:</dt>
    <dd>Where <a href="content-models.html#phrasing-content-1">phrasing content</a> is expected.</dd>
    <dt><a href="element-definitions.html#element-dfn-content-model" title="element-dfn-content-model">Content model</a>:</dt>
-   <dd>One or more groups of: <a href="content-models.html#phrasing-content-1">phrasing content</a> followed either by a single <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element, or an <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, an <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element, and another <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element.</dd>
+   <dd>See prose.</dd>
    <dt><a href="element-definitions.html#element-dfn-attributes" title="element-dfn-attributes">Content attributes</a>:</dt>
    <dd><a href="global-attributes.html#global-attributes">Global attributes</a></dd>
    <dt><a href="element-definitions.html#element-dfn-dom" title="element-dfn-dom">DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
@@ -353,13 +353,378 @@
   pronunciation or to include other annotations. In Japanese, this
   form of typography is also known as <i>furigana</i>.</p>
 
-  <p>A <code><a href="#the-ruby-element">ruby</a></code> element <a href="rendering.html#represents">represents</a> the spans of
-  phrasing content it contains, ignoring all the child <code><a href="the-rt-element.html#the-rt-element">rt</a></code>
-  and <code><a href="the-rp-element.html#the-rp-element">rp</a></code> elements and their descendants. Those spans of
-  phrasing content have associated annotations created using the
-  <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element.</p>
+  <p>The content model of <code><a href="#the-ruby-element">ruby</a></code> elements consists of one
+  or more of the following sequences:</p>
 
-  <div class="example">
+  <ol class="brief"><li>One or the other of the following:
+    <ul class="brief"><li><a href="content-models.html#phrasing-content-1">Phrasing content</a>, but with no <code><a href="#the-ruby-element">ruby</a></code> elements and with no <code><a href="#the-ruby-element">ruby</a></code> element descendants
+     </li><li>A single <code><a href="#the-ruby-element">ruby</a></code> element, but with no further <code><a href="#the-ruby-element">ruby</a></code> element descendants
+    </li></ul></li><li>One or the other of the following:
+    <ul class="brief"><li>One or more <code><a href="the-rt-element.html#the-rt-element">rt</a></code> elements
+     </li><li>An <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element followed by one or more <code><a href="the-rt-element.html#the-rt-element">rt</a></code> elements, each of which is itself followed by an <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element
+    </li></ul></li></ol><!-- ( ( phrasing-content | <ruby> ) ( <rt>+ | <rp> ( <rt> <rp> )+ ) )+ // with further ruby descendant restrictions --><p>The <code><a href="#the-ruby-element">ruby</a></code> and <code><a href="the-rt-element.html#the-rt-element">rt</a></code> elements can be used
+  for a variety of kinds of annotations, including in particular those
+  described below. For more details on Japanese Ruby in particular,
+  and how to render Ruby for Japanese, see <cite>Requirements for
+  Japanese Text Layout</cite>. <a href="references.html#refsJLREQ">[JLREQ]</a></p>
+
+  <p class="note">At the time of writing, CSS does not yet provide a
+  way to fully control the rendering of the HTML <code><a href="#the-ruby-element">ruby</a></code>
+  element. It is hoped that CSS will be extended to support the styles
+  described below in due course.</p>
+
+  <!-- examples in the following list are mostly based on those in http://www.w3.org/International/datespace/2010/02/jlreq-examples/ -->
+
+  <dl><dt>Mono-ruby for individual base characters
+
+   </dt><dd>
+
+    <p>One or more hiragana or katakana characters (the ruby
+    annotation) are placed with each ideographic character (the base
+    text). This is used to provide readings of kanji characters.
+
+    </p><div class="example"> <!-- B as in BASE -->
+     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class="example">
+     <p>In this example, notice how each annotation corresponds to a single base character.
+     </p><pre>&lt;ruby&gt;&#21531;&lt;rt&gt;&#12367;&#12435;&lt;/ruby&gt;&lt;ruby&gt;&#23376;&lt;rt&gt;&#12375;&lt;/ruby&gt;&#12399;&lt;ruby&gt;&#21644;&lt;rt&gt;&#12431;&lt;/ruby&gt;&#12375;&#12390;&lt;ruby&gt;&#21516;&lt;rt&gt;&#12393;&#12358;&lt;/ruby&gt;&#12380;&#12378;&#12290;</pre>
+     <p lang="ja"><ruby>&#21531;<rt>&#12367;&#12435;</rt></ruby><ruby>&#23376;<rt>&#12375;</rt></ruby>&#12399;<ruby>&#21644;<rt>&#12431;</rt></ruby>&#12375;&#12390;<ruby>&#21516;<rt>&#12393;&#12358;</rt></ruby>&#12380;&#12378;&#12290;
+    </p></div>
+
+   </dd>
+
+
+   <dt>Mono-ruby for compound words (jukugo)
+
+   </dt><dd>
+
+    <p>This is similar to the previous case: each ideographic
+    character in the compound word (the base text) has its reading
+    given in hiragana or katakana characters (the ruby annotation).
+    The difference is that the base text segments form a compound word
+    rather than being separate from each other.
+
+    </p><div class="example"> <!-- B as in BASE -->
+     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/rt&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class="example">
+     <p>In this example, notice again how each annotation corresponds to a single base character. In this example, each compound word (jukugo) corresponds to a single <code><a href="#the-ruby-element">ruby</a></code> element.</p>
+     <p>The rendering here is expected to be that each annotation be placed over (or next to, in vertical text) the corresponding base character, with the annotations not overhanging any of the adjacent characters.</p>
+     <pre>&lt;ruby&gt;&#39740;&lt;rt&gt;&#12365;&lt;/rt&gt;&#38272;&lt;rt&gt;&#12418;&#12435;&lt;/rt&gt;&lt;/ruby&gt;&#12398;&lt;ruby&gt;&#26041;&lt;rt&gt;&#12411;&#12358;&lt;/rt&gt;&#35282;&lt;rt&gt;&#12364;&#12367;&lt;/rt&gt;&lt;/ruby&gt;&#12434;&lt;ruby&gt;&#20957;&lt;rt&gt;&#12366;&#12423;&#12358;&lt;/rt&gt;&#35222;&lt;rt&gt;&#12375;&lt;/rt&gt;&lt;/ruby&gt;&#12377;&#12427;</pre>
+     <p lang="ja"><ruby>&#39740;<rt>&#12365;</rt>&#38272;<rt>&#12418;&#12435;</rt></ruby>&#12398;<ruby>&#26041;<rt>&#12411;&#12358;</rt>&#35282;<rt>&#12364;&#12367;</rt></ruby>&#12434;<ruby>&#20957;<rt>&#12366;&#12423;&#12358;</rt>&#35222;<rt>&#12375;</rt></ruby>&#12377;&#12427;
+
+    </p></div>
+
+   </dd>
+
+
+   <dt>Jukugo-ruby
+
+   </dt><dd>
+
+    <p>This is semantically identical to the previous case (each
+    individual ideographic character in the base compound word has its
+    reading given in an annotation in hiragana or katakana
+    characters), but the rendering is the more complicated Jukugo Ruby
+    rendering.
+
+    </p><div class="example">
+     <p>This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.</p>
+     <pre>&lt;ruby&gt;&#39740;&lt;rt&gt;&#12365;&lt;/rt&gt;&#38272;&lt;rt&gt;&#12418;&#12435;&lt;/rt&gt;&lt;/ruby&gt;&#12398;&lt;ruby&gt;&#26041;&lt;rt&gt;&#12411;&#12358;&lt;/rt&gt;&#35282;&lt;rt&gt;&#12364;&#12367;&lt;/rt&gt;&lt;/ruby&gt;&#12434;&lt;ruby&gt;&#20957;&lt;rt&gt;&#12366;&#12423;&#12358;&lt;/rt&gt;&#35222;&lt;rt&gt;&#12375;&lt;/rt&gt;&lt;/ruby&gt;&#12377;&#12427;</pre>
+     <!-- Once CSS is updated to describe this, invoke the CSS and unhide this -->
+     <!--
+     <p lang=ja><ruby>&#39740;<rt>&#12365;</rt>&#38272;<rt>&#12418;&#12435;</rt></ruby>&#12398;<ruby>&#26041;<rt>&#12411;&#12358;</rt>&#35282;<rt>&#12364;&#12367;</rt></ruby>&#12434;<ruby>&#20957;<rt>&#12366;&#12423;&#12358;</rt>&#35222;<rt>&#12375;</rt></ruby>&#12377;&#12427;
+     -->
+    </div>
+
+    <p class="note">For more details on <a href="http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby">Jukugo
+    Ruby rendering</a>, see Appendix F in the <cite>Requirements for
+    Japanese Text Layout</cite>. <a href="references.html#refsJLREQ">[JLREQ]</a></p>
+
+   </dd>
+
+
+   <dt>Group ruby for describing meanings
+
+   </dt><dd>
+
+    <p>The annotation describes the meaning of the base text, rather
+    than (or in addition to) the pronunciation. As such, both the base
+    text and the annotation can be multiple characters long.
+
+    </p><div class="example">
+     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class="example">
+     <p>Here a compound ideographic word has its corresponding katakana given as an annotation.
+     </p><pre>&lt;ruby&gt;&#22659;&#30028;&#38754;&lt;rt&gt;&#12452;&#12531;&#12479;&#12540;&#12501;&#12455;&#12540;&#12473;&lt;/ruby&gt;</pre>
+     <p lang="ja"><ruby>&#22659;&#30028;&#38754;<rt>&#12452;&#12531;&#12479;&#12540;&#12501;&#12455;&#12540;&#12473;</rt></ruby></p></div>
+
+    <div class="example">
+     <p>Here a compound ideographic word has its translation in English provided as an annotation.
+     </p><pre>&lt;ruby lang="ja"&gt;&#32232;&#38598;&#32773;&lt;rt lang="en"&gt;editor&lt;/ruby&gt;</pre>
+     <p><ruby lang="ja">&#32232;&#38598;&#32773;<rt lang="en">editor</rt></ruby></p></div>
+
+   </dd>
+
+
+   <dt>Group ruby for Jukuji readings
+
+   </dt><dd>
+
+    <p>A phonetic reading that corresponds to multiple base
+    characters, because a one-to-one mapping would be difficult. (In
+    English, the words "Colonel" and "Lieutenant" are examples of
+    words where a direct mapping of pronunciation to individual
+    letters is, in some dialects, rather unclear.)
+
+    </p><div class="example">
+     <p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby:
+     </p><pre>&lt;ruby&gt;&#32043;&#38525;&#33457;&lt;rt&gt;&#12354;&#12376;&#12373;&#12356;&lt;/ruby&gt;</pre>
+     <p lang="ja"><ruby>&#32043;&#38525;&#33457;<rt>&#12354;&#12376;&#12373;&#12356;</rt></ruby></p></div>
+
+   </dd>
+
+
+   <dt>Text with both phonetic and semantic annotations (double-sided ruby)
+
+   </dt><dd>
+
+    <p>Sometimes, ruby styles described above are combined.
+
+    </p><div class="example">
+     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation 1&lt;rt&gt;annotation 2&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class="example">
+     <pre>&lt;ruby&gt;&lt;ruby&gt;B&lt;rt&gt;a&lt;/rt&gt;A&lt;rt&gt;n&lt;/rt&gt;S&lt;rt&gt;t&lt;/rt&gt;E&lt;rt&gt;n&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class="example">
+     <p>Here both a phonetic reading and the meaning are given in ruby annotations. The annotation on the nested <code><a href="#the-ruby-element">ruby</a></code> element gives a mono-ruby phonetic annotation for each base character, while the annotation in the <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element that is a child of the outer <code><a href="#the-ruby-element">ruby</a></code> element gives the meaning using hiragana.
+     </p><pre>&lt;ruby&gt;&lt;ruby&gt;&#26481;&lt;rt&gt;&#12392;&#12358;&lt;/rt&gt;&#21335;&lt;rt&gt;&#12394;&#12435;&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;&#12383;&#12388;&#12415;&lt;/rt&gt;&lt;/ruby&gt;&#12398;&#26041;&#35282;</pre>
+     <p lang="ja"><ruby><ruby>&#26481;<rt>&#12392;&#12358;</rt>&#21335;<rt>&#12394;&#12435;</rt></ruby><rt>&#12383;&#12388;&#12415;</rt></ruby>&#12398;&#26041;&#35282;
+    </p></div>
+
+    <div class="example">
+     <p>This is the same example, but the meaning is given in English instead of Japanese:
+     </p><pre>&lt;ruby&gt;&lt;ruby&gt;&#26481;&lt;rt&gt;&#12392;&#12358;&lt;/rt&gt;&#21335;&lt;rt&gt;&#12394;&#12435;&lt;/rt&gt;&lt;/ruby&gt;&lt;rt lang=en&gt;Southeast&lt;/rt&gt;&lt;/ruby&gt;&#12398;&#26041;&#35282;</pre>
+     <p lang="ja"><ruby><ruby>&#26481;<rt>&#12392;&#12358;</rt>&#21335;<rt>&#12394;&#12435;</rt></ruby><rt lang="en">Southeast</rt></ruby>&#12398;&#26041;&#35282;
+    </p></div>
+
+   </dd>
+
+  </dl><hr><p>Within a <code><a href="#the-ruby-element">ruby</a></code> element that does not have a
+  <code><a href="#the-ruby-element">ruby</a></code> element ancestor, content is segmented and
+  segments are placed into three categories: base text segments,
+  annotation segments, and ignored segments. Ignored segments do not
+  form part of the document's semantics (they consist of some
+  <a href="content-models.html#inter-element-whitespace">inter-element whitespace</a> and <code><a href="the-rp-element.html#the-rp-element">rp</a></code> elements,
+  the latter of which are used for legacy user agents that do not
+  support ruby at all). Base text segments can overlap (with a limit
+  of two segments overlapping any one position in the DOM, and with
+  any segment having an earlier start point than an overlapping
+  segment also having an equal or later end point, and any segment
+  have a later end point than an overlapping segment also having an
+  equal or earlier start point<!-- if anyone can find a better way of
+  phrasing this parenthetical, do let me know! -->). Annotation
+  segments correspond to <code><a href="the-rt-element.html#the-rt-element">rt</a></code> elements. Each annotation
+  segment can be associated with a base text segment, and each base
+  text segment can have annotation segments associated with it. (In a
+  conforming document, each base text segment is associated with at
+  least one annotation segment, and each annotation segment is
+  associated with one base text segment.) A <code><a href="#the-ruby-element">ruby</a></code> element
+  <a href="rendering.html#represents">represents</a> the union of the segments of base text it
+  contains, along with the mapping from those base text segments to
+  annotation segments. Segments are described in terms of DOM ranges;
+  annotation segment ranges always consist of exactly one element. <a href="references.html#refsDOMCORE">[DOMCORE]</a></p>
+
+  <p>At any particular time, the segmentation and categorisation of
+  content of a <code><a href="#the-ruby-element">ruby</a></code> element is the result that would be
+  obtained from running the following algorithm:</p>
+
+  <ol><li><p>Let <var title="">base text segments</var> be an empty list
+   of base text segments, each potentially with a list of base text
+   subsegments.</p></li>
+
+   <li><p>Let <var title="">annotation segments</var> be an empty list
+   of annotation segments, each potentially being associated with a
+   base text segment or subsegment.</p></li>
+
+   <li><p>Let <var title="">root</var> be the <code><a href="#the-ruby-element">ruby</a></code>
+   element for which the algorithm is being run.</p></li>
+
+   <li><p>If <var title="">root</var> has a <code><a href="#the-ruby-element">ruby</a></code> element
+   ancestor, then jump to the step labeled <i>end</i>.</p></li>
+
+   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</p></li>
+
+   <li><p>Let <var title="">index</var> be 0.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+   <li><p>Let <var title="">parent start index</var> be null.</p></li>
+
+   <li><p>Let <var title="">current base text</var> be null.</p></li>
+
+
+   <!-- This is spaghetti code. If someone can work out a way to
+   phrase this that is as unambiguous but maps more cleanly to
+   structured code, please let me know. -->
+
+
+   <li><p><i>Start mode</i>: If <var title="">index</var> is equal to
+   or greater than the number of child nodes in <var title="">current
+   parent</var>, then jump to the step labeled <i>end mode</i>.</p>
+
+   </li><li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href="the-rt-element.html#the-rt-element">rt</a></code> or
+   <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, jump to the step labeled <i>annotation
+   mode</i>.</p></li>
+
+   <!-- if we get here then the first node in a ruby element or after
+   an <rt> or <rp> is something we want in a base text -->
+   
+   <li><p>Set <var title="">start index</var> to the value of <var title="">index</var>.</p></li>
+
+   <li><p><i>Base mode</i>: If the <var title="">index</var>th node in
+   <var title="">current parent</var> is a <code><a href="#the-ruby-element">ruby</a></code> element,
+   and if <var title="">current parent</var> is the same element as
+   <var title="">root</var>, then <a href="#push-a-ruby-level">push a ruby level</a> and
+   then jump to the step labeled <i>start mode</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href="the-rt-element.html#the-rt-element">rt</a></code> or
+   <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, then <a href="#set-the-current-base-text">set the current base
+   text</a> and then jump to the step labeled <i>annotation
+   mode</i>.</p></li>
+
+   <li><p>Increment <var title="">index</var> by one.</p></li>
+
+   <li><p><i>Base mode post-increment</i>: If <var title="">index</var> is equal to or greater than the number of
+   child nodes in <var title="">current parent</var>, then jump to the
+   step labeled <i>end mode</i>.</p></li>
+
+   <li><p>Jump back to the step labeled <i>base mode</i>.</p></li>
+
+
+   <li><p><i>Annotation mode</i>: If the <var title="">index</var>th
+   node in <var title="">current parent</var> is an <code><a href="the-rt-element.html#the-rt-element">rt</a></code>
+   element, then <a href="#push-a-ruby-annotation">push a ruby annotation</a> and jump to the
+   step labeled <i>annotation mode increment</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, jump
+   to the step labeled <i>annotation mode increment</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is not a <code><a href="infrastructure.html#text-0">Text</a></code> node, or
+   is a <code><a href="infrastructure.html#text-0">Text</a></code> node that is not <a href="content-models.html#inter-element-whitespace">inter-element
+   whitespace</a>, then jump to the step labeled <i>base
+   mode</i>.</p></li>
+
+   <!-- index points at whitespace -->
+
+   <li><p><i>Annotation mode increment</i>: Let <var title="">lookahead index</var> be <var title="">index</var> plus
+   one.</p></li>
+
+   <li><p><i>Annotation mode white-space skipper</i>: If <var title="">lookahead index</var> is equal to the number of child
+   nodes in <var title="">current parent</var> then jump to the step
+   labeled <i>end mode</i>.</p></li>
+
+   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is an <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element or an
+   <code><a href="the-rp-element.html#the-rp-element">rp</a></code> element, then set <var title="">index</var> to <var title="">lookahead index</var> and jump to the step labeled
+   <i>annotation mode</i>.</p></li>
+
+   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is not a <code><a href="infrastructure.html#text-0">Text</a></code> node, or
+   is a <code><a href="infrastructure.html#text-0">Text</a></code> node that is not <a href="content-models.html#inter-element-whitespace">inter-element
+   whitespace</a>, then jump to the step labeled <i>base mode</i>
+   (without further incrementing <var title="">index</var>, so the
+   <a href="content-models.html#inter-element-whitespace">inter-element whitespace</a> seen so far becomes part of
+   the next base text segment).</p></li>
+
+   <li><p>Increment <var title="">lookahead index</var> by
+   one.</p></li>
+
+   <li><p>Jump to the step labeled <i>annotation mode white-space
+   skipper</i>.</p></li>
+
+
+   <li><p><i>End mode</i>: If <var title="">current parent</var> is
+   not the same element as <var title="">root</var>, then <a href="#pop-a-ruby-level">pop a
+   ruby level</a> and jump to the step labeled <i>base mode
+   post-increment</i>.</p></li>
+
+   <li><p><i>End</i>: Return <var title="">base text segments</var>
+   and <var title="">annotation segments</var>. Any content of the
+   <code><a href="#the-ruby-element">ruby</a></code> element not described by segments in either of
+   thost lists is implicitly in an <i>ignored segment</i>.</p></li>
+
+  </ol><p>When the steps above say to <dfn id="set-the-current-base-text">set the current base text</dfn>,
+  it means to run the following steps at that point in the
+  algorithm:</p>
+
+  <ol><li><p>Let <var title="">text range</var> a DOM range whose <a href="infrastructure.html#concept-range-start" title="concept-range-start">start</a> is the <a href="infrastructure.html#concept-range-bp" title="concept-range-bp">boundary point</a> (<var title="">current parent</var>, <var title="">start index</var>) and
+   whose <a href="infrastructure.html#concept-range-end" title="concept-range-end">end</a> is the <a href="infrastructure.html#concept-range-bp" title="concept-range-bp">boundary point</a> (<var title="">current parent</var>, <var title="">index</var>).</p></li>
+
+   <li><p>Let <var title="">new text segment</var> be a base text
+   segment described by the range <var title="">annotation
+   range</var>.</p>
+
+   </li><li><p>Add <var title="">new text segment</var> to <var title="">base text segments</var>.</p></li>
+
+   <li><p>Let <var title="">current base text</var> be <var title="">new text segment</var>.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id="push-a-ruby-level">push a ruby level</dfn>, it
+  means to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">current parent</var> be the <var title="">index</var>th node in <var title="">current
+   parent</var>.</p></li>
+
+   <li><p>Let <var title="">index</var> be 0.</p></li>
+
+   <li><p>Set <var title="">saved start index</var> to the value of
+   <var title="">start index</var>.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id="pop-a-ruby-level">pop a ruby level</dfn>, it means
+  to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">index</var> be the position of <var title="">current parent</var> in <var title="">root</var>.</p></li>
+
+   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</p></li>
+
+   <li><p>Increment <var title="">index</var> by one.</p></li>
+
+   <li><p>Set <var title="">start index</var> to the value of
+   <var title="">saved start index</var>.</p></li>
+
+   <li><p>Let <var title="">saved start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id="push-a-ruby-annotation">push a ruby annotation</dfn>, it
+  means to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">rt</var> be the <code><a href="the-rt-element.html#the-rt-element">rt</a></code> element
+   that is the <var title="">index</var>th node of <var title="">current parent</var>.</p></li>
+
+   <li><p>Let <var title="">annotation range</var> a DOM range whose
+   <a href="infrastructure.html#concept-range-start" title="concept-range-start">start</a> is the <a href="infrastructure.html#concept-range-bp" title="concept-range-bp">boundary point</a> (<var title="">current parent</var>, <var title="">index</var>) and whose
+   <a href="infrastructure.html#concept-range-end" title="concept-range-end">end</a> is the <a href="infrastructure.html#concept-range-bp" title="concept-range-bp">boundary point</a> (<var title="">current parent</var>, <var title="">index</var> plus one)
+   (i.e. that contains only <var title="">rt</var>).</p></li>
+
+   <li><p>Let <var title="">new annotation segment</var> be an
+   annotation segment described by the range <var title="">annotation
+   range</var>.</p></li>
+
+   <li><p>If <var title="">current base text</var> is not null,
+   associate <var title="">new annotation segment</var> with <var title="">current base text</var>.</p></li>
+
+   <li><p>Add <var title="">new annotation segment</var> to <var title="">annotation segments</var>.</p></li>
+
+  </ol><div class="example">
 
    <!-- this is the hiragana for the word "kanji" ("chinese character") in japanese -->
    <!-- in japanese, ruby-like typography is called "furigana" -->
@@ -379,7 +744,7 @@
 
   <div class="example">
 
-   <!-- this is the bopomofo for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->
+   <!-- this is the zhuyin fuhao (aka bopomofo) for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->
 
    <p>In this example, each ideograph in the traditional Chinese text
    <span lang="zh-TW" title="">&#28450;&#23383;</span> is annotated
@@ -411,5 +776,20 @@
 
   <!-- Note: Examples are 32px/16px Stone Sans Sem ITC TT -->
 
+  <div class="example">
+
+   <p>In this more contrived example, the acronym "HTML" has four
+   annotations: one for the whole acronym, briefly describing what it
+   is, one for the letters "HT" expanding them to "Hypertext", one for
+   the letter "M" expanding it to "Markup", and one for the letter "L"
+   expanding it to "Language".</p>
+
+   <pre>&lt;ruby&gt;
+ &lt;ruby&gt;HT&lt;rt&gt;Hypertext&lt;/rt&gt;M&lt;rt&gt;Markup&lt;/rt&gt;L&lt;rt&gt;Language&lt;/rt&gt;&lt;/ruby&gt;
+ &lt;rt&gt;An abstract language for describing documents and applications
+&lt;/ruby&gt;</pre>
+
+  </div>
+
 
   </body></html>
\ No newline at end of file

Index: rendering.html
===================================================================
RCS file: /sources/public/html5/spec/rendering.html,v
retrieving revision 1.246
retrieving revision 1.247
diff -u -d -r1.246 -r1.247
--- rendering.html	14 Sep 2012 05:13:54 -0000	1.246
+++ rendering.html	14 Sep 2012 07:14:26 -0000	1.247
@@ -734,6 +734,16 @@
   <code><a href="the-rp-element.html#the-rp-element">rp</a></code> elements are expected to be wrapped in anonymous
   boxes whose 'display' property has the value 'ruby-base'. <a href="references.html#refsCSSRUBY">[CSSRUBY]</a></p>
 
+  <p>When a particular part of a ruby has more than one annotation,
+  the annotations should be distributed on both sides of the base text
+  so as to minimise the stacking of ruby annotations on one side.</p>
+
+  <p class="note">When it becomes possible to do so, the preceding
+  requirement will be updated to be expressed in terms of CSS ruby.
+  (Currently, CSS ruby does not handle nested <code><a href="the-ruby-element.html#the-ruby-element">ruby</a></code>
+  elements or multiple sequential <code><a href="the-rt-element.html#the-rt-element">rt</a></code> elements, which is
+  how this semantic is expressed.)</p>
+
   <p>User agents that do not support correct ruby rendering are
   expected to render parentheses around the text of <code><a href="the-rt-element.html#the-rt-element">rt</a></code>
   elements in the absence of <code><a href="the-rp-element.html#the-rp-element">rp</a></code> elements.</p>

Index: acknowledgements.html
===================================================================
RCS file: /sources/public/html5/spec/acknowledgements.html,v
retrieving revision 1.1284
retrieving revision 1.1285
diff -u -d -r1.1284 -r1.1285
--- acknowledgements.html	14 Sep 2012 05:13:52 -0000	1.1284
+++ acknowledgements.html	14 Sep 2012 07:14:25 -0000	1.1285
@@ -590,6 +590,7 @@
   Ivan Enderlin,
   Ivo Emanuel Gon&#231;alves,
   J. King,
+  Jacob Davies,
   Jacques Distler,
   Jake Verbaten,
   James Craig,


Index: single-page.html
===================================================================
RCS file: /sources/public/html5/spec/single-page.html,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -d -r1.117 -r1.118
--- single-page.html	14 Sep 2012 05:43:41 -0000	1.117
+++ single-page.html	14 Sep 2012 07:14:26 -0000	1.118
@@ -3734,7 +3734,7 @@
      <li>The concept of <dfn id=base-url-change-steps>base URL change steps</dfn> and the definition of what happens when an element is <dfn id=affected-by-a-base-url-change>affected by a base URL change</dfn></li>
      <li>The concept of an element's <dfn id=concept-id title=concept-id>unique identifier (ID)</dfn></li>
 
-     <li>The concept of a DOM <dfn id=concept-range title=concept-range>range</dfn>.</li>
+     <li>The concept of a DOM <dfn id=concept-range title=concept-range>range</dfn>, and the terms <dfn id=concept-range-start title=concept-range-start>start</dfn>, <dfn id=concept-range-end title=concept-range-end>end</dfn>, and <dfn id=concept-range-bp title=concept-range-bp>boundary point</dfn> as applied to ranges.</li>
 
      <li><dfn id=mutationobserver><code>MutationObserver</code></dfn> interface</li>
      <li>The <dfn id=mutationobserver-scripting-environment><code>MutationObserver</code> <var title="">scripting environment</var></dfn> concept</li>
@@ -22007,7 +22007,7 @@
    <dt><a href=#element-dfn-contexts title=element-dfn-contexts>Contexts in which this element can be used</a>:</dt>
    <dd>Where <a href=#phrasing-content-1>phrasing content</a> is expected.</dd>
    <dt><a href=#element-dfn-content-model title=element-dfn-content-model>Content model</a>:</dt>
-   <dd>One or more groups of: <a href=#phrasing-content-1>phrasing content</a> followed either by a single <code><a href=#the-rt-element>rt</a></code> element, or an <code><a href=#the-rp-element>rp</a></code> element, an <code><a href=#the-rt-element>rt</a></code> element, and another <code><a href=#the-rp-element>rp</a></code> element.</dd>
+   <dd>See prose.</dd>
    <dt><a href=#element-dfn-attributes title=element-dfn-attributes>Content attributes</a>:</dt>
    <dd><a href=#global-attributes>Global attributes</a></dd>
    <dt><a href=#element-dfn-dom title=element-dfn-dom>DOM interface</a>:</dt><!--TOPIC:DOM APIs-->
@@ -22019,13 +22019,378 @@
   pronunciation or to include other annotations. In Japanese, this
   form of typography is also known as <i>furigana</i>.</p>
 
-  <p>A <code><a href=#the-ruby-element>ruby</a></code> element <a href=#represents>represents</a> the spans of
-  phrasing content it contains, ignoring all the child <code><a href=#the-rt-element>rt</a></code>
-  and <code><a href=#the-rp-element>rp</a></code> elements and their descendants. Those spans of
-  phrasing content have associated annotations created using the
-  <code><a href=#the-rt-element>rt</a></code> element.</p>
+  <p>The content model of <code><a href=#the-ruby-element>ruby</a></code> elements consists of one
+  or more of the following sequences:</p>
 
-  <div class=example>
+  <ol class=brief><li>One or the other of the following:
+    <ul class=brief><li><a href=#phrasing-content-1>Phrasing content</a>, but with no <code><a href=#the-ruby-element>ruby</a></code> elements and with no <code><a href=#the-ruby-element>ruby</a></code> element descendants
+     </li><li>A single <code><a href=#the-ruby-element>ruby</a></code> element, but with no further <code><a href=#the-ruby-element>ruby</a></code> element descendants
+    </li></ul></li><li>One or the other of the following:
+    <ul class=brief><li>One or more <code><a href=#the-rt-element>rt</a></code> elements
+     </li><li>An <code><a href=#the-rp-element>rp</a></code> element followed by one or more <code><a href=#the-rt-element>rt</a></code> elements, each of which is itself followed by an <code><a href=#the-rp-element>rp</a></code> element
+    </li></ul></li></ol><!-- ( ( phrasing-content | <ruby> ) ( <rt>+ | <rp> ( <rt> <rp> )+ ) )+ // with further ruby descendant restrictions --><p>The <code><a href=#the-ruby-element>ruby</a></code> and <code><a href=#the-rt-element>rt</a></code> elements can be used
+  for a variety of kinds of annotations, including in particular those
+  described below. For more details on Japanese Ruby in particular,
+  and how to render Ruby for Japanese, see <cite>Requirements for
+  Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
+
+  <p class=note>At the time of writing, CSS does not yet provide a
+  way to fully control the rendering of the HTML <code><a href=#the-ruby-element>ruby</a></code>
+  element. It is hoped that CSS will be extended to support the styles
+  described below in due course.</p>
+
+  <!-- examples in the following list are mostly based on those in http://www.w3.org/International/datespace/2010/02/jlreq-examples/ -->
+
+  <dl><dt>Mono-ruby for individual base characters
+
+   </dt><dd>
+
+    <p>One or more hiragana or katakana characters (the ruby
+    annotation) are placed with each ideographic character (the base
+    text). This is used to provide readings of kanji characters.
+
+    </p><div class=example> <!-- B as in BASE -->
+     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class=example>
+     <p>In this example, notice how each annotation corresponds to a single base character.
+     </p><pre>&lt;ruby&gt;君&lt;rt&gt;くん&lt;/ruby&gt;&lt;ruby&gt;子&lt;rt&gt;し&lt;/ruby&gt;は&lt;ruby&gt;和&lt;rt&gt;わ&lt;/ruby&gt;して&lt;ruby&gt;同&lt;rt&gt;どう&lt;/ruby&gt;ぜず。</pre>
+     <p lang=ja><ruby>君<rt>くん</rt></ruby><ruby>子<rt>し</rt></ruby>は<ruby>和<rt>わ</rt></ruby>して<ruby>同<rt>どう</rt></ruby>ぜず。
+    </p></div>
+
+   </dd>
+
+
+   <dt>Mono-ruby for compound words (jukugo)
+
+   </dt><dd>
+
+    <p>This is similar to the previous case: each ideographic
+    character in the compound word (the base text) has its reading
+    given in hiragana or katakana characters (the ruby annotation).
+    The difference is that the base text segments form a compound word
+    rather than being separate from each other.
+
+    </p><div class=example> <!-- B as in BASE -->
+     <pre>&lt;ruby&gt;B&lt;rt&gt;annotation&lt;/rt&gt;B&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class=example>
+     <p>In this example, notice again how each annotation corresponds to a single base character. In this example, each compound word (jukugo) corresponds to a single <code><a href=#the-ruby-element>ruby</a></code> element.</p>
+     <p>The rendering here is expected to be that each annotation be placed over (or next to, in vertical text) the corresponding base character, with the annotations not overhanging any of the adjacent characters.</p>
+     <pre>&lt;ruby&gt;鬼&lt;rt&gt;き&lt;/rt&gt;門&lt;rt&gt;もん&lt;/rt&gt;&lt;/ruby&gt;の&lt;ruby&gt;方&lt;rt&gt;ほう&lt;/rt&gt;角&lt;rt&gt;がく&lt;/rt&gt;&lt;/ruby&gt;を&lt;ruby&gt;凝&lt;rt&gt;ぎょう&lt;/rt&gt;視&lt;rt&gt;し&lt;/rt&gt;&lt;/ruby&gt;する</pre>
+     <p lang=ja><ruby>鬼<rt>き</rt>門<rt>もん</rt></ruby>の<ruby>方<rt>ほう</rt>角<rt>がく</rt></ruby>を<ruby>凝<rt>ぎょう</rt>視<rt>し</rt></ruby>する
+
+    </p></div>
+
+   </dd>
+
+
+   <dt>Jukugo-ruby
+
+   </dt><dd>
+
+    <p>This is semantically identical to the previous case (each
+    individual ideographic character in the base compound word has its
+    reading given in an annotation in hiragana or katakana
+    characters), but the rendering is the more complicated Jukugo Ruby
+    rendering.
+
+    </p><div class=example>
+     <p>This is the same example as above for mono-ruby for compound words. The different rendering is expected to be achieved using different styling (e.g. in CSS), and is not shown here.</p>
+     <pre>&lt;ruby&gt;鬼&lt;rt&gt;き&lt;/rt&gt;門&lt;rt&gt;もん&lt;/rt&gt;&lt;/ruby&gt;の&lt;ruby&gt;方&lt;rt&gt;ほう&lt;/rt&gt;角&lt;rt&gt;がく&lt;/rt&gt;&lt;/ruby&gt;を&lt;ruby&gt;凝&lt;rt&gt;ぎょう&lt;/rt&gt;視&lt;rt&gt;し&lt;/rt&gt;&lt;/ruby&gt;する</pre>
+     <!-- Once CSS is updated to describe this, invoke the CSS and unhide this -->
+     <!--
+     <p lang=ja><ruby>&#39740;<rt>&#12365;</rt>&#38272;<rt>&#12418;&#12435;</rt></ruby>&#12398;<ruby>&#26041;<rt>&#12411;&#12358;</rt>&#35282;<rt>&#12364;&#12367;</rt></ruby>&#12434;<ruby>&#20957;<rt>&#12366;&#12423;&#12358;</rt>&#35222;<rt>&#12375;</rt></ruby>&#12377;&#12427;
+     -->
+    </div>
+
+    <p class=note>For more details on <a href=http://www.w3.org/TR/jlreq/#positioning_of_jukugoruby>Jukugo
+    Ruby rendering</a>, see Appendix F in the <cite>Requirements for
+    Japanese Text Layout</cite>. <a href=#refsJLREQ>[JLREQ]</a></p>
+
+   </dd>
+
+
+   <dt>Group ruby for describing meanings
+
+   </dt><dd>
+
+    <p>The annotation describes the meaning of the base text, rather
+    than (or in addition to) the pronunciation. As such, both the base
+    text and the annotation can be multiple characters long.
+
+    </p><div class=example>
+     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class=example>
+     <p>Here a compound ideographic word has its corresponding katakana given as an annotation.
+     </p><pre>&lt;ruby&gt;境界面&lt;rt&gt;インターフェース&lt;/ruby&gt;</pre>
+     <p lang=ja><ruby>境界面<rt>インターフェース</rt></ruby></p></div>
+
+    <div class=example>
+     <p>Here a compound ideographic word has its translation in English provided as an annotation.
+     </p><pre>&lt;ruby lang="ja"&gt;編集者&lt;rt lang="en"&gt;editor&lt;/ruby&gt;</pre>
+     <p><ruby lang=ja>編集者<rt lang=en>editor</rt></ruby></p></div>
+
+   </dd>
+
+
+   <dt>Group ruby for Jukuji readings
+
+   </dt><dd>
+
+    <p>A phonetic reading that corresponds to multiple base
+    characters, because a one-to-one mapping would be difficult. (In
+    English, the words "Colonel" and "Lieutenant" are examples of
+    words where a direct mapping of pronunciation to individual
+    letters is, in some dialects, rather unclear.)
+
+    </p><div class=example>
+     <p>In this example, the name of a species of flowers has a phonetic reading provided using group ruby:
+     </p><pre>&lt;ruby&gt;紫陽花&lt;rt&gt;あじさい&lt;/ruby&gt;</pre>
+     <p lang=ja><ruby>紫陽花<rt>あじさい</rt></ruby></p></div>
+
+   </dd>
+
+
+   <dt>Text with both phonetic and semantic annotations (double-sided ruby)
+
+   </dt><dd>
+
+    <p>Sometimes, ruby styles described above are combined.
+
+    </p><div class=example>
+     <pre>&lt;ruby&gt;BASE&lt;rt&gt;annotation 1&lt;rt&gt;annotation 2&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class=example>
+     <pre>&lt;ruby&gt;&lt;ruby&gt;B&lt;rt&gt;a&lt;/rt&gt;A&lt;rt&gt;n&lt;/rt&gt;S&lt;rt&gt;t&lt;/rt&gt;E&lt;rt&gt;n&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;annotation&lt;/ruby&gt;</pre>
+    </div>
+
+    <div class=example>
+     <p>Here both a phonetic reading and the meaning are given in ruby annotations. The annotation on the nested <code><a href=#the-ruby-element>ruby</a></code> element gives a mono-ruby phonetic annotation for each base character, while the annotation in the <code><a href=#the-rt-element>rt</a></code> element that is a child of the outer <code><a href=#the-ruby-element>ruby</a></code> element gives the meaning using hiragana.
+     </p><pre>&lt;ruby&gt;&lt;ruby&gt;東&lt;rt&gt;とう&lt;/rt&gt;南&lt;rt&gt;なん&lt;/rt&gt;&lt;/ruby&gt;&lt;rt&gt;たつみ&lt;/rt&gt;&lt;/ruby&gt;の方角</pre>
+     <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt>たつみ</rt></ruby>の方角
+    </p></div>
+
+    <div class=example>
+     <p>This is the same example, but the meaning is given in English instead of Japanese:
+     </p><pre>&lt;ruby&gt;&lt;ruby&gt;東&lt;rt&gt;とう&lt;/rt&gt;南&lt;rt&gt;なん&lt;/rt&gt;&lt;/ruby&gt;&lt;rt lang=en&gt;Southeast&lt;/rt&gt;&lt;/ruby&gt;の方角</pre>
+     <p lang=ja><ruby><ruby>東<rt>とう</rt>南<rt>なん</rt></ruby><rt lang=en>Southeast</rt></ruby>の方角
+    </p></div>
+
+   </dd>
+
+  </dl><hr><p>Within a <code><a href=#the-ruby-element>ruby</a></code> element that does not have a
+  <code><a href=#the-ruby-element>ruby</a></code> element ancestor, content is segmented and
+  segments are placed into three categories: base text segments,
+  annotation segments, and ignored segments. Ignored segments do not
+  form part of the document's semantics (they consist of some
+  <a href=#inter-element-whitespace>inter-element whitespace</a> and <code><a href=#the-rp-element>rp</a></code> elements,
+  the latter of which are used for legacy user agents that do not
+  support ruby at all). Base text segments can overlap (with a limit
+  of two segments overlapping any one position in the DOM, and with
+  any segment having an earlier start point than an overlapping
+  segment also having an equal or later end point, and any segment
+  have a later end point than an overlapping segment also having an
+  equal or earlier start point<!-- if anyone can find a better way of
+  phrasing this parenthetical, do let me know! -->). Annotation
+  segments correspond to <code><a href=#the-rt-element>rt</a></code> elements. Each annotation
+  segment can be associated with a base text segment, and each base
+  text segment can have annotation segments associated with it. (In a
+  conforming document, each base text segment is associated with at
+  least one annotation segment, and each annotation segment is
+  associated with one base text segment.) A <code><a href=#the-ruby-element>ruby</a></code> element
+  <a href=#represents>represents</a> the union of the segments of base text it
+  contains, along with the mapping from those base text segments to
+  annotation segments. Segments are described in terms of DOM ranges;
+  annotation segment ranges always consist of exactly one element. <a href=#refsDOMCORE>[DOMCORE]</a></p>
+
+  <p>At any particular time, the segmentation and categorisation of
+  content of a <code><a href=#the-ruby-element>ruby</a></code> element is the result that would be
+  obtained from running the following algorithm:</p>
+
+  <ol><li><p>Let <var title="">base text segments</var> be an empty list
+   of base text segments, each potentially with a list of base text
+   subsegments.</p></li>
+
+   <li><p>Let <var title="">annotation segments</var> be an empty list
+   of annotation segments, each potentially being associated with a
+   base text segment or subsegment.</p></li>
+
+   <li><p>Let <var title="">root</var> be the <code><a href=#the-ruby-element>ruby</a></code>
+   element for which the algorithm is being run.</p></li>
+
+   <li><p>If <var title="">root</var> has a <code><a href=#the-ruby-element>ruby</a></code> element
+   ancestor, then jump to the step labeled <i>end</i>.</p></li>
+
+   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</p></li>
+
+   <li><p>Let <var title="">index</var> be 0.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+   <li><p>Let <var title="">parent start index</var> be null.</p></li>
+
+   <li><p>Let <var title="">current base text</var> be null.</p></li>
+
+
+   <!-- This is spaghetti code. If someone can work out a way to
+   phrase this that is as unambiguous but maps more cleanly to
+   structured code, please let me know. -->
+
+
+   <li><p><i>Start mode</i>: If <var title="">index</var> is equal to
+   or greater than the number of child nodes in <var title="">current
+   parent</var>, then jump to the step labeled <i>end mode</i>.</p>
+
+   </li><li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href=#the-rt-element>rt</a></code> or
+   <code><a href=#the-rp-element>rp</a></code> element, jump to the step labeled <i>annotation
+   mode</i>.</p></li>
+
+   <!-- if we get here then the first node in a ruby element or after
+   an <rt> or <rp> is something we want in a base text -->
+   
+   <li><p>Set <var title="">start index</var> to the value of <var title="">index</var>.</p></li>
+
+   <li><p><i>Base mode</i>: If the <var title="">index</var>th node in
+   <var title="">current parent</var> is a <code><a href=#the-ruby-element>ruby</a></code> element,
+   and if <var title="">current parent</var> is the same element as
+   <var title="">root</var>, then <a href=#push-a-ruby-level>push a ruby level</a> and
+   then jump to the step labeled <i>start mode</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href=#the-rt-element>rt</a></code> or
+   <code><a href=#the-rp-element>rp</a></code> element, then <a href=#set-the-current-base-text>set the current base
+   text</a> and then jump to the step labeled <i>annotation
+   mode</i>.</p></li>
+
+   <li><p>Increment <var title="">index</var> by one.</p></li>
+
+   <li><p><i>Base mode post-increment</i>: If <var title="">index</var> is equal to or greater than the number of
+   child nodes in <var title="">current parent</var>, then jump to the
+   step labeled <i>end mode</i>.</p></li>
+
+   <li><p>Jump back to the step labeled <i>base mode</i>.</p></li>
+
+
+   <li><p><i>Annotation mode</i>: If the <var title="">index</var>th
+   node in <var title="">current parent</var> is an <code><a href=#the-rt-element>rt</a></code>
+   element, then <a href=#push-a-ruby-annotation>push a ruby annotation</a> and jump to the
+   step labeled <i>annotation mode increment</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is an <code><a href=#the-rp-element>rp</a></code> element, jump
+   to the step labeled <i>annotation mode increment</i>.</p></li>
+
+   <li><p>If the <var title="">index</var>th node in <var title="">current parent</var> is not a <code><a href=#text-0>Text</a></code> node, or
+   is a <code><a href=#text-0>Text</a></code> node that is not <a href=#inter-element-whitespace>inter-element
+   whitespace</a>, then jump to the step labeled <i>base
+   mode</i>.</p></li>
+
+   <!-- index points at whitespace -->
+
+   <li><p><i>Annotation mode increment</i>: Let <var title="">lookahead index</var> be <var title="">index</var> plus
+   one.</p></li>
+
+   <li><p><i>Annotation mode white-space skipper</i>: If <var title="">lookahead index</var> is equal to the number of child
+   nodes in <var title="">current parent</var> then jump to the step
+   labeled <i>end mode</i>.</p></li>
+
+   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is an <code><a href=#the-rt-element>rt</a></code> element or an
+   <code><a href=#the-rp-element>rp</a></code> element, then set <var title="">index</var> to <var title="">lookahead index</var> and jump to the step labeled
+   <i>annotation mode</i>.</p></li>
+
+   <li><p>If the <var title="">lookahead index</var>th node in <var title="">current parent</var> is not a <code><a href=#text-0>Text</a></code> node, or
+   is a <code><a href=#text-0>Text</a></code> node that is not <a href=#inter-element-whitespace>inter-element
+   whitespace</a>, then jump to the step labeled <i>base mode</i>
+   (without further incrementing <var title="">index</var>, so the
+   <a href=#inter-element-whitespace>inter-element whitespace</a> seen so far becomes part of
+   the next base text segment).</p></li>
+
+   <li><p>Increment <var title="">lookahead index</var> by
+   one.</p></li>
+
+   <li><p>Jump to the step labeled <i>annotation mode white-space
+   skipper</i>.</p></li>
+
+
+   <li><p><i>End mode</i>: If <var title="">current parent</var> is
+   not the same element as <var title="">root</var>, then <a href=#pop-a-ruby-level>pop a
+   ruby level</a> and jump to the step labeled <i>base mode
+   post-increment</i>.</p></li>
+
+   <li><p><i>End</i>: Return <var title="">base text segments</var>
+   and <var title="">annotation segments</var>. Any content of the
+   <code><a href=#the-ruby-element>ruby</a></code> element not described by segments in either of
+   thost lists is implicitly in an <i>ignored segment</i>.</p></li>
+
+  </ol><p>When the steps above say to <dfn id=set-the-current-base-text>set the current base text</dfn>,
+  it means to run the following steps at that point in the
+  algorithm:</p>
+
+  <ol><li><p>Let <var title="">text range</var> a DOM range whose <a href=#concept-range-start title=concept-range-start>start</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary point</a> (<var title="">current parent</var>, <var title="">start index</var>) and
+   whose <a href=#concept-range-end title=concept-range-end>end</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary point</a> (<var title="">current parent</var>, <var title="">index</var>).</p></li>
+
+   <li><p>Let <var title="">new text segment</var> be a base text
+   segment described by the range <var title="">annotation
+   range</var>.</p>
+
+   </li><li><p>Add <var title="">new text segment</var> to <var title="">base text segments</var>.</p></li>
+
+   <li><p>Let <var title="">current base text</var> be <var title="">new text segment</var>.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id=push-a-ruby-level>push a ruby level</dfn>, it
+  means to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">current parent</var> be the <var title="">index</var>th node in <var title="">current
+   parent</var>.</p></li>
+
+   <li><p>Let <var title="">index</var> be 0.</p></li>
+
+   <li><p>Set <var title="">saved start index</var> to the value of
+   <var title="">start index</var>.</p></li>
+
+   <li><p>Let <var title="">start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id=pop-a-ruby-level>pop a ruby level</dfn>, it means
+  to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">index</var> be the position of <var title="">current parent</var> in <var title="">root</var>.</p></li>
+
+   <li><p>Let <var title="">current parent</var> be <var title="">root</var>.</p></li>
+
+   <li><p>Increment <var title="">index</var> by one.</p></li>
+
+   <li><p>Set <var title="">start index</var> to the value of
+   <var title="">saved start index</var>.</p></li>
+
+   <li><p>Let <var title="">saved start index</var> be null.</p></li>
+
+  </ol><p>When the steps above say to <dfn id=push-a-ruby-annotation>push a ruby annotation</dfn>, it
+  means to run the following steps at that point in the algorithm:</p>
+
+  <ol><li><p>Let <var title="">rt</var> be the <code><a href=#the-rt-element>rt</a></code> element
+   that is the <var title="">index</var>th node of <var title="">current parent</var>.</p></li>
+
+   <li><p>Let <var title="">annotation range</var> a DOM range whose
+   <a href=#concept-range-start title=concept-range-start>start</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary point</a> (<var title="">current parent</var>, <var title="">index</var>) and whose
+   <a href=#concept-range-end title=concept-range-end>end</a> is the <a href=#concept-range-bp title=concept-range-bp>boundary point</a> (<var title="">current parent</var>, <var title="">index</var> plus one)
+   (i.e. that contains only <var title="">rt</var>).</p></li>
+
+   <li><p>Let <var title="">new annotation segment</var> be an
+   annotation segment described by the range <var title="">annotation
+   range</var>.</p></li>
+
+   <li><p>If <var title="">current base text</var> is not null,
+   associate <var title="">new annotation segment</var> with <var title="">current base text</var>.</p></li>
+
+   <li><p>Add <var title="">new annotation segment</var> to <var title="">annotation segments</var>.</p></li>
+
+  </ol><div class=example>
 
    <!-- this is the hiragana for the word "kanji" ("chinese character") in japanese -->
    <!-- in japanese, ruby-like typography is called "furigana" -->
@@ -22045,7 +22410,7 @@
 
   <div class=example>
 
-   <!-- this is the bopomofo for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->
+   <!-- this is the zhuyin fuhao (aka bopomofo) for the word "hanzi" ("chinese character") in traditional chinese, as used in taiwan -->
 
    <p>In this example, each ideograph in the traditional Chinese text
    <span lang=zh-TW title="">漢字</span> is annotated
@@ -22077,6 +22442,21 @@
 
   <!-- Note: Examples are 32px/16px Stone Sans Sem ITC TT -->
 
+  <div class=example>
+
+   <p>In this more contrived example, the acronym "HTML" has four
+   annotations: one for the whole acronym, briefly describing what it
+   is, one for the letters "HT" expanding them to "Hypertext", one for
+   the letter "M" expanding it to "Markup", and one for the letter "L"
+   expanding it to "Language".</p>
+
+   <pre>&lt;ruby&gt;
+ &lt;ruby&gt;HT&lt;rt&gt;Hypertext&lt;/rt&gt;M&lt;rt&gt;Markup&lt;/rt&gt;L&lt;rt&gt;Language&lt;/rt&gt;&lt;/ruby&gt;
+ &lt;rt&gt;An abstract language for describing documents and applications
+&lt;/ruby&gt;</pre>
+
+  </div>
+
 
   <h4 id=the-rt-element><span class=secno>4.6.21 </span>The <dfn><code>rt</code></dfn> element</h4>
 
@@ -69460,7 +69840,7 @@
 
    <li><i>Next byte</i>: Move <var title="">position</var> so it
    points at the next byte in the input byte stream, and return to the
-   step above labeld <i>loop</i>.</li>
+   step above labeled <i>loop</i>.</li>
 
   </ol><p>When the <a href=#prescan-a-byte-stream-to-determine-its-encoding>prescan a byte stream to determine its
   encoding</a> algorithm says to <dfn id=concept-get-attributes-when-sniffing title=concept-get-attributes-when-sniffing>get an attribute</dfn>,
@@ -77922,6 +78302,16 @@
   <code><a href=#the-rp-element>rp</a></code> elements are expected to be wrapped in anonymous
   boxes whose 'display' property has the value 'ruby-base'. <a href=#refsCSSRUBY>[CSSRUBY]</a></p>
 
+  <p>When a particular part of a ruby has more than one annotation,
+  the annotations should be distributed on both sides of the base text
+  so as to minimise the stacking of ruby annotations on one side.</p>
+
+  <p class=note>When it becomes possible to do so, the preceding
+  requirement will be updated to be expressed in terms of CSS ruby.
+  (Currently, CSS ruby does not handle nested <code><a href=#the-ruby-element>ruby</a></code>
+  elements or multiple sequential <code><a href=#the-rt-element>rt</a></code> elements, which is
+  how this semantic is expressed.)</p>
+
   <p>User agents that do not support correct ruby rendering are
   expected to render parentheses around the text of <code><a href=#the-rt-element>rt</a></code>
   elements in the absence of <code><a href=#the-rp-element>rp</a></code> elements.</p>
@@ -85532,6 +85922,9 @@
    character sets — Part 11: Latin/Thai
    alphabet</a></cite>. ISO.</dd>
 
+   <dt id=refsJLREQ>[JLREQ]</dt>
+   <dd><cite><a href=http://www.w3.org/TR/jlreq/>Requirements for Japanese Text Layout</a></cite>. W3C.</dd> <!-- too many editors to list -->
+
    <dt id=refsJPEG>[JPEG]</dt>
    <dd><cite><a href=http://www.w3.org/Graphics/JPEG/jfif3.pdf>JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
 
@@ -86313,6 +86706,7 @@
   Ivan Enderlin,
   Ivo Emanuel Gonçalves,
   J. King,
+  Jacob Davies,
   Jacques Distler,
   Jake Verbaten,
   James Craig,

Index: parsing.html
===================================================================
RCS file: /sources/public/html5/spec/parsing.html,v
retrieving revision 1.183
retrieving revision 1.184
diff -u -d -r1.183 -r1.184
--- parsing.html	14 Sep 2012 01:14:32 -0000	1.183
+++ parsing.html	14 Sep 2012 07:14:25 -0000	1.184
@@ -902,7 +902,7 @@
 
    <li><i>Next byte</i>: Move <var title="">position</var> so it
    points at the next byte in the input byte stream, and return to the
-   step above labeld <i>loop</i>.</li>
+   step above labeled <i>loop</i>.</li>
 
   </ol><p>When the <a href="#prescan-a-byte-stream-to-determine-its-encoding">prescan a byte stream to determine its
   encoding</a> algorithm says to <dfn id="concept-get-attributes-when-sniffing" title="concept-get-attributes-when-sniffing">get an attribute</dfn>,

Index: references.html
===================================================================
RCS file: /sources/public/html5/spec/references.html,v
retrieving revision 1.1255
retrieving revision 1.1256
diff -u -d -r1.1255 -r1.1256
--- references.html	14 Sep 2012 05:13:53 -0000	1.1255
+++ references.html	14 Sep 2012 07:14:26 -0000	1.1256
@@ -636,6 +636,9 @@
    character sets &#8212; Part 11: Latin/Thai
    alphabet</a></cite>. ISO.</dd>
 
+   <dt id="refsJLREQ">[JLREQ]</dt>
+   <dd><cite><a href="http://www.w3.org/TR/jlreq/">Requirements for Japanese Text Layout</a></cite>. W3C.</dd> <!-- too many editors to list -->
+
    <dt id="refsJPEG">[JPEG]</dt>
    <dd><cite><a href="http://www.w3.org/Graphics/JPEG/jfif3.pdf">JPEG File Interchange Format</a></cite>, E. Hamilton.</dd>
 

Received on Friday, 14 September 2012 07:14:35 UTC