Module: Preprocessor::Footnote

Included in:
BasicPreprocessor
Defined in:
lib/preprocessor/footnote.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



3
4
5
6
7
# File 'lib/preprocessor/footnote.rb', line 3

def self.included(base)
  base.class_eval do
    attr_accessor :footnote_refs
  end
end

Instance Method Details

#footnote(options) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/preprocessor/footnote.rb', line 9

def footnote(options)
  ref = options[:ref]
  add_footnote(ref, options[:text])

  id = "#{guid}-#{options[:ref]}"
  %{<a href="#fn-#{id}" class="footnote" id="ref-#{id}">#{ref}</a>}
end

#footnotes(options) ⇒ Object



17
18
19
# File 'lib/preprocessor/footnote.rb', line 17

def footnotes(options)
  footnote_refs.nil? ? "" : footnote_refs.map { |fn| footnote_content(fn) }.join
end