Skip to content

Commit

Permalink
Merge pull request #779 from kmuto/part_index
Browse files Browse the repository at this point in the history
部ファイル内の見出しや図表リストの接頭字に部番号を使用
  • Loading branch information
kmuto authored May 10, 2017
2 parents f1470a3 + 085f7c7 commit 2825731
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/review/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,11 @@ def parse_metric(type, metric)

def get_chap(chapter = @chapter)
if @book.config["secnolevel"] > 0 && !chapter.number.nil? && !chapter.number.to_s.empty?
return chapter.format_number(nil)
if chapter.is_a? ReVIEW::Book::Part
return I18n.t('part_short', chapter.number)
else
return chapter.format_number(nil)
end
end
return nil
end
Expand Down
8 changes: 7 additions & 1 deletion lib/review/sec_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ def prefix(level, secnolevel)
end
end
elsif secnolevel >= level
prefix = @chapter.format_number(false)
prefix = ''
if @chapter.is_a? ReVIEW::Book::Part
prefix = I18n.t('part_short', @chapter.number)
else
prefix = @chapter.format_number(false)
end

0.upto(level - 2) do |i|
prefix << ".#{@counter[i]}"
end
Expand Down

0 comments on commit 2825731

Please sign in to comment.