@@ -1572,24 +1572,39 @@ Appendix A: Default Style Sheet</h2>
1572
1572
1573
1573
Unfortunately, because Selectors cannot match against text nodes,
1574
1574
it's not possible with CSS to express rules that will automatically and correctly
1575
- add parentheses to unparenthesized ruby annotations in HTML.
1576
- (This is because HTML ruby allows implying the [=ruby base=] from raw text, without a corresponding element.)
1577
- However, these rules will handle cases where either <code> <rb></code>
1578
- or <code> <rtc></code> is used rigorously.
1575
+ add parentheses to unparenthesized ruby annotations
1576
+ for all possible ruby markup patterns in HTML.
1577
+ (This is because HTML ruby allows implying the [=ruby base=] from raw text
1578
+ without a corresponding element.)
1579
+
1580
+ However, these rules will add parentheses around each annotation sequence
1581
+ in cases where either <code> <rb></code>
1582
+ or <code> <rtc></code> is used rigorously:
1579
1583
1580
1584
<pre highlight=css>
1581
1585
/* Parens around <rtc> */
1582
- rtc::before { content: "( "; }
1583
- rtc::after { content: ") "; }
1586
+ rtc::before { content: "( "; }
1587
+ rtc::after { content: ") "; }
1584
1588
1585
1589
/* Parens before first <rt> not inside <rtc> */
1586
1590
rb + rt::before,
1587
- rtc + rt::before { content: "( "; }
1591
+ rtc + rt::before { content: "( "; }
1588
1592
1589
1593
/* Parens after <rt> not inside <rtc> */
1590
1594
rb ~ rt:last-child::after,
1591
- rt + rb::before { content: ")"; }
1592
- rt + rtc::before { content: ")("; }</pre>
1595
+ rt + rb::before { content: ")"; }
1596
+ rt + rtc::before { content: ")("; }</pre>
1597
+
1598
+ Alternatively, if it is known that a purely alternating style of markup is used
1599
+ (<code> <ruby>A<rt> a</rt> B<rt> b</rt> C<rt> c</rt> <ruby></code> )
1600
+ where there are no adjacent ruby annotations,
1601
+ the following rules will add parentheses around each annotation:
1602
+
1603
+ <pre highlight=css>
1604
+ /* Parens around each <rt> */
1605
+ rt::before { content: "("; }
1606
+ rt::after { content: ")"; }
1607
+ </pre>
1593
1608
1594
1609
<h2 id="glossary">
1595
1610
Glossary</h2>
0 commit comments