Included Modules

Class Index [+]

Quicksearch

TaskJuggler::HTMLDocument

HTMLDocument objects are a specialized form of XMLDocument objects. All mandatory elements of a proper HTML document will be added automatically upon object creation.

Public Class Methods

new(docType = :strict, &block) click to toggle source

When creating a HTMLDocument the caller can specify the type of HTML that will be used. The constructor then generates the proper XML declaration for it. :strict, :transitional and :frameset are supported for docType.

    # File lib/taskjuggler/HTMLDocument.rb, line 29
29:     def initialize(docType = :strict, &block)
30:       super(&block)
31: 
32:       @elements << XMLBlob.new('<?xml version="1.0" encoding="UTF-8"?>')
33:       case docType
34:       when :strict
35:         dtdRef = 'Strict'
36:         url = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'
37:       when :transitional
38:         dtdRef = 'Transitional'
39:         url = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'
40:       when :frameset
41:         dtdRef = 'Frameset'
42:         url = 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd'
43:       else
44:         raise "Unsupported docType"
45:       end
46:       @elements << XMLBlob.new('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ' +
47:                               "#{dtdRef}//EN\" \"#{url}\">")
48:       @elements << XMLComment.new('This file has been generated by ' +
49:                                   "#{AppConfig.appName} v#{AppConfig.version}")
50:       @elements << HTML.new({ 'xml:lang' => 'en', 'lang' => 'en',
51:                               'xmlns' => 'http://www.w3.org/1999/xhtml' })
52:     end

Public Instance Methods

generateHead(title, metaTags = {}) click to toggle source

Generate the ‘head’ section of an HTML page.

    # File lib/taskjuggler/HTMLDocument.rb, line 55
55:     def generateHead(title, metaTags = {})
56:       self << HEAD.new {
57:         e = [
58:           TITLE.new { title },
59:           META.new({ 'http-equiv' => 'Content-Type',
60:                      'content' => 'text/html; charset=utf-8' }),
61:         ]
62:         # Include optional meta tags.
63:         metaTags.each do |name, content|
64:           e << META.new({ 'name' => name, 'content' => content })
65:         end
66: 
67:         e
68:       }
69:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.