Skip to content

Commit

Permalink
[giow] (0) Captions - Stage 11.7: Parsing WebSRT timestamps.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.whatwg.org/webapps@5115 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 29, 2010
1 parent 2305aa4 commit 0c64cda
Show file tree
Hide file tree
Showing 3 changed files with 343 additions and 26 deletions.
113 changes: 104 additions & 9 deletions complete.html
Expand Up @@ -209,7 +209,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<hgroup><h1>Web Applications 1.0</h1>
<h2 class="no-num no-toc">Draft Standard &mdash; 28 June 2010</h2>
<h2 class="no-num no-toc">Draft Standard &mdash; 29 June 2010</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Expand Down Expand Up @@ -26762,8 +26762,7 @@ <h6 id=syntax-0><span class=secno>4.8.10.11.1 </span>Syntax</h6>
character (,).</li>

<li>Three characters in the range U+0030 DIGIT ZERO (0) to U+0039
DIGIT NINE (9), representing the thousandths of a second <var title="">seconds-frac</var> as a base ten integer, in the range
0&nbsp;&le;&nbsp;<var title="">second-frac</var>&nbsp;&lt;&nbsp;1000.</li>
DIGIT NINE (9), representing the thousandths of a second <var title="">seconds-frac</var> as a base ten integer.</li>

</ol><p>The <dfn id=websrt-cue-settings>WebSRT cue settings</dfn> part of a <a href=#websrt-cue>WebSRT
cue</a> consists of zero or more of the following components, in
Expand Down Expand Up @@ -26965,7 +26964,7 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<li><p><i>Bad cue</i>: Discard <var title="">cue</var>.</li>

<li><p><i>Bad cue loop</i>: <p>If <var title="">position</var> is
<li><p><i>Bad cue loop</i>: If <var title="">position</var> is
past the end of <var title="">input</var>, then jump to the step
labeled <i>end</i>.</li>

Expand Down Expand Up @@ -27019,17 +27018,17 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character (-)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character (-)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+003E GREATER-THAN SIGN character (&gt;)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
Expand Down Expand Up @@ -27250,9 +27249,105 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<li><p>Jump back to the step labeled <i>settings</i>.</li>

</ol><p class=XXX><dfn id=collect-a-websrt-timestamp>Collect a WebSRT timestamp</dfn>...</p>
</ol><p>When the steps above say that a user agent is to <dfn id=collect-a-websrt-timestamp>collect a
WebSRT timestamp</dfn>, the user agent must run the following
steps:</p>

</div>
<ol><li><p>Let <var title="">input</var> and <var title="">position</var> be the same variables as those of the same
name in the algorithm that invoked these steps.</li>

<li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error and abort these
steps.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two characters
in length, return an error and abort these steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>1</sub></var> be that
integer.</li>

<li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character (:), then
return an error and abort these steps. Otherwise, move <var title="">position</var> forwards one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two characters
in length, return an error and abort these steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>2</sub></var> be that
integer.</li>

<li>

<p>If <var title="">value<sub>1</sub></var> is greater than 59, or
if <var title="">position</var> is not beyond the end of <var title="">input</var> and the character at <var title="">position</var> is not a U+003A COLON character (:), run
these substeps:</p>

<ol><li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character (:), then
return an error and abort these steps. Otherwise, move <var title="">position</var> forwards one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two
characters in length, return an error and abort these
steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>3</sub></var> be that
integer.</li>

</ol><p>Otherwise (if <var title="">value<sub>1</sub></var> is less
than or equal to 59 and <var title="">position</var> is not beyond
the end of <var title="">input</var> and the character at <var title="">position</var> is not a U+003A COLON character (:)), let
<var title="">value<sub>3</sub></var> have the value of <var title="">value<sub>2</sub></var>, then <var title="">value<sub>2</sub></var> have the value of <var title="">value<sub>1</sub></var>, then let <var title="">value<sub>1</sub></var> equal zero.</p>

</li>

<li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not either a U+002C COMMA character (,)
or a U+002E FULL STOP character (.), then return an error and abort
these steps. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly three
characters in length, return an error and abort these
steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>4</sub></var> be that
integer.</li>

<li><p>Let <var title="">result</var> be <span title=""><var title="">value<sub>1</sub></var>&times;60&times;60 + <var title="">value<sub>2</sub></var>&times;60 + <var title="">value<sub>3</sub></var> + <var title="">value<sub>4</sub></var>&#8725;1000</span>. <!-- &#x00f7;
is the division sign if people prefer that to the slash
--></li>

<li><p>Return <var title="">result</var>.</li>

</ol></div>

<!--TT-->

Expand Down
113 changes: 104 additions & 9 deletions index
Expand Up @@ -213,7 +213,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<hgroup><h1>HTML5 (including next generation additions still in development)</h1>
<h2 class="no-num no-toc">Draft Standard &mdash; 28 June 2010</h2>
<h2 class="no-num no-toc">Draft Standard &mdash; 29 June 2010</h2>
</hgroup><p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Expand Down Expand Up @@ -26695,8 +26695,7 @@ CueEvent
character (,).</li>

