Class: MarkupMacro

Inherits:
Object
  • Object
show all
Defined in:
lib/assets/lib/markup_macro.rb

Overview

Macro that can be used in MarkupNode

Usage:

node = MarkupNode(Clerq::Entities::Node.new(
  id: 'id', body: Some text that contains {{@@macro}}")
)
macro = Macro.new
macro.(node.body, node) # "Some text that contains [processed macro]"

Direct Known Subclasses

EvalMacro, ListMacro, SkipMacro, TreeMacro

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#regexObject (readonly)

Returns the value of attribute regex.



12
13
14
# File 'lib/assets/lib/markup_macro.rb', line 12

def regex
  @regex
end

#titleObject (readonly)

Returns the value of attribute title.



12
13
14
# File 'lib/assets/lib/markup_macro.rb', line 12

def title
  @title
end

Instance Method Details

#process(macro, node) ⇒ String

TODO: find more situable name Process macro that must be implemented in subclasses

Parameters:

  • macro (String)

    macrotext

  • node (Node)

    the context in which the macro is processed

Returns:

  • (String)

    a text processed by macro



18
19
# File 'lib/assets/lib/markup_macro.rb', line 18

def process(macro, node)
end