mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
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
25 lines
515 B
Ruby
Executable File
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
|