blob: 93739ba25a615042a0376fc42a221c07502a8580 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
class HTML
attr_accessor :title, :htmlout, :header
def initialize
@header = {}
@header["type"] = "text/html"
# @header["type"] = "application/xhtml+xml"
@header["charset"] = "utf-8"
@htmlout = <<HEAD
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
HEAD
@css = {}
@atom = []
end
def add_head(title)
@htmlout += <<HEAD
<head>
<meta http-equiv="Content-Type" content="#{@header["type"]}; charset=#{@header["charset"]}" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>#{title}</title>
HEAD
@css.each{|title,href|
@htmlout += "<link rel='stylesheet' type='text/css' href='#{href}' title='#{title}'/>"
@htmlout += "<link rel='stylesheet' type='text/css' href='#{href}' title='print' media='print' />" if title == "print"
}
@atom.each{|href|
@htmlout += "<link rel='alternate' type='application/atom+xml' href='#{href}' />"
}
@htmlout += "</head>"
end
def add_css(href, title = "default")
@css[title] ||= []
@css[title] << href
end
def add_atom(href)
@atom << href
end
def add_tabs
@htmlout += <<HEAD
<div id='tabs'>
<ul>
<li id='active_tab' > poll </li>
<li class='nonactive_tab'><a href='config.cgi'> admin </a></li>
</ul>
</div>
HEAD
end
end
|