Class: Metanorma::AsciidoctorExtensions::GlobIncludeProcessor

Inherits:
Asciidoctor::Extensions::IncludeProcessor
  • Object
show all
Defined in:
lib/metanorma/asciidoctor_extensions/glob_include_processor.rb

Instance Method Summary collapse

Instance Method Details

#handles?(target) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/metanorma/asciidoctor_extensions/glob_include_processor.rb', line 13

def handles?(target)
  target.include? "*"
end

#process(_doc, reader, target_glob, attributes) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/metanorma/asciidoctor_extensions/glob_include_processor.rb', line 4

def process(_doc, reader, target_glob, attributes)
  Dir[File.join reader.dir, target_glob].sort.reverse_each do |target|
    content = File.readlines target
    content.unshift "" unless attributes["adjoin-option"]
    reader.push_include content, target, target, 1, attributes
  end
  reader
end