Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This allows supplemental material to have a TOC #823

Merged
merged 1 commit into from
Sep 7, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/showoff.rb
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,14 @@ def process_content_for_all_slides(content, num_slides, opts={})
if opts[:toc]
toc = Nokogiri::HTML::DocumentFragment.parse("<p id=\"toc\"></p>")

doc.css('div.subsection > h1:not(.section_title)').each do |section|
case opts[:toc]
when :all
titles = doc.css('div.slide:not(.toc) > div.content:not(.cover) > h1:not(.section_title)')
else
titles = doc.css('div.subsection > h1:not(.section_title)')
end

titles.each do |section|
href = section.parent.parent['id']
frag = "<div class=\"tocentry\"><a href=\"##{href}\">#{section.content}</a></div>"
link = Nokogiri::HTML::DocumentFragment.parse(frag)
Expand Down Expand Up @@ -1293,7 +1300,7 @@ def print(section=nil)

def supplemental(content, static=false)
# supplemental material is by definition separate from the presentation, so it doesn't make sense to attach notes
@slides = get_slides_html(:static=>static, :supplemental=>content, :section=>false)
@slides = get_slides_html(:static=>static, :supplemental=>content, :section=>false, :toc=>:all)
@favicon = settings.showoff_config['favicon']
@wrapper_classes = ['supplemental']
erb :onepage
Expand Down