blob: 34e5c91547dd9ca680be5ef7f76be6e3d8495f85 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal'
include Asciidoctor
Extensions.register do
treeprocessor do
process do |document|
if (document.attr? 'sectnumoffset') && (book = (document.attr 'book', false)) == false
sectnumoffset = (document.attr 'sectnumoffset', '0').to_s
document.find_by(context: :section) {|sect| sect.level == 1 }.each do |sect|
sect.numeral = sectnumoffset.to_s + '.' + sect.numeral.to_s
end
end
end
end
end
|