Method: MaRuKu::Out::HTML#render_footnotes

Defined in:
lib/amp-front/third_party/maruku/output/to_html.rb

#render_footnotesObject



316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/amp-front/third_party/maruku/output/to_html.rb', line 316

def render_footnotes()
  div = Element.new 'div'
  div.attributes['class'] = 'footnotes'
  div <<  Element.new('hr')
    ol = Element.new 'ol'
    @doc.footnotes_order.each_with_index do |fid, i| num = i+1
      f = self.footnotes[fid]
      if f
        li = f.wrap_as_element('li')
        li.attributes['id'] = "#{get_setting(:doc_prefix)}fn:#{num}"
        
        a = Element.new 'a'
          a.attributes['href'] = "\##{get_setting(:doc_prefix)}fnref:#{num}"
          a.attributes['rev'] = 'footnote'
          a<< Text.new('&#8617;', true, nil, true)
        li.insert_after(li.children.last, a)
        ol << li
      else
        maruku_error "Could not find footnote id '#{fid}' among ["+
         self.footnotes.keys.map{|s|"'"+s+"'"}.join(', ')+"]."
      end
    end
  div << ol
  div
end