class

Asciidoctor::Reader

Inherits Asciidoctor::Logging < Reference < Object

Methods for retrieving lines from AsciiDoc source files.

Constructors

new(data : Array(String) | String | Nil = nil, cursor : Cursor | String | Nil = nil, opts = {} of Symbol => String | Bool)
Source

Instance methods

advance

Advance to the next line by discarding the line at the front of the stack.

Source
cursor

Return a Cursor for the current position.

Source
cursor_at_line(lineno : Int32) : Cursor

Return a Cursor at the specified line number.

Source
cursor_at_mark

Return a Cursor at the marked position.

Source
cursor_at_prev_line

Return a Cursor at the previous line.

Source
cursor_before_mark

Return a Cursor one line before the marked position.

Source
discard_save

Discard a previous saved state.

Source
empty?

Check whether this reader is empty (contains no lines).

Source
eof?

Alias for empty?

Source
file
Source
has_more_lines?

Check whether there are any lines left to read.

Source
line_info

Get information about the last line read.

Source
lineno
Source
lines

Get a copy of the remaining lines.

Source
mark

Mark the current position.

Source
next_line_empty?

Peek at the next line and check if it's empty (i.e., whitespace only).

Source
path
Source
peek_line(direct : Bool = false) : String | Nil

Peek at the next line of source data. Processes the line if not already marked as processed, but does not consume it.

Source
peek_lines(num : Int32 | Nil = nil, direct : Bool = false) : Array(String)

Peek at the next multiple lines of source data.

Source
process_lines
Source
process_lines=(process_lines : Bool)
Source
read

Get the remaining lines of source data joined as a String.

Source
read_line

Get the next line of source data. Consumes the line returned.

Source
read_lines

Get the remaining lines of source data.

Source
read_lines_until(terminator : String | Nil = nil, break_on_blank_lines : Bool = false, break_on_list_continuation : Bool = false, skip_first_line : Bool = false, preserve_last_line : Bool = false, read_last_line : Bool = false, skip_line_comments : Bool = false, skip_processing : Bool = false, context : Symbol | Nil = nil, cursor_at : Cursor | Nil = nil, &block : String -> Bool) : Array(String)

Return all lines until a terminator, blank line, or block condition.

Source
read_lines_until(terminator : String | Nil = nil, break_on_blank_lines : Bool = false, break_on_list_continuation : Bool = false, skip_first_line : Bool = false, preserve_last_line : Bool = false, read_last_line : Bool = false, skip_line_comments : Bool = false, skip_processing : Bool = false, context : Symbol | Nil = nil, cursor_at : Cursor | Nil = nil) : Array(String)

Overload without block.

Source
replace_next_line(replacement : String) : Bool

Replace the next line with the specified line.

Source
restore_save

Restore the state of the reader.

Source
save

Save the state of the reader.

Source
skip_blank_lines

Skip blank lines at the cursor. Also skips LIST_CONTINUATION_PLACEHOLDER lines (treated as blank in Ruby AsciiDoctor).

Source
skip_comment_lines

Skip consecutive comment lines and block comments.

Source
skip_line_comments

Skip consecutive comment lines and return them.

Source
source

Get the source lines joined as a String.

Source
source_lines
Source
string

Get a copy of the remaining lines joined as a String.

Source
terminate

Advance to the end, consuming all remaining lines.

Source
to_s(io : IO) : Nil

Appends a short String representation of this object which includes its class name and its object address.

class Person
  def initialize(@name : String, @age : Int32)
  end
end

Person.new("John", 32).to_s # => #<Person:0x10a199f20>
Source
unshift_line(line_to_restore : String) : Nil

Push a line onto the beginning of the Array of source data.

Source
unshift_lines(lines_to_restore : Array(String)) : Nil

Push an Array of lines onto the front of the Array of source data.

Source
unterminated
Source
unterminated=(unterminated : Bool | Nil)
Source