Module: Coradoc::IncludeSelectors::Indent

Defined in:
lib/coradoc/include_selectors/indent.rb

Overview

Indent normalization. Two modes per asciidoctor:

indent=0   strip all leading whitespace from every line
indent=N   normalize leading whitespace to exactly N spaces
nil        pass through unchanged

Class Method Summary collapse

Class Method Details

.call(text, options:) ⇒ String

Parameters:

Returns:

  • (String)


14
15
16
17
18
19
20
21
22
# File 'lib/coradoc/include_selectors/indent.rb', line 14

def self.call(text, options:)
  return text if options.indent.nil?

  if options.indent.zero?
    strip_all(text)
  else
    reindent(text, options.indent)
  end
end