Class: Jekyll::SideNoteTag
- Inherits:
-
Liquid::Tag
- Object
- Liquid::Tag
- Jekyll::SideNoteTag
- Defined in:
- lib/jekyll-theme-tufte/sidenote.rb
Overview
usage: sidenote ‘idtag’ ‘Content of the note…’ %
Instance Method Summary collapse
-
#initialize(tag_name, text, context) ⇒ SideNoteTag
constructor
A new instance of SideNoteTag.
- #render(_context) ⇒ Object
Constructor Details
#initialize(tag_name, text, context) ⇒ SideNoteTag
Returns a new instance of SideNoteTag.
9 10 11 12 13 14 15 |
# File 'lib/jekyll-theme-tufte/sidenote.rb', line 9 def initialize(tag_name, text, context) super @text = text.shellsplit if @text.length != 2 raise Liquid::SyntaxError, 'sidenote expects two shell-quoted arguments' end end |
Instance Method Details
#render(_context) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/jekyll-theme-tufte/sidenote.rb', line 17 def render(_context) [ "<label for='#{@text.fetch(0)}' class='margin-toggle sidenote-number'></label>", "<input type='checkbox' id='#{@text.fetch(0)}' class='margin-toggle' checked/>", "<span class='sidenote'>#{@text.fetch(1)}</span>", ].join('') end |