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)


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

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

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



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

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