Skip to content

Commit

Permalink
[cgiowt] (0) Make the outline algorithm handle implied headings bette…
Browse files Browse the repository at this point in the history
…r. Really this should just be rewritten to be clearer...

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=15670
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7241 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Aug 10, 2012
1 parent 7453af6 commit 0cb06ab
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 27 deletions.
31 changes: 22 additions & 9 deletions complete.html
Expand Up @@ -246,7 +246,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 9 August 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 10 August 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -19167,6 +19167,10 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

<dd>

<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>

<p>Let <var title="">current section</var> be the last section
Expand All @@ -19188,7 +19192,11 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

<p>Run these steps:</p>

<ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</li>
<ol><li><p>If the <var title="">current section</var> has no
heading, create an implied heading and let that be the heading
for the <var title="">current section</var>.</li>

<li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</li>

<li><p>Let <var title="">current section</var> be the last
section in the <a href=#outline>outline</a> of the <var title="">current
Expand Down Expand Up @@ -19218,9 +19226,9 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>
at the root of the subtree for which an outline is being
generated.</p>

<p>Let <var title="">current section</var> be the first <a href=#concept-section title=concept-section>section</a> in the
<a href=#outline>outline</a> of the <var title="">current outlinee</var>
element.</p>
<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Skip to the next step in the overall set of steps. (The walk
is over.)</p>
Expand All @@ -19237,7 +19245,9 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

<p>Otherwise, if the element being entered has a
<a href=#rank>rank</a> equal to or greater than the heading of the
last section of the <a href=#outline>outline</a> of the <var title="">current outlinee</var>, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
last section of the <a href=#outline>outline</a> of the <var title="">current outlinee</var>, or if the heading of the last
section of the <a href=#outline>outline</a> of the <var title="">current
outlinee</var> is an implied heading, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
<a href=#outline>outline</a> of the <var title="">current outlinee</var>
element, so that this new section is the new last section of
that outline. Let <var title="">current section</var> be that
Expand All @@ -19248,8 +19258,11 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

<ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</li>

<li><p>If the element being entered has a <a href=#rank>rank</a>
lower than the <a href=#rank>rank</a> of the heading of the <var title="">candidate section</var>, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
<li><p><i>Heading loop</i>: If the element being entered has a
<a href=#rank>rank</a> lower than the <a href=#rank>rank</a> of the
heading of the <var title="">candidate section</var><!-- the
first time through, it won't be, but maybe on a subsequent pass
it is -->, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>

Expand All @@ -19259,7 +19272,7 @@ <h5 id=outlines><span class=secno>4.4.11.1 </span>Creating an outline</h5>

<li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</li>

<li><p>Return to step 2.</li>
<li><p>Return to the step labeled <i>heading loop</i>.</li>

</ol><p>Push the element being entered onto the stack. (This causes
the algorithm to skip any descendants of the element.)</p>
Expand Down
31 changes: 22 additions & 9 deletions index
Expand Up @@ -246,7 +246,7 @@

<header class=head id=head><p><a class=logo href=http://www.whatwg.org/><img alt=WHATWG height=101 src=/images/logo width=101></a></p>
<hgroup><h1 class=allcaps>HTML</h1>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 9 August 2012</h2>
<h2 class="no-num no-toc">Living Standard &mdash; Last Updated 10 August 2012</h2>
</hgroup><dl><dt><strong>Web developer edition:</strong></dt>
<dd><strong><a href=http://developers.whatwg.org/>http://developers.whatwg.org/</a></strong></dd>
<dt>Multiple-page version:</dt>
Expand Down Expand Up @@ -19167,6 +19167,10 @@ Space is not the only void</pre>

<dd>

<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</p>

<p>Let <var title="">current section</var> be the last section
Expand All @@ -19188,7 +19192,11 @@ Space is not the only void</pre>

<p>Run these steps:</p>

<ol><li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</li>
<ol><li><p>If the <var title="">current section</var> has no
heading, create an implied heading and let that be the heading
for the <var title="">current section</var>.</li>

<li><p>Pop the top element from the stack, and let the <var title="">current outlinee</var> be that element.</li>

<li><p>Let <var title="">current section</var> be the last
section in the <a href=#outline>outline</a> of the <var title="">current
Expand Down Expand Up @@ -19218,9 +19226,9 @@ Space is not the only void</pre>
at the root of the subtree for which an outline is being
generated.</p>

<p>Let <var title="">current section</var> be the first <a href=#concept-section title=concept-section>section</a> in the
<a href=#outline>outline</a> of the <var title="">current outlinee</var>
element.</p>
<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Skip to the next step in the overall set of steps. (The walk
is over.)</p>
Expand All @@ -19237,7 +19245,9 @@ Space is not the only void</pre>

