Skip to content

Commit

Permalink
[giowt] (0) Make the WebVTT parser a bit more forgiving: data suggest…
Browse files Browse the repository at this point in the history
…s that we should always start a cue if we hit a line that contains the magic string -->.

Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=14550

git-svn-id: http://svn.whatwg.org/webapps@6758 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Oct 25, 2011
1 parent 4320eb4 commit cbe7e54
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 28 deletions.
42 changes: 33 additions & 9 deletions complete.html
Expand Up @@ -33102,6 +33102,10 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
is a U+FEFF BYTE ORDER MARK (BOM) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>


<li>Let <var title="">line</var> be a string variable. Unset the
<var title="">already collected line</var> flag.</li>


<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>

Expand Down Expand Up @@ -33138,15 +33142,22 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
<li><p>If the character indicated by <var title="">position</var>
is a U+000A LINE FEED (LF) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</li>

<!-- In v2, this is where we can put header metadata processing -->

<li><p>If <var title="">line</var> is not the empty string, then
jump back to the step labeled <i title="">header</i>.</li>


<li><p><i>Cue loop</i>: <a href=#collect-a-sequence-of-characters>Collect a sequence of
characters</a> that are U+000A LINE FEED (LF)
characters.</li>
<li><p><i>Cue loop</i>: If the <var title="">already collected
line</var> flag is set, then jump to the step labeled <var title="">cue creation</var>.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
U+000A LINE FEED (LF) characters.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>
Expand All @@ -33157,9 +33168,8 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
a newline, so we have none of that either, meaning we have nothing.
-->.)</li>

<li><p>Let <var title="">cue</var> be a new <a href=#text-track-cue>text track
cue</a> associated with <var title="">output</var>'s <a href=#text-track>text
track</a>.</li>
<li><p><i>Cue creation</i>: Let <var title="">cue</var> be a new
<a href=#text-track-cue>text track cue</a> associated with <var title="">output</var>'s <a href=#text-track>text track</a>.</li>

<li><p>Let <var title="">cue</var>'s <a href=#text-track-cue-identifier>text track cue
identifier</a> be the empty string.</li>
Expand Down Expand Up @@ -33212,9 +33222,13 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
discard <var title="">cue</var> and jump to the step labeled <i>cue
loop</i>.</li>

<li><p><i>Timings</i>: <a href=#collect-webvtt-cue-timings-and-settings>Collect WebVTT cue timings and
settings</a> from <var title="">line</var>, using <var title="">cue</var> for the results. If that fails, jump to the step
labeled <i>bad cue</i>.</li>
<li><p><i>Timings</i>: Unset the <var title="">already collected
line</var> flag.</li>

<li><p><a href=#collect-webvtt-cue-timings-and-settings>Collect WebVTT cue timings and settings</a> from
<var title="">line</var>, using <var title="">cue</var> for the
results. If that fails, jump to the step labeled <i>bad
cue</i>.</li>

<li><p>Let <var title="">cue text</var> be the empty
string.</li>
Expand All @@ -33232,6 +33246,11 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue text processing</i>.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue text processing</i>.</li>

<li><p>If <var title="">cue text</var> is not empty, append a
U+000A LINE FEED (LF) character to <var title="">cue
text</var>.</li>
Expand Down Expand Up @@ -33266,6 +33285,11 @@ <h6 id=parsing-0><span class=secno>4.8.10.13.3 </span>Parsing</h6>
<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</li>

<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue loop</i>.</li>

Expand Down
42 changes: 33 additions & 9 deletions index
Expand Up @@ -33102,6 +33102,10 @@ The General Relativistic Field Equations</pre>
is a U+FEFF BYTE ORDER MARK (BOM) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>


<li>Let <var title="">line</var> be a string variable. Unset the
<var title="">already collected line</var> flag.</li>


<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>

Expand Down Expand Up @@ -33138,15 +33142,22 @@ The General Relativistic Field Equations</pre>
<li><p>If the character indicated by <var title="">position</var>
is a U+000A LINE FEED (LF) character, advance <var title="">position</var> to the next character in <var title="">input</var>.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</li>

<!-- In v2, this is where we can put header metadata processing -->

<li><p>If <var title="">line</var> is not the empty string, then
jump back to the step labeled <i title="">header</i>.</li>


<li><p><i>Cue loop</i>: <a href=#collect-a-sequence-of-characters>Collect a sequence of
characters</a> that are U+000A LINE FEED (LF)
characters.</li>
<li><p><i>Cue loop</i>: If the <var title="">already collected
line</var> flag is set, then jump to the step labeled <var title="">cue creation</var>.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
U+000A LINE FEED (LF) characters.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>
Expand All @@ -33157,9 +33168,8 @@ The General Relativistic Field Equations</pre>
a newline, so we have none of that either, meaning we have nothing.
-->.)</li>

<li><p>Let <var title="">cue</var> be a new <a href=#text-track-cue>text track
cue</a> associated with <var title="">output</var>'s <a href=#text-track>text
track</a>.</li>
<li><p><i>Cue creation</i>: Let <var title="">cue</var> be a new
<a href=#text-track-cue>text track cue</a> associated with <var title="">output</var>'s <a href=#text-track>text track</a>.</li>

<li><p>Let <var title="">cue</var>'s <a href=#text-track-cue-identifier>text track cue
identifier</a> be the empty string.</li>
Expand Down Expand Up @@ -33212,9 +33222,13 @@ The General Relativistic Field Equations</pre>
discard <var title="">cue</var> and jump to the step labeled <i>cue
loop</i>.</li>

