diff --git a/lib/repubmark/elems/joint.rb b/lib/repubmark/elems/joint.rb index 5b11672..b48b463 100644 --- a/lib/repubmark/elems/joint.rb +++ b/lib/repubmark/elems/joint.rb @@ -100,10 +100,10 @@ module Repubmark # Builder methods: Notes # ########################## - def context(index, anchor) + def context(index, category, slug) raise 'Context already given' if @context - @context = [index, anchor] + @context = [index, category, slug] nil end @@ -115,8 +115,8 @@ module Repubmark ref_note(*@context) end - def ref_note(index, anchor) - note Note.new self, index, anchor + def ref_note(index, category, slug) + note Note.new self, index, category, slug end private diff --git a/lib/repubmark/elems/note.rb b/lib/repubmark/elems/note.rb index 1f4ef45..cb08247 100644 --- a/lib/repubmark/elems/note.rb +++ b/lib/repubmark/elems/note.rb @@ -5,10 +5,11 @@ module Repubmark class Note < Base parents :Joint - def initialize(parent, index, anchor) + def initialize(parent, index, category, slug) super parent @index = index - @anchor = anchor + @category = category + @slug = slug end ################# @@ -18,7 +19,7 @@ module Repubmark def to_html [ '', - %(), + %(), %([#{CGI.escape_html(@index.to_s)}]), '', '', @@ -29,6 +30,8 @@ module Repubmark private + def anchor = "#@category-#@slug" + def index_unicode_sup @index_unicode_sup ||= Repubmark.unicode_sup @index end