Re: Rework of Bidi inline article

Hi Aharon,

The HTML5 algorithm was always, and is still, the one that's 
problematic, in that it's not crystal clear to me exactly what you are 
proposing, and I'd like to be sure I get that clear in my mind before 
proceeding. The the logic of the cascading 'otherwise's is too vague 
(apart from the problem that it really helps to be a programmer to 
understand the whole cascade).


On 08/02/2012 13:15, Aharon (Vladimir) Lanin wrote:
> Putting it all together in HTML5:
>
> To summarize, in HTML5, to make sure that a phrase that contains any
> opposite-direction characters is displayed correctly, do the following:
>
> 1. If the phrase is already tightly wrapped in an element that has
> non-inline display (e.g. a <p> or <div> element), and setting this
> element's alignment to the "start" of the phrase's direction happens to
> be desirable, set the existing element's dir attribute. If you do not
> know the phrase's direction, set the dir attribute to "auto". If the
> phrase is known to have the same direction as the context, it is not
> necessary to set it.
> 2. Otherwise,

Is this 'if the phrase is tightly wrapped in an inline element, and...' 
or 'if the  phrase is either not tightly wrapped in an element or the 
phrase is tightly wrapped in an inline element, and...' or 'if setting 
this element's alignment to the "start" of the phrase's direction 
happens to be UNdesirable, and... ', or all of the above.?

 > if you know the phrase's overall direction (or have a
> better way of determining it than the method used by dir="auto"), wrap
> the phrase in <bdi dir="ltr"> or <bdi dir="rtl">, as appropriate. Since
> the phrase contains some opposite-direction characters, do this even
> when the phrase's overall direction is the same as the context.
> 3. (Optional) Otherwise,


Presumably this is 'if you don't know the phrase's overall direction 
and...'?


> if the phrase is already tightly wrapped by an
> element with inline display, add dir="auto" to the element.
> 4. Otherwise,

So this must be, if you don't know the phrase's direction and the phrase 
is not tightly wrapped...

> wrap the phrase in <bdi>. Without an explicit dir value,
> dir="auto" is implied.
>


This is what I understood:

1. If you know the phrase's direction, or can work it out for injected 
text, then
 a. if the phrase is already tightly wrapped by a block element, and 
there will be no adverse alignment effects, set dir on the block element 
to dir=ltr or dir=rtl.

 b. in any other case, wrap the phrase in <bdi dir="ltr"> or <bdi 
dir="rtl">, as appropriate (if already wrapped by a span element, 
replace the span with this)


2. If you don't know the phrase's direction, ie. the text will be 
injected at run time, then
 a. if the phrase is already tightly wrapped by an element, add 
dir="auto" to the element.

 b. wrap the phrase in bdi. Without an explicit dir value, dir="auto" is 
implied.


This would lead to the following conversions, if you DO know the direction:

<p>The-phrase</p> =>
<p dir=rtl/ltr>The-phrase</p>

<p>The-phrase</p> (where you want the same alignment as for context) =>
<p><bdi dir=rtl/ltr>The-phrase</bdi></p>

<p>Static-text <cite>The-phrase</cite>... =>
<p>Static-text <cite><bdi dir=rtl/ltr>The-phrase</bdi></cite>

<p>Static-text The-phrase... =>
<p>Static text <bdi dir=rtl/ltr>The-phrase</bdi>...



And to the following conversions, if you DON'T know the direction:

<p>The-phrase</p> =>
<p dir=auto>The-phrase</p>

<p>Static-text <cite>The-phrase</cite>... =>
<p>Static-text <cite dir=auto>The-phrase</cite>

<p>Static-text The-phrase... =>
<p>Static text <bdi>The-phrase</bdi>...


Is that what you mean?


You then said:

 > Actually, I am think of getting rid of step 3 in the HTML5 version (the
 > one marked Optional). <cite dir="auto">foo</cite> is not significantly
 > shorter than
 > <cite><bdi>foo</bdi></cite>, and has no other advantages.


That would then mean that dir=auto is only recommended for use on block 
elements. Is that what you meant?

RI

Received on Wednesday, 29 February 2012 12:58:08 UTC