user guide: fix single-page TOC links

This commit is contained in:
Josh Holtrop 2019-06-14 21:53:57 -04:00
parent 55a2ea6d6b
commit f97ee94e44

View File

@ -50,7 +50,7 @@ class Generator
if multi_page if multi_page
nil nil
else else
File.basename(output_file) File.basename(output_file).sub(/\.html$/, "")
end end
@sections = [] @sections = []
@current_section_number = [0] @current_section_number = [0]
@ -65,7 +65,7 @@ class Generator
new_page = !new_page_text.nil? new_page = !new_page_text.nil?
section_number = get_next_section_number(level) section_number = get_next_section_number(level)
anchor = make_anchor(section_number, title_text) anchor = make_anchor(section_number, title_text)
if new_page or current_page.nil? if multi_page and (new_page or current_page.nil?)
current_page = anchor current_page = anchor
end end
@sections << Section.new(section_number, title_text, current_page, anchor) @sections << Section.new(section_number, title_text, current_page, anchor)