Module: Docgenerator

Included in:
Document, Element
Defined in:
lib/docgenerator.rb,
lib/docgenerator/css.rb,
lib/docgenerator/index.rb,
lib/docgenerator/lists.rb,
lib/docgenerator/element.rb,
lib/docgenerator/tabular.rb,
lib/docgenerator/version.rb,
lib/docgenerator/document.rb,
lib/docgenerator/elements.rb,
lib/docgenerator/footnote.rb,
lib/docgenerator/sections.rb,
lib/docgenerator/attribute.rb,
lib/docgenerator/characters.rb,
lib/docgenerator/element_meta.rb,
lib/docgenerator/environments.rb,
lib/docgenerator/packages/url.rb,
lib/docgenerator/compatibility_v1.rb,
lib/docgenerator/packages/caption.rb,
lib/docgenerator/packages/hyperref.rb,
lib/docgenerator/packages/listings.rb,
lib/docgenerator/packages/multicol.rb,
lib/docgenerator/packages/pdfpages.rb,
lib/docgenerator/packages/scrpage2.rb,
lib/docgenerator/packages/struktex.rb,
lib/docgenerator/packages/scrlettr2.rb,
lib/docgenerator/packages/todonotes.rb,
lib/docgenerator/packages/attachfile.rb,
lib/docgenerator/packages/rubycode4doc.rb,
lib/docgenerator/templates/docgenerator_template.rb,
lib/docgenerator/templates/docgenerator_template_css.rb

Overview

Definition of tabular elements for docgenerator-gem.

Defined Under Namespace

Modules: Characters, Element_methods, Elements, Environments, Index, Listings, Lists, Logger_INFO, Packages, Rubycode, Sectioning, Tables Classes: Attribute, CSS, CSS_collection, Document, DocumentTemplate, Element, Footnote, Footnotegroup, Footnotemark, LogFormatter, Style

Constant Summary collapse

ENDTAG =

How to handle the End-Tag for br/hr…

  • false: set <br /> (XHTML)

  • nil: set
    (HTML)

Problem: HTML may have no endtags, XHTML requires it. This constant defines it global. Fixme: Flag it in the HTML-template what you need.

false
DOCGENERATOR_LOGGER =

Logger for Docgenerator

Log4r::Logger.new( 'docgenerator')
DOCGENERATOR_DEFAULT_LOGGER =

Default Logger. Used in #set_option_defaults

Log4r::Logger.new( 'docgenerator default')
CSS_COLORS =

Style

[ /rgb\((\d+%?,?){3,3}\)/, 
  #rgb(R,G,B), rgb(%,%,%) oder #XXXXXX
  #/gray\d{1,3}/
  'black','gray', 'grey', 'maroon','red', 'green', 'lime', 'olive', 'yellow', 'navy', 'blue', 'purple', 'fuchsia', 'teal', 'aqua', 'silver', 'white',
  #Netscape-Farbnamen (120 additional colors)
  #Falsche Darstellungen, siehe http://www.rzuser.uni-heidelberg.de/~x22/ht/farben2.html
  'lightblue', 'lightcoral', 'lightcyan', 'lightgoldenrodyellow', 'lightgreen', 
  'lightgrey', 'lightgray', 'lightslategray', 'lightslategrey', #yes, both are defined
  'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue', 'lightsteelblue', 'lightyellow',
  'greenyellow', 'palegreen', 'darkgreen',
  'darkred', 'firebrick',
  'salmon',
]
CSS_BORDER =
[ 'none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset' ]
CSS_WIDTH =
[ /\d*(cm|mm|px|em|%)/, 'thin', 'medium', 'thick' ]
VERSION =

Define Version number.

'3.0.0'
ATTR_LANG =

Definition of HTML-Tags (Sublasses of Element).

Attribute.create( [ :html ], ['en', 'de'] )
HTML_ATTR_CORE =
{  
:id    => Attribute.create( [ :html ] ),
:class  => Attribute.create( [ :html ] ),
:style  => Attribute.create( [ :html ], [CSS, String]),  #fixme string raus
#~ :name  => Attribute.create( [ :html ] ),
:title    => Attribute.create( [ :html ] ) }
HTML_ATTR_I18N =
{  
  :lang    => ATTR_LANG,
  :dir    => Attribute.create( [ :html ], ['ltr', 'rtl'] )
}
HTML_ATTR_EVENTS =
{  :onclick    => Attribute.create( [ :html ] ), 
    :ondblclick    => Attribute.create( [ :html ] ), 
    :onmousedown  => Attribute.create( [ :html ] ),
    :onmouseup  => Attribute.create( [ :html ] ),
    :onmouseover  => Attribute.create( [ :html ] ),
    :onmousemove  => Attribute.create( [ :html ] ),
    :onmouseout  => Attribute.create( [ :html ] ), 
    :onkeypress  => Attribute.create( [ :html ] ),
    :onkeyup    => Attribute.create( [ :html ] ), 
    :onkeydown  => Attribute.create( [ :html ] )
}
HTML_ATTR_ALL =
{}
HTML_ATTR_ALIGN =
Attribute.create( [ :html ], ['left', 'center', 'right', 'justify', 'char'] )
HTML_ATTR_VALIGN =
Attribute.create( [ :html ], ['bottom', 'top', 'middle', 'baseline'] )

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.set_option_defaults(options, called_by = self) ⇒ Object

Each to_doc, to_html, to_latex, to_wiki, to_text has an option-parameter.

This option-hash should contain at least a :log-value.

This method completes the option hash with a default logger and returns a warning if no logger is given.

Usage:

def to_doc(target, options)
  o = set_option_defaults(options)
  o[:log].debug("Enter ...") if o[:log].debug?
  ...
end


314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/docgenerator.rb', line 314

def self.set_option_defaults(options, called_by = self)
  if ! options[:log]
    DOCGENERATOR_LOGGER.warn("Missing logger in set_option_defaults, use DOCGENERATOR_DEFAULT_LOGGER (#{called_by.inspect})") if DOCGENERATOR_LOGGER.warn?
    DOCGENERATOR_LOGGER.debug("\n\t#{caller.join("\n\t")}") if DOCGENERATOR_LOGGER.debug?
  end
  return {
      :log  => DOCGENERATOR_DEFAULT_LOGGER,
      #Added from Document:
      # :document   useable for documentation
      # :filename   useable for documentation
      # :template  only Document-internal
      # :replacements only Document-internal
      #to think about:
      #- parent - actually used in list to detect */# for wiki-items.
    }.update(options)
end

.trace_offObject

Set tracing off



98
# File 'lib/docgenerator.rb', line 98

def trace_off; @trace = false; end

.trace_onObject

Set tracing on.

Often there is the problem, that you get an error when you write the element (Element#to_doc).

But to correct the error, you need the location of element creation, not usage.

With Docgenerator.trace_on this tracing information is stored during element creation.



96
# File 'lib/docgenerator.rb', line 96

def trace_on; @trace = true; end

.trace_on?Boolean

Check if element tracing is on., Details see Docgenerator.trace_on.

Returns:

  • (Boolean)


100
# File 'lib/docgenerator.rb', line 100

def trace_on?; @trace; end

Instance Method Details

#set_option_defaults(options) ⇒ Object

Instance-version of class method.



333
334
335
# File 'lib/docgenerator.rb', line 333

def set_option_defaults(options)
  Docgenerator.set_option_defaults(options, self)
end