Class: ListMacro
- Inherits:
-
MarkupMacro
- Object
- MarkupMacro
- ListMacro
- Defined in:
- lib/assets/lib/markup_macro.rb
Overview
Builds a list of Node#items where items linked to appropriate headers
Instance Attribute Summary
Attributes inherited from MarkupMacro
Instance Method Summary collapse
-
#initialize ⇒ ListMacro
constructor
A new instance of ListMacro.
- #process(macro, node) ⇒ Object
Constructor Details
#initialize ⇒ ListMacro
Returns a new instance of ListMacro.
50 51 52 53 |
# File 'lib/assets/lib/markup_macro.rb', line 50 def initialize @title = "List" @regex = /{{@@list}}/ end |
Instance Method Details
#process(macro, node) ⇒ Object
55 56 57 58 59 |
# File 'lib/assets/lib/markup_macro.rb', line 55 def process(macro, node) node.items.inject([]) do |ary, n| ary << "* [#{n.title}](##{node.url(n.id)})" end.join("\n") end |