class Asciidoctor::Reader
def grab_lines_until(options = {}, &block)
reader.grab_lines_until
"--\n", "\n", "In a different segment\n"]
"Open block\n", "\n", "Can have blank lines\n",
reader = Reader.new ["First paragraph\n", "Second paragraph\n",
Examples
Returns the Array of lines forming the next segment.
pushed back onto the `lines` Array.
causing the method to stop processing lines should be
* :preserve_last_line may be used to specify that the String
blank lines
* :break_on_blank_lines may be used to specify to break on
options - an optional Hash of processing options:
a line for which the given block evals to true.
(2) find a blank line with :break_on_blank_lines => true, or (3) find
Public: Return all the lines from `@lines` until we (1) run out them,
def grab_lines_until(options = {}, &block) buffer = [] while (this_line = self.get_line) Asciidoctor.debug "Processing line: '#{this_line}'" finis ||= true if options[:break_on_blank_lines] && this_line.strip.empty? finis ||= true if block && value = yield(this_line) if finis self.unshift(this_line) if options[:preserve_last_line] break end buffer << this_line end buffer end