<li>Three characters in the range U+0030 DIGIT ZERO (0) to U+0039
DIGIT NINE (9), representing the thousandths of a second <var title="">seconds-frac</var> as a base ten integer, in the range
0&nbsp;&le;&nbsp;<var title="">second-frac</var>&nbsp;&lt;&nbsp;1000.</li>
DIGIT NINE (9), representing the thousandths of a second <var title="">seconds-frac</var> as a base ten integer.</li>

</ol><p>The <dfn id=websrt-cue-settings>WebSRT cue settings</dfn> part of a <a href=#websrt-cue>WebSRT
cue</a> consists of zero or more of the following components, in
Expand Down Expand Up @@ -26898,7 +26897,7 @@ CueEvent

<li><p><i>Bad cue</i>: Discard <var title="">cue</var>.</li>

<li><p><i>Bad cue loop</i>: <p>If <var title="">position</var> is
<li><p><i>Bad cue loop</i>: If <var title="">position</var> is
past the end of <var title="">input</var>, then jump to the step
labeled <i>end</i>.</li>

Expand Down Expand Up @@ -26952,17 +26951,17 @@ CueEvent

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character (-)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+002D HYPHEN-MINUS character (-)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If <!--<var title="">position</var> is beyond the end of
<var title="">input</var> or if--> the character at <var title="">position</var> is not a U+003E GREATER-THAN SIGN character (&gt;)
then fail. Otherwise, move <var title="">position</var> forwards
then abort these steps and return failure. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p><a href=#skip-whitespace>Skip whitespace</a>.</li>
Expand Down Expand Up @@ -27183,9 +27182,105 @@ CueEvent

<li><p>Jump back to the step labeled <i>settings</i>.</li>

</ol><p class=XXX><dfn id=collect-a-websrt-timestamp>Collect a WebSRT timestamp</dfn>...</p>
</ol><p>When the steps above say that a user agent is to <dfn id=collect-a-websrt-timestamp>collect a
WebSRT timestamp</dfn>, the user agent must run the following
steps:</p>

</div>
<ol><li><p>Let <var title="">input</var> and <var title="">position</var> be the same variables as those of the same
name in the algorithm that invoked these steps.</li>

<li><p>If <var title="">position</var> is past the end of <var title="">input</var>, return an error and abort these
steps.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two characters
in length, return an error and abort these steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>1</sub></var> be that
integer.</li>

<li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character (:), then
return an error and abort these steps. Otherwise, move <var title="">position</var> forwards one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two characters
in length, return an error and abort these steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>2</sub></var> be that
integer.</li>

<li>

<p>If <var title="">value<sub>1</sub></var> is greater than 59, or
if <var title="">position</var> is not beyond the end of <var title="">input</var> and the character at <var title="">position</var> is not a U+003A COLON character (:), run
these substeps:</p>

<ol><li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not a U+003A COLON character (:), then
return an error and abort these steps. Otherwise, move <var title="">position</var> forwards one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly two
characters in length, return an error and abort these
steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>3</sub></var> be that
integer.</li>

</ol><p>Otherwise (if <var title="">value<sub>1</sub></var> is less
than or equal to 59 and <var title="">position</var> is not beyond
the end of <var title="">input</var> and the character at <var title="">position</var> is not a U+003A COLON character (:)), let
<var title="">value<sub>3</sub></var> have the value of <var title="">value<sub>2</sub></var>, then <var title="">value<sub>2</sub></var> have the value of <var title="">value<sub>1</sub></var>, then let <var title="">value<sub>1</sub></var> equal zero.</p>

</li>

<li><p>If <var title="">position</var> is beyond the end of <var title="">input</var> or if the character at <var title="">position</var> is not either a U+002C COMMA character (,)
or a U+002E FULL STOP character (.), then return an error and abort
these steps. Otherwise, move <var title="">position</var> forwards
one character.</li>

<li><p>If the character indicated by <var title="">position</var>
is not one of U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then
return an error and abort these steps.</li>

<li><p><a href=#collect-a-sequence-of-characters>Collect a sequence of characters</a> in the range
U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and let <var title="">string</var> be the collected substring.</li>

<li><p>If <var title="">string</var> is not exactly three
characters in length, return an error and abort these
steps.</li>

<li><p>Interpret <var title="">string</var> as a base-ten
integer. Let <var title="">value<sub>4</sub></var> be that
integer.</li>

<li><p>Let <var title="">result</var> be <span title=""><var title="">value<sub>1</sub></var>&times;60&times;60 + <var title="">value<sub>2</sub></var>&times;60 + <var title="">value<sub>3</sub></var> + <var title="">value<sub>4</sub></var>&#8725;1000</span>. <!-- &#x00f7;
is the division sign if people prefer that to the slash
--></li>

<li><p>Return <var title="">result</var>.</li>

</ol></div>

<!--TT-->

Expand Down

0 comments on commit 0c64cda

Please sign in to comment.