Class: Docgenerator::Environments::Environment

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

Overview

Define Element :environment

This class is used for further class definitions. Only for LaTeX

Create an instance with

element( :environment, [ attributes, [content]] )

or

Environment.new( [ attributes, [content]] )

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_html, #to_latex, #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

#to_context_environment(environment, parameter = nil, options = {}) ⇒ Object

ConTeXt-environments start with start and end with stop.

Fixme: Parameters



51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/docgenerator/environments.rb', line 51

def to_context_environment( environment, parameter = nil, options={})
  cmd	=	''
  cmd	<<	"\n" if @crbefore
  cmd	<<	"\n\\start#{environment}"
  cmd	<< parameter.to_s if parameter
  cmd	<<	"\n" if @crmid
  cmd	<< @content.to_latex(options)
  #~ cmd	<<	"\n" if @crmid and cmd[-1,1] != "\n"
  cmd	<<	"\n\\stop#{environment}\n"
  cmd	<<	"\n" if @crafter
  return cmd
end

#to_latex_environment(environment, parameter = nil, options = {}) ⇒ Object

Parameters are given as a string (or anything what gives a String with to_s).

It is difficult to make a generic parameter interface.

If needed, redefine the method.



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/docgenerator/environments.rb', line 34

def to_latex_environment( environment, parameter = nil, options={})
  cmd	=	''
  cmd	<<	"\n" if @crbefore
  cmd	<<	"\n\\begin{#{environment}}"
  cmd	<< parameter.to_s if parameter
  cmd	<<	"\n" if @crmid
  cmd	<< @content.to_latex(options)
  cmd	<<	"\n" if @crmid and cmd[-1,1] != "\n"
  cmd	<<	"\\end{#{environment}}\n"
  cmd	<<	"\n" if @crafter
  return cmd
end