class Asciidoctor::Extensions::Preprocessor

Public: Preprocessors are run after the source text is split into lines and before parsing begins.

Prior to invoking the preprocessor, Asciidoctor splits the source text into lines and normalizes them. The normalize process strips trailing whitespace from each line and leaves behind a line-feed character (i.e., ā€œnā€).

Asciidoctor passes a reference to the Reader and a copy of the lines Array to the process method of an instance of each registered Preprocessor. The Preprocessor modifies the Array as necessary and either returns a reference to the same Reader or a reference to a new one.

Preprocessors must extend Asciidoctor::Extensions::Preprocessor.

Public Instance Methods

process(reader, lines) click to toggle source

Public: Accepts the Reader and an Array of lines, modifies them as needed, then returns the Reader or a reference to a new one.

Each subclass of Preprocessor should override this method.

# File lib/asciidoctor/extensions.rb, line 303
def process reader, lines
  reader
end