Skip to content

Commit 7de89a3

Browse files
committed
[css-ruby] Specify white space handling
1 parent 092bf24 commit 7de89a3

2 files changed

Lines changed: 146 additions & 7 deletions

File tree

css-ruby/Overview.html

Lines changed: 83 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<meta content="CSS Ruby Module Level 1" name=dcterms.title>
2121
<meta content=text name=dcterms.type>
22-
<meta content=2013-06-21 name=dcterms.date>
22+
<meta content=2013-06-22 name=dcterms.date>
2323
<meta content="Elika J. Etemad" name=dcterms.creator>
2424
<meta content="Koji Ishii" name=dcterms.creator>
2525
<meta content="Richard Ishida" name=dcterms.creator>
@@ -40,8 +40,8 @@
4040
<h1 class=p-name>CSS Ruby Module Level 1</h1>
4141

4242
<h2 class="no-num no-toc" id=longstatus-date->Editor's Draft <time
43-
class=dt-updated datetime=20130621>21 June 2013</time>
44-
<!-- for HTML4 doctype: <span class="value-title" title="20130621">21 June 2013</span></span> --></h2>
43+
class=dt-updated datetime=20130622>22 June 2013</time>
44+
<!-- for HTML4 doctype: <span class="value-title" title="20130622">22 June 2013</span></span> --></h2>
4545

4646
<dl>
4747
<dt>This version:
@@ -204,8 +204,11 @@ <h2 class="no-num no-toc" id=contents> Table of Contents</h2>
204204
Ruby</a>
205205
</ul>
206206

207-
<li><a href="#ruby-line-breaking"><span class=secno>2.4. </span> Ruby
208-
box and line breaking</a>
207+
<li><a href="#white-space"><span class=secno>2.4. </span> White
208+
Space</a>
209+
210+
<li><a href="#line-breaking"><span class=secno>2.5. </span> Ruby box and
211+
line breaking</a>
209212
</ul>
210213

211214
<li><a href="#ruby-props"><span class=secno>3. </span> Ruby Properties</a>
@@ -643,7 +646,81 @@ <h4 id=nested-pairing><span class=secno>2.3.1. </span> Nested Ruby</h4>
643646
<p class=issue>This shouldn't belong in Level 1. But HTML5 allows it, so we
644647
have to handle it. Yay HTML5.
645648

646-
<h3 id=ruby-line-breaking><span class=secno>2.4. </span> Ruby box and line
649+
<h3 id=white-space><span class=secno>2.4. </span> White Space</h3>
650+
651+
<p class=issue>I'm unsure exactly where space should be trimmed. :/ But
652+
pretty sure we need to keep spaces between things, otherwise ruby only
653+
works for CJK.
654+
655+
<p><i>Collapsible</i> white space within a ruby structure is discarded at
656+
the beginning and end of a <a href="#ruby-container-box"><i>ruby
657+
container</i></a>, and at the beginning/end of a <a
658+
href="#ruby-annotation-box"><i>ruby annotation box</i></a> or <a
659+
href="#ruby-base-box"><i>ruby base box</i></a> if white space is not its
660+
only contents. Between <a href="#ruby-segments"><i>ruby segments</i></a>,
661+
between <a href="#ruby-base-box"><i>ruby bases</i></a>, and between <a
662+
href="#ruby-annotation-box"><i>ruby annotations</i></a>, however, white
663+
space is not discarded. If such the white space is <i>collapsible</i>, it
664+
will collapse following the standard <a
665+
href="http://www.w3.org/TR/css3-text/#white-space-rules">white space
666+
processing rules</a>. [[!CSS3-TEXT]] Between <a
667+
href="#ruby-segments"><i>ruby segments</i></a>, however, the contextual
668+
text for determining collapsing behavior is given by the <a
669+
href="#ruby-base-box"><i>ruby bases</i></a> on either side, not the text
670+
on either side of the white space in the source document.
671+
672+
<div class=note>
673+
<p>Note that the white space processing rules cause a white space sequence
674+
containing a <i>segment break</i> (such as a line feed) to <a
675+
href="http://www.w3.org/TR/css3-text/#line-break-transform">collapse to
676+
nothing</a> between CJK characters. This means that CJK ruby can safely
677+
use white space for indentation of the ruby markup. For example, the
678+
following markup will display without any spaces:
679+
680+
<pre>
681+
<!-- -->&lt;ruby>
682+
<!-- --> &lt;rb>東&lt;/rb>&lt;rb>京&lt;/rb>
683+
<!-- --> &lt;rt>とう&lt;/rt>&lt;rt>きょう&lt;/rt>
684+
<!-- -->&lt;/ruby></pre>
685+
686+
<p>However, this markup will: <!-- -->&lt;ruby> <!-- -->
687+
&lt;rb>東&lt;/rb> &lt;rb>京&lt;/rb> <!-- --> &lt;rt>とう&lt;/rt>
688+
&lt;rt>きょう&lt;/rt> <!-- -->&lt;/ruby>
689+
</div>
690+
691+
<p>Any preserved white space is then wrapped in an anonymous box belonging
692+
to the <a href="#ruby-base-container-box"><i>ruby base container</i></a>
693+
(if between <a href="#ruby-base-box"><i>ruby bases</i></a>), <a
694+
href="#ruby-annotation-container-box"><i>ruby annotation container</i></a>
695+
(if between <a href="#ruby-annotation-box"><i>ruby annotations</i></a>),
696+
or <a href="#ruby-container-box"><i>ruby container</i></a> (if between <a
697+
href="#ruby-segments"><i>ruby segments</i></a>). In the latter case, the
698+
text is considered part of the <i>base level</i>. This box does not take
699+
part in pairing. It merely ensures separation between adjacent
700+
bases/annotations.
701+
702+
<div class=example>
703+
<p>These rules allow ruby to be used with space-separated scripts such as
704+
Latin. For example,
705+
706+
<pre>
707+
<!-- -->&lt;ruby>
708+
<!-- --> &lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>
709+
<!-- --> &lt;rt>World&lt;/rt> &lt;rt>Wide&lt;/rt> &lt;rt>Web&lt;/rt>
710+
<!-- -->&lt;/ruby></pre>
711+
712+
<p>They also ensure that annotated white space is preserved. For example,
713+
714+
<pre>
715+
<!-- -->&lt;ruby>
716+
<!-- --> &lt;rb>Aerith&lt;/rb>&lt;rb> &lt;/rb>&lt;rb>Gainsboro&lt;/rb>
717+
<!-- --> &lt;rt>エアリス&lt;/rt>&lt;rt>・&lt;/rt>&lt;rt>ゲインズブール&lt;/rt>
718+
<!-- -->&lt;/ruby></pre>
719+
</div>
720+
721+
<p class=issue>Specify how this impacts layout, or not.
722+
723+
<h3 id=line-breaking><span class=secno>2.5. </span> Ruby box and line
647724
breaking</h3>
648725

