Skip to content
Permalink
Browse files

[giowt] (0) Make the WebVTT parser a bit more forgiving: data suggest…

…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 cbe7e5456f22de39916876d8f60830697ffecd9c
Showing with 104 additions and 28 deletions.
  1. +33 −9 complete.html
  2. +33 −9 index
  3. +38 −10 source
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>

<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>
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>
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>
<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>
<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>

42 index
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>

<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>
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>
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>
<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>
<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>

48 source
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>
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
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>
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>
<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>
<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>

0 comments on commit cbe7e54

Please sign in to comment.
You can’t perform that action at this time.