Class: PointBlank::Parsing::HyperlinkInline Abstract
- Inherits:
-
NullInline
- Object
- NullInline
- PointBlank::Parsing::HyperlinkInline
- Defined in:
- lib/mmmd/blankshell.rb
Overview
This class is abstract.
Hyperreference inline superclass
Direct Known Subclasses
Class Method Summary collapse
-
.build_w_linkinfo(capture, doc) ⇒ ::PointBlank::DOM::DOMObject
Build object and apply link info to it.
-
.parse_linkinfo(input) ⇒ Array(<Hash, String, nil>, String)
Parse link properties according to given link suffix.
-
.reverse_walk(backlog, doc:) ⇒ Object
TODO: optimize, increase index instead of building buffers (see ::PointBlank::Parsing::NullInline#reverse_walk).
Methods inherited from NullInline
build, check_contents, check_unescaped, construct_literal, construct_text, find_unescaped, forward_walk, iterate_tokens, tokenize
Class Method Details
.build_w_linkinfo(capture, doc) ⇒ ::PointBlank::DOM::DOMObject
Build object and apply link info to it
1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 |
# File 'lib/mmmd/blankshell.rb', line 1232 def self.build_w_linkinfo(capture, doc) linkinfo = capture[-1][2] obj = build(capture[1..-2]) if linkinfo[:label] unless (props = doc.root.properties[:linkdefs][linkinfo[:label]]) return nil end linkinfo = props end obj.properties = linkinfo obj end |
.parse_linkinfo(input) ⇒ Array(<Hash, String, nil>, String)
Parse link properties according to given link suffix
1220 1221 1222 1223 1224 1225 1226 |
# File 'lib/mmmd/blankshell.rb', line 1220 def self.parse_linkinfo(input) props, remainder = read_properties(input) return nil, "" unless props capture = input[..(input.length - remainder.length - 1)] [props, capture] end |
.reverse_walk(backlog, doc:) ⇒ Object
TODO: optimize, increase index instead of building buffers (see ::PointBlank::Parsing::NullInline#reverse_walk)
1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 |
# File 'lib/mmmd/blankshell.rb', line 1247 def self.reverse_walk(backlog, doc:) before = [] capture = [] open = true cls = nil backlog.reverse_each do |block| (open ? capture : before).prepend(block) next unless block.is_a?(Array) && block[1] < self open = false cls = block[1] return backlog unless block[1].check_contents(capture) end return backlog if open block = cls.build_w_linkinfo(capture, doc) block ? before + [block] : backlog end |