Class: Marko::Markup::MLink

Inherits:
Macro
  • Object
show all
Defined in:
lib/marko/markup/macro.rb

Instance Method Summary collapse

Methods inherited from Macro

#gsub!, #pattern, pattern

Instance Method Details

#subs(sample, node) ⇒ Object

the macro requires obj [Decorator]



65
66
67
68
69
70
71
72
# File 'lib/marko/markup/macro.rb', line 65

def subs(sample, node)
  capture = /\[\[([\w\.]*)\]\]/
  ref = sample
    .match(capture)
    .captures.first
  obj = node.find_node(ref)
  obj ? obj.ref : "[#{ref}](#lost-link)"
end