Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[giowt] (0) Captions - Stage 14.2: Finish the spec for parsing text c…
…ues.

git-svn-id: http://svn.whatwg.org/webapps@5128 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jul 1, 2010
1 parent db91573 commit 3c949b6
Show file tree
Hide file tree
Showing 3 changed files with 421 additions and 72 deletions.
154 changes: 131 additions & 23 deletions complete.html
Expand Up @@ -27395,9 +27395,9 @@ <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>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>
</ol><p>When this specifications says 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>

<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>
Expand Down Expand Up @@ -27653,12 +27653,15 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<dl><dt><dfn id=websrt-text-object title="WebSRT Text Object">WebSRT Text Objects</dfn></dt>
<dd>
<p>A fragment of text.</p>
<p>A fragment of text. A <a href=#websrt-text-object>WebSRT Text Object</a> has a
value, which is the text it represents.</p>
</dd>

<dt><dfn id=websrt-timestamp-object title="WebSRT Timestamp Object">WebSRT Timestamp Objects</dfn></dt>
<dd>
<p>A timestamp.</p>
<p>A timestamp. A <a href=#websrt-timestamp-object>WebSRT Timestamp Object</a> has a
value, in seconds and fractions of a second, which is the time
represented by the timestamp.</p>
</dd>

</dl><p>To parse a string <var title="">input</var> supposedly containing
Expand All @@ -27675,15 +27678,125 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
<li><p>Let <var title="">result</var> be a <a href=#list-of-websrt-node-objects>List of WebSRT
Node Objects</a>, initially empty.</li>

<li><p><i>Loop</i>: If <var title="">position</var> is past the end of
<var title="">input</var>, return <var title="">result</var> and
<li><p>Let <var title="">current</var> be the <a href=#websrt-internal-node-object>WebSRT Internal
Node Object</a> <var title="">result</var>.</li>

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

<li><p>Let <var title="">token</var> be the result of invoking the
<a href=#websrt-cue-text-tokeniser>WebSRT cue text tokeniser</a>.</li>

<li><p>Invoke the <a href=#websrt-cue-text-tree-constructor>WebSRT cue text tree
constructor</a>.</li>
<li>

<p>Run the appropriate steps given the type of <var title="">token</var>:</p>

<dl><dt>If <var title="">token</var> is a string</dt>
<dd>

<ol><li><p>Create a <a href=#websrt-text-object>WebSRT Text Object</a> whose value is
the value of the string token <var title="">token</var>.</li>

<li><p>Append the newly created <a href=#websrt-text-object>WebSRT Text Object</a>
to <var title="">current</var>.</li>

</ol></dd>

<dt>If <var title="">token</var> is a start tag</dt>
<dd>

<p>How the start tag token <var title="">token</var> is
processed depends on its tag name, as follows:</p>

<dl><dt>If the tag name is the empty string</dt>
<dd>
<p>Ignore the token.</p>
</dd>

<dt>If the tag name is "<code title="">i</code>"</dt>
<dd>
<p>Create a <a href=#websrt-italic-object>WebSRT Italic Object</a>, and <a href=#attach-a-websrt-internal-node-object title="attach a WebSRT Internal Node Object">attach
it</a>.</p>
</dd>

<dt>If the tag name is "<code title="">b</code>"</dt>
<dd>
<p>Create a <a href=#websrt-bold-object>WebSRT Bold Object</a>, and <a href=#attach-a-websrt-internal-node-object title="attach a WebSRT Internal Node Object">attach
it</a>.</p>
</dd>

<dt>If the tag name is "<code title="">ruby</code>"</dt>
<dd>
<p>Create a <a href=#websrt-ruby-object>WebSRT Ruby Object</a>, and <a href=#attach-a-websrt-internal-node-object title="attach a WebSRT Internal Node Object">attach
it</a>.</p>
</dd>

<dt>If the tag name is "<code title="">rt</code>"</dt>
<dd>
<p>If <var title="">current</var> is a <a href=#websrt-ruby-object>WebSRT Ruby
Object</a>, then create a <a href=#websrt-ruby-text-object>WebSRT Ruby Text
Object</a>, and <a href=#attach-a-websrt-internal-node-object title="attach a WebSRT Internal Node
Object">attach it</a>.</p>
<p>Otherwise, ignore the token.</p>
</dd>

