989d921f5d
I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
16 lines
507 B
Ruby
16 lines
507 B
Ruby
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
|