Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support auto #73

Merged
merged 2 commits into from
Aug 9, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 5 additions & 16 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,6 @@ <h3 id="string_specific_language">String-specific language information</h3>
</section>





<section>
<h3 id="string_specific_direction">String-specific directional information</h3>

Expand Down Expand Up @@ -383,7 +380,7 @@ <h2 id="defining_bidi_keywords">Defining Bidirectional Keywords in Specification
<p class="definition"><dfn data-lt="directional metadata field|direction field">Directional metadata field</dfn>. A directional metadata field (or <em>direction field</em> for short) is a field in a data structure used to associate a paragraph direction with a given natural language string field or data value.</p>

<aside class="example" id="example-direction-metadata">
<p><strong>Example of a <a>direction field</a>.</strong> In this JSON fragment, the <code>title</code> structure has a value <code>direction</code> which represents the <a>base direction</a> to use for the <code>value</code> field.</p>
<p><strong>Example of a <a>direction field</a>.</strong> In this JSON fragment, the <code>title</code> structure has a field <code>direction</code> which represents the <a>base direction</a> to use for the field <code>value</code>.</p>
<pre class="json">"title": {
"value": "HTML و CSS: تصميم و إنشاء مواقع الويب",
"direction": "rtl",
Expand All @@ -398,7 +395,7 @@ <h2 id="defining_bidi_keywords">Defining Bidirectional Keywords in Specification
<p><strong>Example of a <a>direction attribute</a>.</strong> If the JSON in the <a href="#example-direction-metadata">above example</a> of a <a>directional metadata field</a> were received by a process that was assembling a Web page for display, it might fill in a template similar to the top line in this example to produce markup like the second line. Here the <code>dir</code> attribute from [[HTML]] is an example of a <a>direction attribute</a>.</p>

<pre class="html">
&lt;p dir={$title.direction}>{$title.value}&lt;/p>
&lt;p dir="{$title.direction}">{$title.value}&lt;/p>
&lt;p dir="rtl">HTML و CSS: تصميم و إنشاء مواقع الويب&lt;/p>
</pre>

Expand All @@ -417,24 +414,16 @@ <h2 id="defining_bidi_keywords">Defining Bidirectional Keywords in Specification
<p>The name <code>dir</code> is preferred for an attribute, such as in markup languages. Using <code>direction</code> for an attribute is not recommended, since it is long and relatively uncommon for this use case. Note that both [[HTML]] and [[XML10]] have a built-in <code>dir</code> attribute. A <code>dir</code> attribute should have scope within a document and should be defined to provide bidi isolation.</p>

<div class="req" id="bp-define-direction-values">
<p class="advisement">Define the values of a <a>directional metadata field</a> to include and be limited to <code>ltr</code> and <code>rtl</code>.</p>
</div>

<div class="req" id="bp-define-dir-attribute-values">
<p class="advisement"> Define the values of any <a>direction attribute</a> to include and be limited to the values <code>ltr</code>, <code>rtl</code>, and <code>auto</code>.</p>
</div>

<div class="req" id="bp-dir-auto-non-use">
<p class="advisement">The value <code>auto</code> SHOULD NOT be used in a <a>directional metadata field</a>: omitting the direction is preferred when the content direction is not known.</p>
<p class="advisement">Define the values of a <a>directional metadata field</a> or a <a>direction attribute</a> to include and be limited to the values <code>ltr</code>, <code>rtl</code>, and <code>auto</code>.</p>
</div>

<p>The value <code>ltr</code> indicates a base direction of left-to-right, in exactly the same manner indicated by <a href="https://www.w3.org/TR/css-writing-modes/#direction">CSS writing modes</a> [[CSS-WRITING-MODES-4]]</p>

<p>The value <code>rtl</code> indicates a base direction of right-to-left, in exactly the same manner indicated by <a href="https://www.w3.org/TR/css-writing-modes/#direction">CSS writing modes</a> [[CSS-WRITING-MODES-4]]</p>

<p>The value <code>auto</code> indicates that the user agent uses the first strong character of the content to determine the base direction using the <a href="https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute">algorithm</a> for <code>auto</code> found in [[HTML]].</p>
<p>The value <code>auto</code> indicates that the user agent uses the <a href="https://html.spec.whatwg.org/multipage/dom.html#the-dir-attribute">algorithm</a> for <code>auto</code> defined by [[HTML]] to determine the base paragraph direction.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we describe first-strong in terms of the bidi algorithm in the next paragraph, why are we describing it in terms of the HTML definition here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I split this paragraph up, joining the stuff about the heuristic to the defining paragraph and keeping the guidance on usage separate.

The guidance on usage made me look at section 2.3 again, which I think is now in need of an overhaul 😿


<p class="note">The heuristic used by <code>auto</code> just looks at the first character with a strong directionality, in a manner analogous to the Paragraph Level determination in the bidirectional algorithm [[UAX9]]. Authors are urged to only use this value as a last resort when the direction of the text is truly unknown and no better server-side heuristic can be applied.</p>
<p>The heuristic used by <code>auto</code> looks for the first character with a strong directionality, in a manner analogous to the Paragraph Level determination in the bidirectional algorithm [[UAX9]]. When applied to multiple fields or to a document as a whole, it can mean that the direction should be individually derived for each field (with string-local metadata providing an override for cases that cannot be determined automatically). Then again, this value might mean that the base direction of the associated content is not known. Whenever possible, the actual base direction (<code>ltr</code> or <code>rtl</code>) should be stored or exchanged instead of <code>auto</code>. Omitting the <a>direction field</a> is preferable when the value is truly unknown.</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about this:
The heuristic used by auto looks for the first character with a strong directionality, in a manner analogous to the Paragraph Level determination in the bidirectional algorithm [UAX9]. When applied to multiple fields or to a document as a whole, it means that the direction should be individually derived for each field (with string-specific metadata providing an override for cases that cannot be determined automatically). It can be useful for labelling a group of mixed direction strings, when the base direction of most strings can be reliably determined using the first-strong heuristics. Whenever possible, the actual base direction (ltr or rtl) of individual strings should be stored or exchanged instead of auto. Omitting the direction field is preferable when the value is truly unknown.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this very much. Done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And then I addressed your first comment... by splitting this paragraph up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use the attributes <code class="kw" translate="no">...</code> for keywords like auto.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this change globally.


</section>

Expand Down