<p>Otherwise, if the element being entered has a
<a href=#rank>rank</a> equal to or greater than the heading of the
last section of the <a href=#outline>outline</a> of the <var title="">current outlinee</var>, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
last section of the <a href=#outline>outline</a> of the <var title="">current outlinee</var>, or if the heading of the last
section of the <a href=#outline>outline</a> of the <var title="">current
outlinee</var> is an implied heading, then create a new <a href=#concept-section title=concept-section>section</a> and append it to the
<a href=#outline>outline</a> of the <var title="">current outlinee</var>
element, so that this new section is the new last section of
that outline. Let <var title="">current section</var> be that
Expand All @@ -19248,8 +19258,11 @@ Space is not the only void</pre>

<ol><li><p>Let <var title="">candidate section</var> be <var title="">current section</var>.</li>

<li><p>If the element being entered has a <a href=#rank>rank</a>
lower than the <a href=#rank>rank</a> of the heading of the <var title="">candidate section</var>, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
<li><p><i>Heading loop</i>: If the element being entered has a
<a href=#rank>rank</a> lower than the <a href=#rank>rank</a> of the
heading of the <var title="">candidate section</var><!-- the
first time through, it won't be, but maybe on a subsequent pass
it is -->, then create a new <a href=#concept-section title=concept-section>section</a>, and append it to <var title="">candidate section</var>. (This does not change which
section is the last section in the outline.) Let <var title="">current section</var> be this new section. Let the
element being entered be the new heading for the <var title="">current section</var>. Abort these substeps.</p>

Expand All @@ -19259,7 +19272,7 @@ Space is not the only void</pre>

<li><p>Let <var title="">candidate section</var> be <var title="">new candidate section</var>.</li>

<li><p>Return to step 2.</li>
<li><p>Return to the step labeled <i>heading loop</i>.</li>

</ol><p>Push the element being entered onto the stack. (This causes
the algorithm to skip any descendants of the element.)</p>
Expand Down
29 changes: 20 additions & 9 deletions source
Expand Up @@ -20535,6 +20535,10 @@ Space is not the only void</pre>

<dd>

<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Pop the top element from the stack, and let the <var
title="">current outlinee</var> be that element.</p>

Expand All @@ -20559,6 +20563,10 @@ Space is not the only void</pre>

<ol>

<li><p>If the <var title="">current section</var> has no
heading, create an implied heading and let that be the heading
for the <var title="">current section</var>.</p></li>

<li><p>Pop the top element from the stack, and let the <var
title="">current outlinee</var> be that element.</p></li>

Expand Down Expand Up @@ -20593,10 +20601,9 @@ Space is not the only void</pre>
at the root of the subtree for which an outline is being
generated.</p>

<p>Let <var title="">current section</var> be the first <span
title="concept-section">section</span> in the
<span>outline</span> of the <var title="">current outlinee</var>
element.</p>
<p>If the <var title="">current section</var> has no heading,
create an implied heading and let that be the heading for the
<var title="">current section</var>.</p>

<p>Skip to the next step in the overall set of steps. (The walk
is over.)</p>
Expand All @@ -20615,7 +20622,9 @@ Space is not the only void</pre>
<p>Otherwise, if the element being entered has a
<span>rank</span> equal to or greater than the heading of the
last section of the <span>outline</span> of the <var
title="">current outlinee</var>, then create a new <span
title="">current outlinee</var>, or if the heading of the last
section of the <span>outline</span> of the <var title="">current
outlinee</var> is an implied heading, then create a new <span
title="concept-section">section</span> and append it to the
<span>outline</span> of the <var title="">current outlinee</var>
element, so that this new section is the new last section of
Expand All @@ -20630,9 +20639,11 @@ Space is not the only void</pre>
<li><p>Let <var title="">candidate section</var> be <var
title="">current section</var>.</p></li>

<li><p>If the element being entered has a <span>rank</span>
lower than the <span>rank</span> of the heading of the <var
title="">candidate section</var>, then create a new <span
<li><p><i>Heading loop</i>: If the element being entered has a
<span>rank</span> lower than the <span>rank</span> of the
heading of the <var title="">candidate section</var><!-- the
first time through, it won't be, but maybe on a subsequent pass
it is -->, then create a new <span
title="concept-section">section</span>, and append it to <var
title="">candidate section</var>. (This does not change which
section is the last section in the outline.) Let <var
Expand All @@ -20648,7 +20659,7 @@ Space is not the only void</pre>
<li><p>Let <var title="">candidate section</var> be <var
title="">new candidate section</var>.</p></li>

<li><p>Return to step 2.</p></li>
<li><p>Return to the step labeled <i>heading loop</i>.</p></li>

</ol>

Expand Down

0 comments on commit 0cb06ab

Please sign in to comment.