<dt>Otherwise</dt>
<dd>

<ol><li><p>Let <var title="">input</var> be the tag name.</li>

<li><p>Let <var title="">position</var> be a pointer into
<var title="">input</var>, initially pointing at the start of
the string.</li>

<li><p><a href=#collect-a-websrt-timestamp>Collect a WebSRT timestamp</a>.</li>

<li>

<p>If that algorithm does not fail, then create a
<a href=#websrt-timestamp-object>WebSRT Timestamp Object</a> whose value is the
collected time, then append it to <var title="">current</var>.</p>

<p>Otherwise, ignore the token.</p>

</li>

</ol></dd>

</dl><p>When the steps above say to <dfn id=attach-a-websrt-internal-node-object>attach a WebSRT Internal
Node Object</dfn> <var title="">node object</var>, the user
agent must append <var title="">node object</var> to <var title="">current</var>, then let <var title="">current</var> be
<var title="">node object</var>.</p>

</dd>

<dt>If <var title="">token</var> is an end tag</dt>
<dd>

<p>If any of the following conditions is true, then let <var title="">current</var> be the parent node of <var title="">current</var>.</p>

<ul class=brief><li>The tag name of the end tag token <var title="">token</var>
is "<code title="">i</code>" and <var title="">current</var> is
a <a href=#websrt-italic-object>WebSRT Italic Object</a>.</li>

<li>The tag name of the end tag token <var title="">token</var>
is "<code title="">b</code>" and <var title="">current</var> is
a <a href=#websrt-bold-object>WebSRT Bold Object</a>.</li>

<li>The tag name of the end tag token <var title="">token</var>
is "<code title="">ruby</code>" and <var title="">current</var> is
a <a href=#websrt-ruby-object>WebSRT Ruby Object</a>.</li>

<li>The tag name of the end tag token <var title="">token</var>
is "<code title="">rt</code>" and <var title="">current</var> is
a <a href=#websrt-ruby-text-object>WebSRT Ruby Text Object</a>.</li>

</ul><p>Otherwise, ignore the token.</p>

</dd>

</dl></li>

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

Expand Down Expand Up @@ -27742,7 +27855,7 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
<dt>Anything else</dt>
<dd>
<p>Append <var title="">c</var> to <var title="">result</var>
and jump to the step labeled <i>next</i>.</p>.
and jump to the step labeled <i>next</i>.</p>
</dd>

</dl></dd>
Expand Down Expand Up @@ -27802,20 +27915,20 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>

<p>Jump to the entry that matches the value of <var title="">c</var>:</p>

<dl><dt>U+003E GREATER-THAN SIGN character (&gt;)</dt>
<dt>End-of-file marker</dt>
<dd>
<p>Return a start tag whose tag name is the empty string and
abort these steps.</p>
</dd>

<dt>U+002F SOLIDUS character (/)</dt>
<dl><dt>U+002F SOLIDUS character (/)</dt>
<dd>
<p>Set <var title="">tokeniser state</var> to the <a href=#websrt-end-tag-state>WebSRT
end tag state</a>, and jump to the step labeled
<i>next</i>.</p>
</dd>

<dt>U+003E GREATER-THAN SIGN character (&gt;)</dt>
<dt>End-of-file marker</dt>
<dd>
<p>Return a start tag whose tag name is the empty string and
abort these steps.</p>
</dd>

<dt>Anything else</dt>
<dd>
<p>Set <var title="">result</var> to <var title="">c</var>,
Expand Down Expand Up @@ -27871,11 +27984,6 @@ <h6 id=parsing-0><span class=secno>4.8.10.11.2 </span>Parsing</h6>
<li><p><i>Next</i>: Advance <var title="">position</var> to the next
character in <var title="">input</var>.</li>

</ol><p>The <dfn id=websrt-cue-text-tree-constructor>WebSRT cue text tree constructor</dfn> is as
follows:</p>

<ol><li class=XXX>...</li>

</ol><h6 id=websrt-cue-text-dom-construction-rules><span class=secno>4.8.10.11.4 </span><dfn>WebSRT cue text DOM construction rules</dfn></h6>

<p class=XXX>...</p>
Expand Down

0 comments on commit 3c949b6

Please sign in to comment.