w3c / json-ld-syntax

JSON-LD 1.1 Specification
https://w3c.github.io/json-ld-syntax/
Other
112 stars 22 forks source link

Describing `@direction` #276

Closed gkellogg closed 4 years ago

gkellogg commented 4 years ago

Note that examples won't build properly until it's fully supported in the Ruby implementation.

For #11.


Preview | Diff

gkellogg commented 4 years ago

cc/ @r12a and @aphillips. The text references String Meta and riffs off of that content. It likely also may cause you to want to update that document based on the direction (sic) laid out here.

aphillips commented 4 years ago

@gkellogg Thanks! I'll have a look at this PR shortly. String-Meta definitely is in need of an update per our various conversations; I'll try to start in on that as well.

gkellogg commented 4 years ago
  • I think example 76 is incomplete: @direction should either be set to "ltr" or to null for the author; at present, it would set an "rtl" on an english text.

👍

  • We should get the reaction of @aphillips or @r12a, but I believe the official terminology is "base direction". Maybe we should adopt it.

👍

  • Where do you intend to put the two RDF mapping possibilities? The current document just says that the direction will be dropped, which is of course one option.

Those details go in the API document. The text references the Deserialize JSON-LD to RDF Algorithm for a description of how base direction can be preserved using non-standardized mechanisms. Do you think we need to detail them in the syntax document?

  • The text under example 75 got it wrong for the display of the Arabic title; it is not correctly displayed (I let @r12a give you the correct HTML encoding. My experience is that putting such texts into a separate paragraph that is set to rtl is safe; it would actually put the title into a separate, right-justified line, which may make things clearer)

Other than the use of <em> vs <span> it's exactly the same markup as is used in the string-meta document. If I change it to a <div> it works okay, but messes up the flow. Perhaps @aphillips or @r12a can suggest a remedy the preserves flow.

Interestingly, if I add exactly the same markup here, it seems to also mess up (but differently). HTML و CSS: تصميم و إنشاء مواقع الويب. Adding it to a new paragraph preserves order okay:

HTML و CSS: تصميم و إنشاء مواقع الويب

aphillips commented 4 years ago

Interestingly, if I add exactly the same markup here, it seems to also mess up (but differently). HTML و CSS: تصميم و إنشاء مواقع الويب. Adding it to a new paragraph preserves order okay:

HTML و CSS: تصميم و إنشاء مواقع الويب

Regarding "it seems to mess up": the wrapping behavior is actually correct, if you think in terms of being an Arabic speaker--in an RTL language, the start of the string is on the right side (and notice the colon goes to the left of "CSS"). When I saw that this happened in the preview, I thought it was amusing (since it illustrates the need for bidi support) but also confusing if you don't understand what's going on. This is one reason why we tend to put the examples on lines by themselves (for clarity to folks with "left-to-right eyes"): we have to explain that the "brokenness" is because left-to-right readers are trained to expect the LTR token to start the line ("because it is next")--it's a form of confusion about where "start" is.

Ultimately, what you're experiencing is kind of the point of all this. Text that was previously broken in Arabic now reads correctly. It's instructive to have the reverse experience, I think. Here's a google translate of the "Interestingly" quote at the start of this comment (with an LTR span around the title):

ومن المثير للاهتمام ، إذا أضفت نفس الترميز تمامًا هنا ، فيبدو أن الأمر أيضًا يفسد (ولكن بشكل مختلف). HTML و CSS: web design and creation. إضافة إلى فقرة جديدة يحافظ على النظام بخير

image

Anyway, use one line for legibility...

gkellogg commented 4 years ago

@aphillips I found in your document in 4.1.1, the string is represented using <span lang="ar" dir="rtl">HTML و CSS: تصميم و إنشاء مواقع الويب</span> (HTML و CSS: تصميم و إنشاء مواقع الويب), which shows up to me with the Arabic part, followed by ":CSS , HTML". But, in https://github.com/w3c/json-ld-syntax/pull/276#issuecomment-537634650, the exact same span shows as "HTML" followed by the Arabic part, followed by ":CSS ," So, the exact same span renders differently in different contexts.

But, if you think what we have in our doc looks correct, then I won't worry about it.

iherman commented 4 years ago

But, if you think what we have in our doc looks correct, then I won't worry about it.

I ran in the same problem in the PR on the publication manifest. I think that, for readability's sake, putting the problematic sentences into a separate paragraph is better. This is what I did in, e.g., section 2.4.4.1 and section 2.6.2. I agree with @aphillips that keeping such examples on separate lines is more readable

iherman commented 4 years ago

Those details go in the API document. The text references the Deserialize JSON-LD to RDF Algorithm for a description of how base direction can be preserved using non-standardized mechanisms. Do you think we need to detail them in the syntax document?

I am not sure. On the one hand, it would probably make the syntax doc too convoluted, on the other hand, as I said many times, the JSON-LD user will tend to read the syntax document only. I guess once the API document is done in this respect, at the minimum a reference would be a good idea, but I could also see the value of having an informative appendix in the syntax document.

gkellogg commented 4 years ago

But, if you think what we have in our doc looks correct, then I won't worry about it.

I ran in the same problem in the PR on the publication manifest. I think that, for readability's sake, putting the problematic sentences into a separate paragraph is better. This is what I did in, e.g., section 2.4.4.1 and section 2.6.2. I agree with @aphillips that keeping such examples on separate lines is more readable

Okay, I'll take care of that tomorrow. It is a bit disconcerting that the inline experience can be so variable.

gkellogg commented 4 years ago

But, if you think what we have in our doc looks correct, then I won't worry about it.

I ran in the same problem in the PR on the publication manifest. I think that, for readability's sake, putting the problematic sentences into a separate paragraph is better. This is what I did in, e.g., section 2.4.4.1 and section 2.6.2. I agree with @aphillips that keeping such examples on separate lines is more readable

Okay, I'll take care of that tomorrow. It is a bit disconcerting that the inline experience can be so variable.

@iherman I instead put it as a statements table, which shows the directionality properly within table cells; this is consistent with how we treat other examples, see what you think.

aphillips commented 4 years ago

With the exception of my one comment, the latest version looks good to me.

iherman commented 4 years ago

This issue was discussed in a meeting.