Class: Facwparser::Element::TocMacro
- Inherits:
-
MacroBase
- Object
- ElementBase
- MacroBase
- Facwparser::Element::TocMacro
- Defined in:
- lib/facwparser/element.rb
Instance Attribute Summary collapse
-
#headings ⇒ Object
Returns the value of attribute headings.
Attributes inherited from ElementBase
Instance Method Summary collapse
-
#initialize(source, options = nil) ⇒ TocMacro
constructor
A new instance of TocMacro.
- #render_html(options) ⇒ Object
Methods inherited from ElementBase
Constructor Details
#initialize(source, options = nil) ⇒ TocMacro
Returns a new instance of TocMacro.
183 184 185 186 |
# File 'lib/facwparser/element.rb', line 183 def initialize(source, = nil) super(source) @options = end |
Instance Attribute Details
#headings ⇒ Object
Returns the value of attribute headings.
182 183 184 |
# File 'lib/facwparser/element.rb', line 182 def headings @headings end |
Instance Method Details
#render_html(options) ⇒ Object
187 188 189 190 191 192 |
# File 'lib/facwparser/element.rb', line 187 def render_html() "<ul>\n" + @headings.map{|h| '<li><a href="#%s">%s</a></li>' % [CGI.escapeHTML(h.id), CGI.escapeHTML(h.render_text())]}.join("\n") + "\n</ul>\n" end |