Class: Docgenerator::Footnotegroup
- Defined in:
- lib/docgenerator/footnote.rb
Overview
Footnotegroup.
A Footnote without group-attribute get it’s own Footnotegroup. For LaTeX it is ok, for HTML the content of the footnote will disappear.
Constant Summary collapse
- DEFAULTGROUPID =
Define a default key for the footnotes. Used as part of the link.
'footnote'- @@all =
{}
Instance Attribute Summary collapse
-
#groupid ⇒ Object
readonly
Returns the value of attribute groupid.
-
#html_link ⇒ Object
Flag, if the footnote and the footnote mark should be linked.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(footnote) ⇒ Object
- #attr=(attr) ⇒ Object
-
#initialize(groupid = DEFAULTGROUPID) ⇒ Footnotegroup
constructor
Build a new footnote group.
- #size ⇒ Object
- #to_doc(target, options = {}) ⇒ Object
Constructor Details
#initialize(groupid = DEFAULTGROUPID) ⇒ Footnotegroup
Build a new footnote group.
22 23 24 25 26 27 28 |
# File 'lib/docgenerator/footnote.rb', line 22 def initialize( groupid = DEFAULTGROUPID) @groupid = groupid @footnotes = [] @attr = {} @html_link = true @@all[@groupid] = self end |
Instance Attribute Details
#groupid ⇒ Object (readonly)
Returns the value of attribute groupid.
31 32 33 |
# File 'lib/docgenerator/footnote.rb', line 31 def groupid @groupid end |
#html_link ⇒ Object
Flag, if the footnote and the footnote mark should be linked.
30 31 32 |
# File 'lib/docgenerator/footnote.rb', line 30 def html_link @html_link end |
Class Method Details
.[](key = DEFAULTGROUPID) ⇒ Object
16 17 18 |
# File 'lib/docgenerator/footnote.rb', line 16 def self.[](key=DEFAULTGROUPID) @@all[key] end |
Instance Method Details
#<<(footnote) ⇒ Object
35 36 37 |
# File 'lib/docgenerator/footnote.rb', line 35 def <<( footnote ) @footnotes << footnote unless @footnotes.include?(footnote) end |
#attr=(attr) ⇒ Object
32 33 34 |
# File 'lib/docgenerator/footnote.rb', line 32 def attr=( attr ) @attr = attr end |
#size ⇒ Object
38 39 40 |
# File 'lib/docgenerator/footnote.rb', line 38 def size() return @footnotes.size end |
#to_doc(target, options = {}) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/docgenerator/footnote.rb', line 41 def to_doc( target, ={} ) return '' if @footnotes.empty? ul = element(:p, @attr ).cr @footnotes.each{|f| #~ ul << element(:sup, {}, f.counter ) ul << footnotemark = element(:sup, { :log => [:log] }) if @html_link footnotemark << element(:label, { :name => "#{f.link}", :log => [:log] }, f.label ) else footnotemark << f.label end ul << f.get_content ul << element(:br).cr } return ul.to_doc(target, ) end |