Skip to content

Commit

Permalink
fix TOC generation for h2 h3 h2 heading sequence
Browse files Browse the repository at this point in the history
  • Loading branch information
sunaku committed May 28, 2015
1 parent a3080cc commit fd89685
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,9 @@ begin
# keep track of the heading to generate the table_of_contents() later on
heading = Heading.new(level, id, text, [], nil)
if parent = @headings.last
if parent.level == level
parent = parent.parent
end
if parent and parent.level < level
parent.children << heading
heading.parent = parent
end
parent = parent.parent while parent and parent.level >= level
parent.children << heading if parent
heading.parent = parent
end
@headings << heading

Expand Down

0 comments on commit fd89685

Please sign in to comment.