Class: Docgenerator::Footnote
- Defined in:
- lib/docgenerator/footnote.rb
Overview
A Footnote.
HTML
Footnotes should be assigned to a Footnotegroup
Constant Summary
Constants inherited from Element
Constants included from Docgenerator
ATTR_LANG, CSS_BORDER, CSS_COLORS, CSS_WIDTH, DOCGENERATOR_DEFAULT_LOGGER, DOCGENERATOR_LOGGER, ENDTAG, HTML_ATTR_ALIGN, HTML_ATTR_ALL, HTML_ATTR_CORE, HTML_ATTR_EVENTS, HTML_ATTR_I18N, HTML_ATTR_VALIGN, VERSION
Instance Attribute Summary collapse
-
#group ⇒ Object
readonly
The footnote group for the corresponding footnote.
-
#label ⇒ Object
readonly
Label of the footnote.
Attributes inherited from Element
Instance Method Summary collapse
- #get_content ⇒ Object
-
#initialize(attr = {}, content = nil) ⇒ Footnote
constructor
A new instance of Footnote.
- #link ⇒ Object
- #to_html(options = {}) ⇒ Object
- #to_latex(options = {}) ⇒ Object
- #to_text(options = {}) ⇒ Object (also: #to_wiki)
Methods inherited from Element
#<<, #CR, #Cr, #[], add, add_attribute, add_attributes, add_context_output, add_creole_output, add_html_output, add_html_tag, add_id, add_latex_output, add_output, add_text_output, add_wiki_output, attributes, #cR, #content?, #cr, create, create_convert_to_code, #delete, element_ids, #element_ids, #empty?, get, get_attribute_list, has_no_content, #htmltag, #ids, inherited, #insert, #insertafter, #insertbefore, #inspect, #inspect_creation_caller, #linebreak, overview, #prepare_tracing_info, #restrict_to, #texkeyval, #texoptional, #to_context, #to_creole, #to_doc, #to_s, trace=
Methods included from Docgenerator
#set_option_defaults, set_option_defaults, trace_off, trace_on, trace_on?
Constructor Details
#initialize(attr = {}, content = nil) ⇒ Footnote
Returns a new instance of Footnote.
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/docgenerator/footnote.rb', line 76 def initialize( attr={}, content = nil) super @group = attr[:group] || Footnotegroup[] #@group must be defined! #This is only a dummy group. it will be lost for overviews. if ! @group.is_a?(Footnotegroup) @group = Footnotegroup.new() #~ @log.error( "Footnote: No group assigned. Build a new group") if @log.error? end @group << self @label = ( attr[:label] ? attr[:label] : @group.size ) end |
Instance Attribute Details
#group ⇒ Object (readonly)
The footnote group for the corresponding footnote
72 73 74 |
# File 'lib/docgenerator/footnote.rb', line 72 def group @group end |
#label ⇒ Object (readonly)
Label of the footnote
74 75 76 |
# File 'lib/docgenerator/footnote.rb', line 74 def label @label end |
Instance Method Details
#get_content ⇒ Object
118 119 120 |
# File 'lib/docgenerator/footnote.rb', line 118 def get_content() return @content end |
#link ⇒ Object
89 90 91 |
# File 'lib/docgenerator/footnote.rb', line 89 def link() "#{@group.groupid}-#{self.label}" end |
#to_html(options = {}) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/docgenerator/footnote.rb', line 92 def to_html( ={} ) cmd = '' cmd << "\n" if @crbefore if @group.html_link cmd << "<sup><a href=\"##{link}\">#{label}</a></sup>" else cmd << "<sup>#{label}</sup>" end cmd << "\n" if @crafter return cmd end |
#to_latex(options = {}) ⇒ Object
103 104 105 106 107 108 109 |
# File 'lib/docgenerator/footnote.rb', line 103 def to_latex( ={} ) cmd = '' cmd << "\n" if @crbefore cmd << "\\footnote{#{@content.to_latex()}}" cmd << "\n" if @crafter return cmd end |
#to_text(options = {}) ⇒ Object Also known as: to_wiki
110 111 112 113 114 115 116 |
# File 'lib/docgenerator/footnote.rb', line 110 def to_text(={}) cmd = '' cmd << "\n" if @crbefore cmd << "(#{label})" cmd << "\n" if @crafter return cmd end |