Skip to content

Commit

Permalink
Bugfix: allow multiple headings per chapters in outline
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan van der Gaag authored and Arjan van der Gaag committed Apr 21, 2012
1 parent 797ab5f commit 3c8a87a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions lib/rpub/epub/html_toc.rb
Expand Up @@ -12,9 +12,11 @@ def render
xml.div :id => 'toc' do
xml.h1 'Table of Contents'
xml.div :class => 'toc' do
book.outline.each do |(filename, heading)|
xml.div :class => "level-#{heading.level}" do
xml.a heading.text, :href => [filename, heading.html_id].join('#')
book.outline.each do |(filename, headings)|
headings.each do |heading|
xml.div :class => "level-#{heading.level}" do
xml.a heading.text, :href => [filename, heading.html_id].join('#')
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/rpub/epub/html_toc_spec.rb
Expand Up @@ -13,7 +13,7 @@
end

context 'with heading in the outline' do
let(:outline) { [['foo.html', double('heading', :text => 'link', :html_id => 'bar', :level => 1)]] }
let(:outline) { [['foo.html', [double('heading', :text => 'link', :html_id => 'bar', :level => 1)]]] }
it { should have_xpath('/div/div/div[@class="level-1"]/a[@href="foo.html#bar"][text()="link"]') }
end
end

0 comments on commit 3c8a87a

Please sign in to comment.