aboutsummaryrefslogtreecommitdiff
path: root/html.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-26 13:04:54 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-11-26 13:04:54 +0100
commit1f066293d7bdd11f2c112f94e327259684d774c8 (patch)
tree99837c729673d37e4f6e94e87cb7e0c0dead1d1a /html.rb
parent8e19920f0b25a388f9b976f8ecf4b0eaeaa1d4a4 (diff)
implemented choose-css
Diffstat (limited to 'html.rb')
-rw-r--r--html.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/html.rb b/html.rb
index 3d55b37..e682f21 100644
--- a/html.rb
+++ b/html.rb
@@ -27,7 +27,7 @@ class HTML
@header["charset"] = "utf-8"
@body = ""
- @css = {}
+ @css = []
@atom = []
end
def head
@@ -37,21 +37,26 @@ class HTML
<meta http-equiv="Content-Style-Type" content="text/css" />
<title>#{@title}</title>
HEAD
+
+ @css = [@css[0]] + @css[1..-1].sort
@css.each{|title,href|
- ret += "<link rel='stylesheet' type='text/css' href='#{href}' title='#{title}'/>"
- ret += "<link rel='stylesheet' type='text/css' href='#{href}' title='print' media='print' />" if title == "print"
+ ret += "<link rel='stylesheet' type='text/css' href='#{href}' title='#{title}'/>\n"
+ ret += "<link rel='stylesheet' type='text/css' href='#{href}' title='print' media='print' />\n" if title == "print"
}
@atom.each{|href|
- ret += "<link rel='alternate' type='application/atom+xml' href='#{href}' />"
+ ret += "<link rel='alternate' type='application/atom+xml' href='#{href}' />\n"
}
ret += "</head>"
ret
end
- def add_css(href, title = "default")
- @css[title] ||= []
- @css[title] << href
+ def add_css(href, title, default = false)
+ if default
+ @css.unshift([title,href])
+ else
+ @css << [title,href]
+ end
end
def add_atom(href)
@atom << href