Re: [ruby] Parsing-based approach

On 07/25/2012 10:46 PM, Bob Myers wrote:
> Everyone,
>
> It strikes me from reading "Use Cases & Exploratory Approaches for Ruby Markup" that none of the approaches presented there is
> really compelling with all due respect to those who have contributed to them. I fear the complexity of the markup could hold
> back use of this useful feature. I have no idea if there is room to consider alternative approaches, but I'll nevertheless go
> ahead and propose one here, which can hopefully co-exist with existing ruby specs and implementations for backward compatibility.
>
> The basic notion is that markup such as <ruby>東京(とうきょう)</ruby> should JUST WORK. In this case, the reading portion
> (text) is rendered as ruby above the base (if the browser supports it; otherwise, it falls back naturally).
>
> To make this work, we need a notion of /parsing /the contents of the <ruby> element into text and base. A first approximation
> would be CSS properties that give the beginning and ending delimiter ("(" and ")" in this case) of the ruby text portion:
>
> ruby {
>    ruby-parse-text-delimiters: "(" ")";
> }
>

While making such markup "Just Work" sounds very convenient, parsing markup
is outside the domain of CSS. I think it would make more sense to take this
up as an HTML feature. Or to use SGML, I'm sure it has some way of turning
parentheses into <rt> tags...

> In order to allow styling of base vs. text, we can use pseudo-elements:
>
> .my-ruby-class:ruby-base { color: red; }
> .my-ruby-class:ruby-text { color: green; }
>
> Turn off ruby with
>
> .my-ruby-class::ruby-text { display: none; }
>
> Of course, markup could also be given directly within the <ruby> tag, so
>
> <ruby>東京<span style="color: purple; ">(とうきょう)</span><ruby>
>
> But what about the "mono" vs. "group" distinction? Current proposals, as I understand them, require the HTML author to decide
> which she wants and author accordingly, with multiple <rb> and <rt> tags for the mono case. It would be ideal if the markup
> could be simpler, and the mono vs. group selection could be made at the CSS level. To allow this, I propose the notion of a
> "ruby segment delimiter" which breaks both the base and text into segments, which can be paired in the mono case, or ignored
> in the group case, depending on a CSS setting. Using a slash "/" as the segment delimiter, we would have:
>
> 東/京(とう/きょう)

This would make no sense in the fallback case: you do not want the
slash to show up, ever.

~fantasai

Received on Tuesday, 31 July 2012 01:37:04 UTC