Class: Docgenerator::Elements::Href
- Inherits:
-
Docgenerator::Element
- Object
- Docgenerator::Element
- Docgenerator::Elements::Href
- Defined in:
- lib/docgenerator/elements.rb
Overview
Internal reference The href-parameter is expected with a leading # (HTML) The corresponding label should be defined in the same document/file.
For external links use :href.
Constant Summary
Constants inherited from Docgenerator::Element
Docgenerator::Element::SUPPORTED_TARGETS
Constants included from Docgenerator
ATTR_LANG, CSS_BORDER, CSS_COLORS, CSS_WIDTH, DOCGENERATOR_DEFAULT_LOGGER, DOCGENERATOR_LOGGER, Docgenerator::ENDTAG, HTML_ATTR_ALIGN, HTML_ATTR_ALL, HTML_ATTR_CORE, HTML_ATTR_EVENTS, HTML_ATTR_I18N, HTML_ATTR_VALIGN, VERSION
Instance Attribute Summary
Attributes inherited from Docgenerator::Element
Instance Method Summary collapse
- #to_creole(options = {}) ⇒ Object
- #to_latex(options = {}) ⇒ Object
- #to_text(options = {}) ⇒ Object
- #to_wiki(options = {}) ⇒ Object
Methods inherited from Docgenerator::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, #initialize, #insert, #insertafter, #insertbefore, #inspect, #inspect_creation_caller, #linebreak, overview, #prepare_tracing_info, #restrict_to, #texkeyval, #texoptional, #to_context, #to_doc, #to_html, #to_s, trace=
Methods included from Docgenerator
#set_option_defaults, set_option_defaults, trace_off, trace_on, trace_on?
Constructor Details
This class inherits a constructor from Docgenerator::Element
Instance Method Details
#to_creole(options = {}) ⇒ Object
753 754 755 |
# File 'lib/docgenerator/elements.rb', line 753 def to_creole( = {} ) "[[#{@attr[:href].to_s}|#{@content.to_doc(:creole, options)}]]" end |
#to_latex(options = {}) ⇒ Object
756 757 758 759 760 761 762 763 764 765 766 767 |
# File 'lib/docgenerator/elements.rb', line 756 def to_latex( = {} ) cmd = linebreak(@crbefore) reference = @attr[:href].to_s if reference.sub!(/\A\#/, '') #Internal reference cmd << "\\hyperlink{#{reference}}{#{@content.to_doc(:latex, options)}}" else #external reference #reference may not contain unmasked % or # cmd << "\\href{#{reference}}{#{@content.to_doc(:latex, options)}}" end cmd << linebreak(@crafter) cmd end |
#to_text(options = {}) ⇒ Object
768 769 770 771 772 773 774 775 |
# File 'lib/docgenerator/elements.rb', line 768 def to_text( = {} ) if @attr[:href].to_s == @content @content.to_doc(:text, ) else #~ "<#{@attr[:href].to_s} #{@content}>" --> Problem: Wird gerne als komplette URL interpreitert "#{@content.to_doc(:text, options)} (#{@attr[:href].to_s})" end end |
#to_wiki(options = {}) ⇒ Object
750 751 752 |
# File 'lib/docgenerator/elements.rb', line 750 def to_wiki( = {} ) "[#{@attr[:href].to_s} #{@content.to_doc(:wiki, options)}]" end |