Class: Docgenerator::Elements::Usepackage

Inherits:
Docgenerator::Element show all
Defined in:
lib/docgenerator/elements.rb

Overview

Add a TeX-Makro usepackage.

This method tries to load the package specific definitions in a file

docgenerator_<<packagename>>

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

#attr, #content, #log

Instance Method Summary collapse

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_creole, #to_doc, #to_s, #to_text, #to_wiki, 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

#<<(content) ⇒ Object

With usepackage additional command may be defined.

Here we load this special commands/elements if available.



933
934
935
936
937
938
939
940
941
942
943
# File 'lib/docgenerator/elements.rb', line 933

def << ( content )
  @content << content
  #Load new additionals makros if available
  makrodefinitions = 'docgenerator/packages/' + content + '.rb'
  begin
    @log.debug("usepackage: Try to load #{makrodefinitions}") if @log.debug?
    require makrodefinitions 
  rescue LoadError 
    @log.info("usepackage: No supporting definitions #{makrodefinitions} found") if @log.info?
  end 
end

#to_html(options = {}) ⇒ Object

Not used in HTML



962
963
964
# File 'lib/docgenerator/elements.rb', line 962

def to_html( options = {} )
  return ''
end

#to_latex(options = {}) ⇒ Object

~ add_latex_output ‘\usepackage[#href=":option">attr]#{@content}’



950
951
952
953
954
955
956
957
958
# File 'lib/docgenerator/elements.rb', line 950

def to_latex( options = {} )
  cmd = linebreak(@crbefore)
  cmd << '\usepackage'
  opt = @attr[:option].content
  cmd << '[' + opt.join(',') + ']' if opt.size > 0
  cmd << "{#{@content.join}}"
  cmd << linebreak(@crafter)
  return cmd
end