Method: MaRuKu::Out::HTML#to_html_footnote_reference

Defined in:
lib/maruku/output/to_html.rb

#to_html_footnote_referenceObject



756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
# File 'lib/maruku/output/to_html.rb', line 756

def to_html_footnote_reference
  id = self.footnote_id

  # save the order of used footnotes
  order = @doc.footnotes_order

  # footnote has already been used
  return [] if order.include?(id)

  return [] unless @doc.footnotes[id]

  # take next number
  order << id

  num = order.index(id) + 1

  sup = xelem('sup')
  sup['id'] = "#{get_setting(:doc_prefix)}fnref:#{num}"
  a = xelem('a')
  a << xtext(num.to_s)
  a['href'] = "\##{get_setting(:doc_prefix)}fn:#{num}"
  a['rel'] = 'footnote'
  sup << a
end