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



1480
1481
1482
1483
# File 'lib/mmmd/blankshell.rb', line 1480

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

.tokenize(string, *_lookaround) ⇒ Object



1470
1471
1472
1473
1474
1475
1476
1477
# File 'lib/mmmd/blankshell.rb', line 1470

def self.tokenize(string, *_lookaround)
  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