Skip to content

Commit 936118e

Browse files
committed
[css-ruby] Try to improve parens generation
1 parent 7750409 commit 936118e

2 files changed

Lines changed: 27 additions & 24 deletions

File tree

css-ruby/Overview.html

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1364,24 +1364,25 @@ <h3 class=no-num id=default-parens> Generating Parentheses</h3>
13641364
<p>Unfortunately, because Selectors cannot match against text nodes, it's
13651365
not possible with CSS to express rules that will automatically and
13661366
correctly add parentheses to unparenthesized ruby annotations in HTML.
1367-
However, an author rigorously using <code>&lt;rtc&gt;</code> elements
1368-
around all annotations can use CSS Level 2 generated content <a
1369-
href="#CSS21" rel=biblioentry>[CSS21]<!--{{!CSS21}}--></a> to generate
1370-
parentheses:
1367+
(This is because HTML ruby allows implying the <a
1368+
href="#ruby-base"><i>ruby base</i></a> from raw text, without a
1369+
corresponding element.) However, these rules will handle cases where
1370+
either <code>&lt;rb&gt;</code> or <code>&lt;rtc&gt;</code> is used
1371+
rigorously.
13711372

13721373
<pre>
1374+
<!-- -->/* Parens around &lt;rtc> */
13731375
<!-- -->rtc::before { content: "("; }
1374-
<!-- -->rtc::after { content: ")"; }</pre>
1376+
<!-- -->rtc::after { content: ")"; }
13751377

1376-
<p>Alternatively, an author rigorously using both <code>&lt;rb&gt;</code>
1377-
and <code>&lt;rt&gt;</code> elements but no <code>&lt;rtc&gt;</code>
1378-
elements can use these rules instead:
1378+
<!-- -->/* Parens before first &lt;rt> not inside &lt;rtc> */
1379+
<!-- -->rb + rt::before,
1380+
<!-- -->rtc + rt::before { content: "("; }
13791381

1380-
<pre>
1381-
<!-- -->rb + rt::before { content: "("; }
1382-
<!-- -->rt:last-child::after, rt + rb::before { content: ")"; }</pre>
1383-
1384-
<p class=Issue>Try to make these smarter somehow?
1382+
<!-- -->/* Parens after &lt;rt> not inside &lt;rtc> */
1383+
<!-- -->rb ~ rt:last-child::after,
1384+
<!-- -->rt + rb::before { content: ")"; }
1385+
<!-- -->rt + rtc::before { content: ")("; }</pre>
13851386

13861387
<h2 id=glossary><span class=secno>4. </span> Glossary</h2>
13871388

css-ruby/Overview.src.html

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,21 +1009,23 @@ <h3 id="default-parens" class="no-num">
10091009
<p>Unfortunately, because Selectors cannot match against text nodes,
10101010
it's not possible with CSS to express rules that will automatically and correctly
10111011
add parentheses to unparenthesized ruby annotations in HTML.
1012-
However, an author rigorously using <code>&lt;rtc&gt;</code> elements
1013-
around all annotations
1014-
can use CSS Level 2 generated content [[!CSS21]] to generate parentheses:
1012+
(This is because HTML ruby allows implying the <i>ruby base</i> from raw text, without a corresponding element.)
1013+
However, these rules will handle cases where either <code>&lt;rb&gt;</code>
1014+
or <code>&lt;rtc&gt;</code> is used rigorously.
1015+
10151016
<pre>
1017+
<!-- -->/* Parens around &lt;rtc> */
10161018
<!-- -->rtc::before { content: "("; }
1017-
<!-- -->rtc::after { content: ")"; }</pre>
1019+
<!-- -->rtc::after { content: ")"; }
10181020

1019-
<p>Alternatively, an author rigorously using
1020-
both <code>&lt;rb&gt;</code> and <code>&lt;rt&gt;</code> elements but no <code>&lt;rtc&gt;</code> elements
1021-
can use these rules instead:
1022-
<pre>
1023-
<!-- -->rb + rt::before { content: "("; }
1024-
<!-- -->rt:last-child::after, rt + rb::before { content: ")"; }</pre>
1021+
<!-- -->/* Parens before first &lt;rt> not inside &lt;rtc> */
1022+
<!-- -->rb + rt::before,
1023+
<!-- -->rtc + rt::before { content: "("; }
10251024

1026-
<p class="Issue">Try to make these smarter somehow?</p>
1025+
<!-- -->/* Parens after &lt;rt> not inside &lt;rtc> */
1026+
<!-- -->rb ~ rt:last-child::after,
1027+
<!-- -->rt + rb::before { content: ")"; }
1028+
<!-- -->rt + rtc::before { content: ")("; }</pre>
10271029

10281030
<h2 id="glossary">
10291031
Glossary</h2>

0 commit comments

Comments
 (0)