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
This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-07-24 00:00:00 +00:00
parent 9252f53180
commit c5b7a3dd9c
2 changed files with 6 additions and 9 deletions

View File

@@ -8,17 +8,12 @@ require 'asciidoctor/extensions'
class Main < Asciidoctor::Extensions::TreeProcessor
def process document
return unless document.blocks?
process_blocks document
nil
end
def process_blocks node
node.blocks.each_with_index do |block, i|
if block.context == :section
puts block.id
(document.find_by context: :section).each do |section|
if section.id
puts section.id
end
process_blocks block if block.blocks?
end
nil
end
end