Re: [css-ruby] Auto value of ruby-position

On Sat, Feb 21, 2015 at 3:15 PM, Xidorn Quan <quanxunzhen@gmail.com> wrote:

> 2015年2月21日 下午4:55于 "fantasai" <fantasai.lists@inkedblade.net>写道:
> >
> > On 02/20/2015 08:59 PM, Xidorn Quan wrote:
> >>
> >>
> >> I'm a little concerned about this syntax, because "ruby-position" is
> currently a property applied to <rtc>. The "alternate"
> >> doesn't seem like something should be there. The value is effectively
> only "over", "under", and "inter-character" for
> >> ruby-position. "alternate" seems more likely to be something applied on
> <ruby>s.
> >>
> >> Even if we want this syntax, I guess we probably shouldn't use "||"
> here if the "over | under" is for the first level.
> >> Probably "[ over | under ] [ alternate ]?" is better.
> >
> >
> > It applies to <rtc>, but it inherits, so it could very well have
> > been specified on <ruby> or even <html>.
> >
> > Also, we try to avoid requiring particular order of keywords when
> > parsing is ambiguous.
>
> But if alternate is put in front of over/under, it would be pretty
> confused for authors to realize that the second value is for the first
> level.
>
> > I think in most cases people can just write:
> >   ruby-position: alternate;
> > but if they want it to start on a different side, then
> >   ruby-position: under alternate;
>
> We can simply make
>   ruby-position: over alternate;
> the default value, which means authors just don't need to use the single
> 'alternate' at all, which also means it doesn't save any bits to allow the
> single keyword value 'alternate'.
>
In addition, I don't want to see that the syntax of ruby-position becomes
more complicated only for some rarely used or even imaginary use cases. I
think adding a single keyword value, whatever it is 'auto' or 'alternate',
to the list is enough to address the existing use cases.

I have an idea which wouldn't complicate the existing syntax, but may
covers a bit more use cases is that, we use keyword like 'opposite'
instead, which means the position is opposite to the position before. If it
is the first level, or the position of the previous level is
'inter-character', it is equal to 'over'.

With 'opposite', if the author wants to make the first level 'under' but
then alternate, he can write rules like:
  ruby { ruby-position: under; }
  rtc { ruby-position: opposite; }
  rtc:nth-child(1 of rt, rtc) { ruby-position: under; }
I admit that it is not perfect (when the second level is not wrapped in
<rtc>), and a little complicated for author, but it should work for most
cases. If one day we allow the limited version of :has() in the fast
profile, it would be possible to write a more perfect one like:
  ruby:has(>rt:nth-child(1 of rt, rtc)) { ruby-position: under; }
  rtc { ruby-position: opposite; }
  rtc:nth-child(1 of rt, rtc) { ruby-position: under; }
Since having more than two levels is extremely rare, I think it has been
enough. And authors can always wrap ruby texts in ruby text containers for
fine-grained control without changing the semantic. So I think we shouldn't
need to worry a lot about this.

- Xidorn

Received on Saturday, 21 February 2015 23:23:06 UTC