Class: PointBlank::Parsing::ImageInline

Inherits:
HyperlinkInline show all
Extended by:
LinkSharedMethods
Defined in:
lib/mmmd/blankshell.rb

Overview

Image inline parser

Class Method Summary collapse

Methods included from LinkSharedMethods

balanced?, find_balanced_end, normalize_label, process_destination, process_title, read_destination, read_label, read_properties, read_return_label, read_title

Methods inherited from HyperlinkInline

build_w_linkinfo, parse_linkinfo, reverse_walk

Methods inherited from NullInline

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

Class Method Details

.tokenize(string, *_lookaround) ⇒ Object



1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
# File 'lib/mmmd/blankshell.rb', line 1274

def self.tokenize(string, *_lookaround)
  iterate_tokens(string, /(?:!\[|\]\()/) do |_before, text, matched|
    next text[0] unless matched
    next ["![", self, :open] if text.start_with? "!["
    next text[0] unless text.start_with? "]"

    info, capture = parse_linkinfo(text[1..])
    info ? ["]#{capture}", HyperlinkInline, info, :close] : text[0]
  end
end