Permalink
Browse files

Bugfix: allow multiple headings per chapters in outline

  • Loading branch information...
avdgaag committed Apr 21, 2012
1 parent 797ab5f commit 3c8a87afa346572a478cc11737663b1d7808c6fd
Showing with 6 additions and 4 deletions.
  1. +5 −3 lib/rpub/epub/html_toc.rb
  2. +1 −1 spec/rpub/epub/html_toc_spec.rb
@@ -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
@@ -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.