Class: PointBlank::Parsing::HardBreakInline

Inherits:
NullInline
  • Object
show all
Defined in:
lib/mmmd/blankshell.rb

Overview

Hard break

Class Method Summary collapse

Methods inherited from NullInline

build, check_contents, check_unescaped, construct_literal, construct_text, find_unescaped, forward_walk, iterate_tokens

Class Method Details

.reverse_walk(backlog, **_doc) ⇒ Object



1444
1445
1446
1447
# File 'lib/mmmd/blankshell.rb', line 1444

def self.reverse_walk(backlog, **_doc)
  backlog[-1] = build([])
  backlog
end

.tokenize(string) ⇒ Object



1434
1435
1436
1437
1438
1439
1440
1441
# File 'lib/mmmd/blankshell.rb', line 1434

def self.tokenize(string)
  iterate_tokens(string, /(?:  \n|\\\n)/) do |_before, token, matched|
    next ["\n", self, :close] if token.start_with?("  \n")
    next ["\n", self, :close] if matched

    " "
  end
end