<li><p><i>Timings</i>: <a href=#collect-webvtt-cue-timings-and-settings>Collect WebVTT cue timings and
settings</a> from <var title="">line</var>, using <var title="">cue</var> for the results. If that fails, jump to the step
labeled <i>bad cue</i>.</li>
<li><p><i>Timings</i>: Unset the <var title="">already collected
line</var> flag.</li>

<li><p><a href=#collect-webvtt-cue-timings-and-settings>Collect WebVTT cue timings and settings</a> from
<var title="">line</var>, using <var title="">cue</var> for the
results. If that fails, jump to the step labeled <i>bad
cue</i>.</li>

<li><p>Let <var title="">cue text</var> be the empty
string.</li>
Expand All @@ -33232,6 +33246,11 @@ The General Relativistic Field Equations</pre>
<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue text processing</i>.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue text processing</i>.</li>

<li><p>If <var title="">cue text</var> is not empty, append a
U+000A LINE FEED (LF) character to <var title="">cue
text</var>.</li>
Expand Down Expand Up @@ -33266,6 +33285,11 @@ The General Relativistic Field Equations</pre>
<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var title="">line</var> be those characters, if any.</li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--&gt;</code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</li>

<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue loop</i>.</li>

Expand Down
48 changes: 38 additions & 10 deletions source
Expand Up @@ -36232,6 +36232,10 @@ The General Relativistic Field Equations</pre>
title="">input</var>.</p></li>


<li>Let <var title="">line</var> be a string variable. Unset the
<var title="">already collected line</var> flag.</li>


<li><p><span>Collect a sequence of characters</span> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var
title="">line</var> be those characters, if any.</p></li>
Expand Down Expand Up @@ -36276,15 +36280,24 @@ The General Relativistic Field Equations</pre>
title="">position</var> to the next character in <var
title="">input</var>.</p></li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var
title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</p></li>

<!-- In v2, this is where we can put header metadata processing -->

<li><p>If <var title="">line</var> is not the empty string, then
jump back to the step labeled <i title="">header</i>.</p></li>


<li><p><i>Cue loop</i>: <span>Collect a sequence of
characters</span> that are U+000A LINE FEED (LF)
characters.</p></li>
<li><p><i>Cue loop</i>: If the <var title="">already collected
line</var> flag is set, then jump to the step labeled <var
title="">cue creation</var>.</p></li>

<li><p><span>Collect a sequence of characters</span> that are
U+000A LINE FEED (LF) characters.</p></li>

<li><p><span>Collect a sequence of characters</span> that are
<em>not</em> U+000A LINE FEED (LF) characters. Let <var
Expand All @@ -36298,9 +36311,9 @@ The General Relativistic Field Equations</pre>
a newline, so we have none of that either, meaning we have nothing.
-->.)</p></li>

<li><p>Let <var title="">cue</var> be a new <span>text track
cue</span> associated with <var title="">output</var>'s <span>text
track</span>.</p></li>
<li><p><i>Cue creation</i>: Let <var title="">cue</var> be a new
<span>text track cue</span> associated with <var
title="">output</var>'s <span>text track</span>.</p></li>

<li><p>Let <var title="">cue</var>'s <span>text track cue
identifier</span> be the empty string.</p></li>
Expand Down Expand Up @@ -36357,10 +36370,13 @@ The General Relativistic Field Equations</pre>
discard <var title="">cue</var> and jump to the step labeled <i>cue
loop</i>.</p></li>

<li><p><i>Timings</i>: <span>Collect WebVTT cue timings and
settings</span> from <var title="">line</var>, using <var
title="">cue</var> for the results. If that fails, jump to the step
labeled <i>bad cue</i>.</p></li>
<li><p><i>Timings</i>: Unset the <var title="">already collected
line</var> flag.</p></li>

<li><p><span>Collect WebVTT cue timings and settings</span> from
<var title="">line</var>, using <var title="">cue</var> for the
results. If that fails, jump to the step labeled <i>bad
cue</i>.</p></li>

<li><p>Let <var title="">cue text</var> be the empty
string.</p></li>
Expand All @@ -36381,6 +36397,12 @@ The General Relativistic Field Equations</pre>
<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue text processing</i>.</p></li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var
title="">already collected line</var> flag and jump to the step
labeled <i>cue text processing</i>.</p></li>

<li><p>If <var title="">cue text</var> is not empty, append a
U+000A LINE FEED (LF) character to <var title="">cue
text</var>.</p></li>
Expand Down Expand Up @@ -36418,6 +36440,12 @@ The General Relativistic Field Equations</pre>
<em>not</em> U+000A LINE FEED (LF) characters. Let <var
title="">line</var> be those characters, if any.</p></li>

<li><p>If <var title="">line</var> contains the three-character
substring "<code title="">--></code>" (U+002D HYPHEN-MINUS, U+002D
HYPHEN-MINUS, U+003E GREATER-THAN SIGN), then set the <var
title="">already collected line</var> flag and jump to the step
labeled <i>cue loop</i>.</p></li>

<li><p>If <var title="">line</var> is the empty string, then jump
to the step labeled <i>cue loop</i>.</p></li>

Expand Down

0 comments on commit cbe7e54

Please sign in to comment.