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

nonumの見出しも目次に追加 #550

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion lib/review/htmlbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ def builder_init_file
@chapter.book.image_types = %w( .png .jpg .jpeg .gif .svg )
@column = 0
@sec_counter = SecCounter.new(5, @chapter)
@nonum_counter = 0
end
private :builder_init_file

Expand Down Expand Up @@ -194,10 +195,12 @@ def headline(level, label, caption)
end

def nonum_begin(level, label, caption)
@nonum_counter += 1
puts '' if level > 1
unless caption.empty?
if label.nil?
puts %Q[<h#{level}>#{compile_inline(caption)}</h#{level}>]
id = normalize_id("#{@chapter.name}_nonum#{@nonum_counter}")
puts %Q[<h#{level} id="#{id}">#{compile_inline(caption)}</h#{level}>]
else
puts %Q[<h#{level} id="#{normalize_id(label)}">#{compile_inline(caption)}</h#{level}>]
end
Expand Down
1 change: 1 addition & 0 deletions lib/review/latexbuilder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def headline(level, label, caption)
def nonum_begin(level, label, caption)
blank unless @output.pos == 0
puts macro(HEADLINE[level]+"*", compile_inline(caption))
puts macro('addcontentsline', 'toc', HEADLINE[level], compile_inline(caption))
end

def nonum_end(level)
Expand Down