Skip to content

Commit 003f462

Browse files
committed
[css-ruby-1] Add box model diagrams, improve intro example descriptions.
1 parent 5e37b61 commit 003f462

File tree

6 files changed

+97
-8
lines changed

6 files changed

+97
-8
lines changed

css-ruby-1/Overview.bs

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,18 @@ What is ruby?</h3>
4545
that appears alongside another run of text (referred to as the “base”)
4646
and serves as an annotation or a pronunciation guide associated with that run of text.
4747

48+
<figure>
49+
<img src="images/ruby-context.png"
50+
alt="Hiragana ruby annotations above each kanji in Japanese text">
51+
<figcaption>A run of Japanese text with phonetic ruby annotations indicating the pronunciation of each ideograph.</figcaption>
52+
</figure>
53+
4854
The following figures show two examples of Ruby,
4955
a simple case and one with more complicated structure.
5056

5157
<div class="example">
52-
In this first example, a single annotation is used to annotate the base text.
58+
In this example, a single annotation is used to annotate a base text
59+
consisting of multiple characters.
5360
<div class="figure">
5461
<img src="images/licence.png"
5562
alt="Example of ruby applied on top of a Japanese expression">
@@ -64,20 +71,21 @@ What is ruby?</h3>
6471

6572
<div class="example">
6673
In this second example,
67-
two levels of annotations are attached to a base sequence:
74+
two levels of annotations are attached to the base text:
6875
the hiragana characters on top refer to the pronunciation of each of the base kanji characters,
69-
while the words “Keio” and “University” on the bottom are annotations describing the English translation.
76+
while the words “Keio” and “University” on the bottom are give the English translation.
7077
<div class="figure">
7178
<img src="images/ruby-univ.gif"
7279
alt="Example showing complex ruby with annotation text over and under the base characters">
7380
<p class="caption">Complex ruby with annotation text over and under the base characters
7481
</div>
7582

76-
Notice that to allow correct association between the hiragana characters and
77-
their corresponding Kanji base characters,
78-
the spacing between these Kanji characters is adjusted.
79-
(This happens around the fourth Kanji character in the figure above.)
80-
To avoid variable spacing between the Kanji characters in the example above
83+
Notice that to reflect the correct association
84+
of hiragana characters and their corresponding Kanji base characters,
85+
the spacing within the base-level text is adjusted.
86+
(This happens around the fourth Kanji character in the figure above,
87+
which has a three-character phonetic gloss.)
88+
To avoid variable spacing of the base text in the example above,
8189
the hiragana annotations can be styled as a [=merged annotation=],
8290
which will look more like the group-ruby example earlier.
8391
However because the base-annotation [=pairings=] are recorded in the ruby structure,
@@ -168,9 +176,27 @@ Ruby Box Model</h2>
168176
there are “rows” (the [=base text level=], each [=annotation level=])
169177
and “[=columns=]” (each [=ruby base=] and its corresponding [=ruby annotations=]).
170178

179+
<figure>
180+
<img src="images/ruby-boxes-simple.png"
181+
alt="Ruby structure arranged as a table,
182+
the first “column” containing 上 in a base box with じょう centered below in an annotation box
183+
and the second “column” containing 手 in a separate base box with ず centered below in another annotation box.">
184+
<figcaption>The Japanese compound word “上手” annotated with its pronunciation “じょうず”. Each syllable is associated individually with its base character.</figcaption>
185+
</figure>
186+
171187
Consecutive bases and annotations are grouped together into [=ruby segments=].
172188
Within a [=ruby segment=], a [=ruby annotation=] may span multiple [=ruby bases=].
173189

190+
<figure>
191+
<img src="images/ruby-boxes-complex.png"
192+
alt="Ruby structure arranged as a table,
193+
the first “column” containing 旧 in a base box with jiù centered above in an annotation box,
194+
the second “column” containing 金 in a base box with jīn centered above in an annotation box,
195+
the third “column” containing 山 in a base box with .shān centerered above it in an annotation box,
196+
and the name San Francisco centered below the entire phrase in an annotation box that spans all three “columns”.">
197+
<figcaption>The Chinese city name “旧金山” annotated with its pronunciation in Pinyin “jiùjīnshān” and its English name “San Francisco”. Each Pinyin syllable is associated individually with its base character, however the English name is associated with the name as a whole.</figcaption>
198+
</figure>
199+
174200
Note: In HTML, a single <code>&lt;ruby&gt;</code> element may contain multiple [=ruby segments=].
175201
(In the XHTML Ruby model, a single <code>&lt;ruby&gt;</code> element can only contain one [=ruby segment=].)
176202

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<style>
3+
@import "dia.css";
4+
body { display: flex; align-items: center; }
5+
body > .ruby { display: grid; grid-template-columns: auto auto auto; }
6+
.ruby > div { display: grid; grid-template-columns: subgrid; }
7+
.rtc, .rbc { grid-column: span 3; }
8+
</style>
9+
10+
<div class=ruby>
11+
<div class="rtc">
12+
<div class="rt">jiù</div><div class="rt">jīn</div><div class="rt">shān</div>
13+
</div>
14+
<div class="rbc">
15+
<div class="rb"></div><div class="rb"></div><div class="rb"></div>
16+
</div>
17+
<div class="rtc">
18+
<div class="rt" style="grid-column: span 3">San Francisco</div>
19+
</div>
20+
</div>
21+
22+
<div class="labels">
23+
<div>
24+
<div class="rb">ruby bases</div>
25+
<div class="rbc">ruby base container</div>
26+
</div>
27+
<div class="ruby">ruby container</div>
28+
<div>
29+
<div class="rt">ruby annotations</div>
30+
<div class="rtc">ruby annotation container</div>
31+
</div>
32+
</div>
16.9 KB
Loading
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<style>
3+
@import "dia.css";
4+
body { display: flex; align-items: center; }
5+
body > .ruby { display: grid; grid-template-columns: auto auto auto; }
6+
.ruby div { display: grid; grid-template-columns: subgrid; }
7+
.rtc, .rbc { grid-column: span 2; }
8+
</style>
9+
10+
<div class=ruby>
11+
<div class="rbc">
12+
<div class="rb"></div><div class="rb"></div>
13+
</div>
14+
<div class="rtc">
15+
<div class="rt">じょう</div><div class="rt"></div>
16+
</div>
17+
</div>
18+
19+
<div class="labels">
20+
<div>
21+
<div class="rb">ruby bases</div>
22+
<div class="rbc">ruby base container</div>
23+
</div>
24+
25+
<div class="ruby">ruby container</div>
26+
27+
<div>
28+
<div class="rt">ruby annotations</div>
29+
<div class="rtc">ruby annotation container</div>
30+
</div>
31+
</div>
14.2 KB
Loading

css-ruby-1/images/ruby-context.png

7.45 KB
Loading

0 commit comments

Comments
 (0)