aboutsummaryrefslogtreecommitdiff
path: root/html.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 20:00:05 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-19 20:00:05 +0100
commit0e8d1d9d28d127704897bb9fb4ea06105a1d0f84 (patch)
tree78e5184dc8484df18659b23f659dd53836e48014 /html.rb
parentb71b68e55f6550345dec2dc06994399150d8f9fc (diff)
startet to use html element for output
Diffstat (limited to 'html.rb')
-rw-r--r--html.rb53
1 files changed, 53 insertions, 0 deletions
diff --git a/html.rb b/html.rb
new file mode 100644
index 0000000..93739ba
--- /dev/null
+++ b/html.rb
@@ -0,0 +1,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' >&nbsp;poll&nbsp;</li>
+ <li class='nonactive_tab'><a href='config.cgi'>&nbsp;admin&nbsp;</a></li>
+ </ul>
+ </div>
+HEAD
+ end
+end