Files
linux-kernel-module-cheat/asciidoctor/extract-header-ids
Ciro Santilli 六四事件 法轮功 c5b7a3dd9c asciidoctor/extract-header-ids: make work with definition lists
These were failing because the plugin was copied from an outdated documentation
and definition lists don't have the .context method:
https://github.com/asciidoctor/asciidoctor/issues/3363
2019-07-24 00:00:00 +00:00

25 lines
515 B
Ruby
Executable File

#!/usr/bin/env ruby
# https://cirosantilli.com/linux-kernel-module-cheat#asciidoctor-extract-header-ids
require 'asciidoctor'
require 'asciidoctor/extensions'
class Main < Asciidoctor::Extensions::TreeProcessor
def process document
return unless document.blocks?
(document.find_by context: :section).each do |section|
if section.id
puts section.id
end
end
nil
end
end
Asciidoctor::Extensions.register do
treeprocessor Main
end
(Asciidoctor.load_file(ARGV[0])).convert