Module: Rock::HTML

Includes:
Logger::Hierarchy
Defined in:
lib/rock/html.rb,
lib/rock/html/autoproj_osdep.rb,
lib/rock/html/autoproj_package.rb,
lib/rock/html/autoproj_package_set.rb,
lib/rock/html/autoproj_vcs.rb,
lib/rock/html/os_package.rb

Defined Under Namespace

Classes: AutoprojOSDep, AutoprojPackage, AutoprojPackageSet, AutoprojVCS, OSPackage

Constant Summary collapse

TEMPLATE_DIR =
File.expand_path('html', File.dirname(__FILE__))

Class Method Summary collapse

Class Method Details

.allocate_help_idObject



21
22
23
# File 'lib/rock/html.rb', line 21

def self.allocate_help_id
    @help_id += 1
end

.help_tip(doc) ⇒ Object



25
26
27
28
# File 'lib/rock/html.rb', line 25

def self.help_tip(doc)
    id = allocate_help_id
    "<span class=\"help_trigger\" id=\"#{id}\"><img src=\"{relocatable: /img/help.png}\" /></span><div class=\"help\" id=\"help_#{id}\">#{doc}</div>"
end

.obscure_email(email) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/rock/html.rb', line 9

def self.obscure_email(email)
    return nil if email.nil? #Don't bother if the parameter is nil.
    lower = ('a'..'z').to_a
    upper = ('A'..'Z').to_a
    email.split('').map { |char|
        output = lower.index(char) + 97 if lower.include?(char)
        output = upper.index(char) + 65 if upper.include?(char)
        output ? "&##{output};" : (char == '@' ? '&#0064;' : char)
    }.join
end