Class: Repubmark::Elems::Note
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #anchor ⇒ Object private
- #index_unicode_sup ⇒ Object private
-
#initialize(parent, index, category, slug) ⇒ Note
constructor
A new instance of Note.
- #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, index, category, slug) ⇒ Note
Returns a new instance of Note.
8 9 10 11 12 13 |
# File 'lib/repubmark/elems/note.rb', line 8 def initialize(parent, index, category, slug) super parent @index = index @category = category @slug = slug end |
Instance Method Details
#anchor ⇒ Object (private)
33 |
# File 'lib/repubmark/elems/note.rb', line 33 def anchor = "#@category-#@slug" |
#index_unicode_sup ⇒ Object (private)
35 36 37 |
# File 'lib/repubmark/elems/note.rb', line 35 def index_unicode_sup @index_unicode_sup ||= Repubmark.unicode_sup @index end |
#to_gemtext ⇒ Object
29 |
# File 'lib/repubmark/elems/note.rb', line 29 def to_gemtext = "⁽#{index_unicode_sup}⁾".freeze |
#to_html ⇒ Object
Basic methods #
19 20 21 22 23 24 25 26 27 |
# File 'lib/repubmark/elems/note.rb', line 19 def to_html [ '<sup>', %(<a href="##{CGI.escape_html(anchor)}">), %([#{CGI.escape_html(@index.to_s)}]), '</a>', '</sup>', ].join.freeze end |