Class: Repubmark::Elems::FootnotesCategory
- Defined in:
- lib/repubmark/elems/footnotes_category.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#footnote(**kwargs) {|footnote| ... } ⇒ Object
Builder methods #.
-
#initialize(parent, title) ⇒ FootnotesCategory
constructor
A new instance of FootnotesCategory.
- #to_gemtext ⇒ Object
-
#to_html ⇒ Object
Basic methods #.
Methods inherited from Base
#absolute_url, #config, #count_words, #html_class, #own_url, parent?, parents, #relative_url, #to_summary_plain, #word_count
Constructor Details
#initialize(parent, title) ⇒ FootnotesCategory
Returns a new instance of FootnotesCategory.
8 9 10 11 12 |
# File 'lib/repubmark/elems/footnotes_category.rb', line 8 def initialize(parent, title) super parent @title = title @footnotes = [] end |
Instance Method Details
#footnote(**kwargs) {|footnote| ... } ⇒ Object
Builder methods #
40 41 42 43 44 45 |
# File 'lib/repubmark/elems/footnotes_category.rb', line 40 def footnote(**kwargs) footnote = Footnote.new(self, **kwargs) @footnotes << footnote yield footnote if block_given? nil end |
#to_gemtext ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/repubmark/elems/footnotes_category.rb', line 28 def to_gemtext " ## \#@title\n\n \#{@footnotes.map(&:to_gemtext).map(&:strip).join(\"\\n\")}\n GEMTEXT\nend\n" |
#to_html ⇒ Object
Basic methods #
18 19 20 21 22 23 24 25 26 |
# File 'lib/repubmark/elems/footnotes_category.rb', line 18 def to_html " <h2>\#@title</h2>\n\n <ol>\n \#{@footnotes.map(&:to_html).map(&:strip).join(\"\\n\")}\n </ol>\n HTML\nend\n" |