w3c / ttml2

Timed Text Markup Language 2 (TTML2)
https://w3c.github.io/ttml2/
Other
41 stars 16 forks source link

Improve anonymous span prose. #1139

Closed palemieux closed 4 years ago

palemieux commented 5 years ago

[construct anonymous span](3) specifies:

for each span element whose child is a single anonymous span, replace the anonymous span with its sequence of child text nodes

This means that <span><anonymous_span></anonymous_span></span> becomes <span><text_node/></span>.

However, [construct anonymous span](1) specifies:

for each significant text node in a content element, synthesize an anonymous span to enclose the text node, substituting the new anonymous span for the original text node child in its sibling and parent hierarchy

This means that <span><text_node/></span> becomes <span><anonymous_span></anonymous_span></span>.

Doesn't this yield an infinite loop? Perhaps [construct anonymous span](3) was intended to apply to nested anonymous span, but when is a nested anonymous span ever created in the first place?

skynavga commented 5 years ago

The rules are ordered (and apply only once and in order); more generally, all enumerated lists are ordered lists (throughout the spec).

palemieux commented 5 years ago

Assuming that the rules are ordered, what is the objective of rule (3):

I think that the [construct anonymous spans] procedure would yield a document tree where anonymous spans are leaf nodes (containing only text) and spans are always branch nodes (linking to spans and anonymous spans).

skynavga commented 5 years ago

On Wed, Aug 14, 2019 at 11:18 PM Pierre-Anthony Lemieux < notifications@github.com> wrote:

Assuming that the rules are ordered, what is the objective of rule (3):

to eliminate redundant anonymous spans

  • it undoes part of rule 1

yes

  • it conflicts with the text at 8.1.6, which states that text nodes are effectively wrapped in anonymous spans: if a sequence of children of a span element consists solely of character information items, then that sequence must be considered to be an anonymous span for the purpose of applying style properties

8.1.6 refers to [construct anonymous spans] for the details, so there is no conflict as far as I can see; the language you cite is just a general summary of [construct anonymous spans] and we don't want it to repeat the details;

  • in what circumstances does one end up with nested anonymous spans in the first place?

you don't, which is the point of rule 3

I think that the [construct anonymous spans] procedure would yield a document tree where anonymous spans are leaf nodes (containing only text) and spans are always branch nodes (linking to spans and anonymous spans).

correct

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/w3c/ttml2/issues/1139?email_source=notifications&email_token=AAC4E33ZKKHFTDJC46MGNMDQEQO4VA5CNFSM4ILQ4NZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4JENFQ#issuecomment-521291414, or mute the thread https://github.com/notifications/unsubscribe-auth/AAC4E34LL5OUFA4LESAV3NTQEQO4VANCNFSM4ILQ4NZA .

palemieux commented 5 years ago

you don't, which is the point of rule 3

In what circumstances, would we have nested anonymous spans by the time we get to rule (3), since text nodes are never nested?

skynavga commented 5 years ago

There is no case where there is a nested anonymous span, before, during, or after running [construct anonymous spans].

Rule 3 is designed to eliminate the redundant anonymous span in the case that one would otherwise have

start SPAN start ANONYMOUS SPAN text a text b text ... text z end ANONYMOUS SPAN end SPAN

but rule 3 reduces this to

start SPAN text a text b text ... text z end SPAN

but does not reduce

start SPAN start ANONYMOUS SPAN text a text b text ... end ANONYMOUS SPAN start ANONYMOUS SPAN text z end ANONYMOUS SPAN end SPAN

so, rule 3 does indeed produce a non-anonymous span with only child text nodes

in this sense, you are correct to say that the summarizing language in 8.6.1 does not include this scenario; furthermore, this result would be an exception to your characterization

I think that the [construct anonymous spans] procedure would yield a document tree where anonymous spans are leaf nodes (containing only text) and spans are always branch nodes (linking to spans and anonymous spans).

it seems we have two options here:

1 leave the algorithm alone and tweak the summarizing language in 8.6.1

2 remove step (3) from the algorithm

i need to research whether option #2 will break anything in TTT or not; if we can convince ourselves that it doesn't break things (or any breakage is minor and fixable), then i would be open to option #2

On Wed, Aug 14, 2019 at 11:37 PM Pierre-Anthony Lemieux < notifications@github.com> wrote:

you don't, which is the point of rule 3

In what circumstances, would we have nested anonymous spans by the time we get to rule (3), since text nodes are never nested?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/w3c/ttml2/issues/1139?email_source=notifications&email_token=AAC4E3YUDIQQ46LKWMAZFNTQEQRC7A5CNFSM4ILQ4NZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4JGKDI#issuecomment-521299213, or mute the thread https://github.com/notifications/unsubscribe-auth/AAC4E35EYBFCCZ6KHXPDBBTQEQRC7ANCNFSM4ILQ4NZA .

palemieux commented 5 years ago

A key question in my mind is whether only anonymous spans can contain text nodes. I think the answer is yes. What is your opinion?

skynavga commented 5 years ago

@palemieux clearly, the third rule of [construct anonymous spans] invalidates this assumption, since it produces (non-anonymous) span elements that contain text node children;

palemieux commented 5 years ago

since it produces (non-anonymous) span elements that contain text node children;

As I recall all text nodes need to be wrapped in a span so that timing can be resolved, since there are no timing rules for text nodes.

To summarize:

if we start with

p
  text1
  text2
  span1
    text3
    span2
      text4
   /span2
  /span1
  text5
  span3
    text6
    text7
  /span3
/p

we want to end-up with:

p
  aspan1
    text1 + text2
  /aspan1
  span1
    aspan2
      text3
    /aspan2
    span2
      text4
    /span2
  /span1
  aspan3
    text5
  /aspan3
  span3
    text6 + text7
  /span3
/p

EDIT: div changed to p.

skynavga commented 5 years ago

Agreed. That is the result you get from [construct anonymous spans] using the current set of 3 rules as specified. Note that text4 is not wrapped in an anonymous span due to rule 3. But every text node is wrapped in a span (either anonymous or not). Do you concur?

skynavga commented 5 years ago

@palemieux what is your current position regarding rule 3? are you satisfied with leaving it in place (meaning some text nodes are wrapped by non-anonymous spans)? if so, then please close this issue; otherwise, propose what change you wish to see...

palemieux commented 5 years ago

@skynavga It sounds like there is consensus on the expected end result: https://github.com/w3c/ttml2/issues/1139#issuecomment-522092354 .

If so, I think the following tweaks should be considered:

nigelmegitt commented 5 years ago

https://github.com/w3c/ttml2/issues/1139#issuecomment-522092354 suggests that text nodes can be children of divs, but this is prohibited by the content model. I'm not sure what difference this makes to the usefulness of the example and whether or not it remains valid, but it threw me somewhat when trying to understand it.

palemieux commented 5 years ago

suggests that text nodes can be children of divs, but this is prohibited by the content mode

Ah. I meant p. Will fix.

EDIT: copy-paste error.

nigelmegitt commented 5 years ago

@palemieux copy/paste error in the quote in https://github.com/w3c/ttml2/issues/1139#issuecomment-527613745 ?