mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-22 17:55:57 +01:00
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:
@@ -16445,6 +16445,8 @@ explicitly-given
|
|||||||
|
|
||||||
One application we have in mind for this is that as of 2.0.10 Asciidoctor does not warn on header ID collisions between auto-generated IDs: https://github.com/asciidoctor/asciidoctor/issues/3147 But this script doesn't solve that yet as it would require generating the section IDs without the `-N` suffix. Section generation happens at `Section.generate_id` in Asciidoctor code.
|
One application we have in mind for this is that as of 2.0.10 Asciidoctor does not warn on header ID collisions between auto-generated IDs: https://github.com/asciidoctor/asciidoctor/issues/3147 But this script doesn't solve that yet as it would require generating the section IDs without the `-N` suffix. Section generation happens at `Section.generate_id` in Asciidoctor code.
|
||||||
|
|
||||||
|
Hastily hacked from: https://asciidoctor.org/docs/user-manual/#https://asciidoctor.org/docs/user-manual/#tree-processor-example until I noticed that that example had a bug at the time and so fixed it here: https://github.com/asciidoctor/asciidoctor/issues/3363
|
||||||
|
|
||||||
[[asciidoctor-link-target-up-rb]]
|
[[asciidoctor-link-target-up-rb]]
|
||||||
=== asciidoctor/link-target-up.rb
|
=== asciidoctor/link-target-up.rb
|
||||||
|
|
||||||
|
|||||||
@@ -8,17 +8,12 @@ require 'asciidoctor/extensions'
|
|||||||
class Main < Asciidoctor::Extensions::TreeProcessor
|
class Main < Asciidoctor::Extensions::TreeProcessor
|
||||||
def process document
|
def process document
|
||||||
return unless document.blocks?
|
return unless document.blocks?
|
||||||
process_blocks document
|
(document.find_by context: :section).each do |section|
|
||||||
nil
|
if section.id
|
||||||
end
|
puts section.id
|
||||||
|
|
||||||
def process_blocks node
|
|
||||||
node.blocks.each_with_index do |block, i|
|
|
||||||
if block.context == :section
|
|
||||||
puts block.id
|
|
||||||
end
|
end
|
||||||
process_blocks block if block.blocks?
|
|
||||||
end
|
end
|
||||||
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user