From 1f066293d7bdd11f2c112f94e327259684d774c8 Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Thu, 26 Nov 2009 13:04:54 +0100 Subject: implemented choose-css --- html.rb | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'html.rb') 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 #{@title} HEAD + + @css = [@css[0]] + @css[1..-1].sort @css.each{|title,href| - ret += "" - ret += "" if title == "print" + ret += "\n" + ret += "\n" if title == "print" } @atom.each{|href| - ret += "" + ret += "\n" } ret += "" 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 -- cgit v1.2.3