649726
<p>When there is not enough space for an entire <a

css-ruby/Overview.src.html

Lines changed: 63 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,69 @@ <h4 id="nested-pairing">
381381

382382
<p class="issue">This shouldn't belong in Level 1. But HTML5 allows it, so we have to handle it. Yay HTML5.
383383

384-
<h3 id="ruby-line-breaking">
384+
<h3 id="white-space">
385+
White Space</h3>
386+
387+
<p class="issue">I'm unsure exactly where space should be trimmed. :/
388+
But pretty sure we need to keep spaces between things,
389+
otherwise ruby only works for CJK.
390+
391+
<p><i>Collapsible</i> white space within a ruby structure is discarded
392+
at the beginning and end of a <i>ruby container</i>,
393+
and at the beginning/end of a <i>ruby annotation box</i> or <i>ruby base box</i> if white space is not its only contents.
394+
Between <i>ruby segments</i>, between <i>ruby bases</i>, and between <i>ruby annotations</i>, however,
395+
white space is not discarded.
396+
If such white space is <i>collapsible</i>, it will collapse
397+
following the standard <a href="http://www.w3.org/TR/css3-text/#white-space-rules">white space processing rules</a>. [[!CSS3-TEXT]]
398+
Between <i>ruby segments</i>, however,
399+
the contextual text for determining collapsing behavior is given by the <i>ruby bases</i> on either side,
400+
not the text on either side of the white space in the source document.
401+
402+
<div class="note">
403+
<p>Note that the white space processing rules
404+
cause a white space sequence containing a <i>segment break</i> (such as a line feed)
405+
to <a href="http://www.w3.org/TR/css3-text/#line-break-transform">collapse to nothing</a> between CJK characters.
406+
This means that CJK ruby can safely use white space for indentation of the ruby markup.
407+
For example, the following markup will display without any spaces:
408+
<pre>
409+
<!-- -->&lt;ruby>
410+
<!-- --> &lt;rb>東&lt;/rb>&lt;rb>京&lt;/rb>
411+
<!-- --> &lt;rt>とう&lt;/rt>&lt;rt>きょう&lt;/rt>
412+
<!-- -->&lt;/ruby></pre>
413+
<p>However, this markup will:
414+
<!-- -->&lt;ruby>
415+
<!-- --> &lt;rb>東&lt;/rb> &lt;rb>京&lt;/rb>
416+
<!-- --> &lt;rt>とう&lt;/rt> &lt;rt>きょう&lt;/rt>
417+
<!-- -->&lt;/ruby></pre>
418+
</div>
419+
420+
<p>Any preserved white space is then wrapped in an anonymous box belonging to
421+
the <i>ruby base container</i> (if between <i>ruby bases</i>),
422+
<i>ruby annotation container</i> (if between <i>ruby annotations</i>),
423+
or <i>ruby container</i> (if between <i>ruby segments</i>).
424+
In the latter case, the text is considered part of the <i>base level</i>.
425+
This box does not take part in pairing.
426+
It merely ensures separation between adjacent bases/annotations.
427+
428+
<div class="example">
429+
<p>These rules allow ruby to be used with space-separated scripts such as Latin.
430+
For example,
431+
<pre>
432+
<!-- -->&lt;ruby>
433+
<!-- --> &lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>&lt;rb>W&lt;/rb>
434+
<!-- --> &lt;rt>World&lt;/rt> &lt;rt>Wide&lt;/rt> &lt;rt>Web&lt;/rt>
435+
<!-- -->&lt;/ruby></pre>
436+
<p>They also ensure that annotated white space is preserved. For example,
437+
<pre>
438+
<!-- -->&lt;ruby>
439+
<!-- --> &lt;rb>Aerith&lt;/rb>&lt;rb> &lt;/rb>&lt;rb>Gainsboro&lt;/rb>
440+
<!-- --> &lt;rt>エアリス&lt;/rt>&lt;rt>・&lt;/rt>&lt;rt>ゲインズブール&lt;/rt>
441+
<!-- -->&lt;/ruby></pre>
442+
</div>
443+
444+
<p class="issue">Specify how this impacts layout, or not.
445+
446+
<h3 id="line-breaking">
385447
Ruby box and line breaking</h3>
386448

387449
<p>When there is not enough space for an entire <i>ruby container</i> to fit on the line,

0 commit comments

Comments
 (0)