Haml code!
\n" +# +# == Characters with meaning to Haml +# +# Various characters, when placed at a certain point in a line, +# instruct Haml to render different types of things. +# +# === XHTML Tags +# +# These characters render XHTML tags. +# +# ==== % +# +# +# The percent character is placed at the beginning of a line. +# It's followed immediately by the name of an element, +# then optionally by modifiers (see below), a space, +# and text to be rendered inside the element. +# It creates an element in the form ofThe magical fruit
+#hello
+# +# === XHTML Helpers +# +# ==== No Special Character +# +# If no special character appears at the beginning of a line, +# the line is rendered as plain text. +# For example: +# +# %gee +# %whiz +# Wow this is cool! +# +# is compiled to: +# +#Sign my guestbook
+# +# +# +# You can also specify the version and type of XHTML after the !!!. +# XHTML 1.0 Strict, Transitional, and Frameset and XHTML 1.1 are supported. +# The default version is 1.0 and the default type is Transitional. +# For example: +# +# !!! 1.1 +# +# is compiled to: +# +# +# +# and +# +# !!! Strict +# +# is compiled to: +# +# +# +# If you're not using the UTF-8 character set for your document, +# you can specify which encoding should appear +# in the XML prolog in a similar way. +# For example: +# +# !!! XML iso-8859-1 +# +# is compiled to: +# +# +# +# ==== / +# +# The forward slash character, when placed at the beginning of a line, +# wraps all text after it in an HTML comment. +# For example: +# +# %peanutbutterjelly +# / This is the peanutbutterjelly element +# I like sandwiches! +# +# is compiled to: +# +#+#
Hello, World
+# +# +# Haml has the following filters defined: +# +# [plain] Does not parse the filtered text. +# This is useful for large blocks of text without HTML tags, +# when you don't want lines starting with . or - +# to be parsed. +# +# [ruby] Parses the filtered text with the normal Ruby interpreter. +# All output sent to $stdout, like with +puts+, +# is output into the Haml document. +# Not available if the suppress_eval option is set to true. +# +# [preserve] Inserts the filtered text into the template with whitespace preserved. +# preserved blocks of text aren't indented, +# and newlines are replaced with the HTML escape code for newlines, +# to preserve nice-looking output. +# +# [erb] Parses the filtered text with ERB, like an RHTML template. +# Not available if the suppress_eval option is set to true. +# At the moment, this doesn't support access to variables +# defined by Ruby on Rails or Haml code. +# +# [sass] Parses the filtered text with Sass to produce CSS output. +# +# [redcloth] Parses the filtered text with RedCloth (http://whytheluckystiff.net/ruby/redcloth), +# which uses both Textile and Markdown syntax. +# Only works if RedCloth is installed. +# +# [textile] Parses the filtered text with Textile (http://www.textism.com/tools/textile). +# Only works if RedCloth is installed. +# +# [markdown] Parses the filtered text with Markdown (http://daringfireball.net/projects/markdown). +# Only works if RedCloth or BlueCloth (http://www.deveiate.org/projects/BlueCloth) +# is installed +# (BlueCloth takes precedence if both are installed). +# +# You can also define your own filters (see Setting Options, below). +# +# === Ruby evaluators +# +# ==== = +# +# The equals character is followed by Ruby code, +# which is evaluated and the output inserted into the document as plain text. +# For example: +# +# %p +# = ['hi', 'there', 'reader!'].join " " +# = "yo" +# +# is compiled to: +# +#+# hi there reader! +# yo +#
+# +# You can also use two equal signs, ==, +# along with conventional Ruby string-embedding syntax +# to easily embed Ruby code in otherwise static text. +# For example: +# +# %p +# == 1 + 1 = #{1 + 1} +# +# is compiled to: +# +#+# 1 + 1 = 2 +#
+# +# ==== - +# +# The hyphen character makes the text following it into "silent script": +# Ruby script that is evaluated, but not output. +# +# It is not recommended that you use this widely; +# almost all processing code and logic should be restricted +# to the Controller, the Helper, or partials. +# +# For example: +# +# - foo = "hello" +# - foo << " there" +# - foo << " you!" +# %p= foo +# +# is compiled to: +# +#+# hello there you! +#
+# +# ===== Blocks +# +# Ruby blocks, like XHTML tags, don't need to be explicitly closed in Haml. +# Rather, they're automatically closed, based on indentation. +# A block begins whenever the indentation is increased +# after a silent script command. +# It ends when the indentation decreases +# (as long as it's not an +else+ clause or something similar). +# For example: +# +# - (42...47).each do |i| +# %p= i +# %p See, I can count! +# +# is compiled to: +# +#+# 42 +#
+#+# 43 +#
+#+# 44 +#
+#+# 45 +#
+#+# 46 +#
+# +# Another example: +# +# %p +# - case 2 +# - when 1 +# = "1!" +# - when 2 +# = "2?" +# - when 3 +# = "3." +# +# is compiled to: +# +#+# 2? +#
+# +# ==== -# +# +# The hyphen followed immediately by the pound sign +# signifies a silent comment. +# Any text following this isn't rendered in the resulting document +# at all. +# +# For example: +# +# %p foo +# -# This is a comment +# %p bar +# +# is compiled to: +# +#foo
+#bar
+# +# == Other Useful Things +# +# === Helpers +# +# Haml offers a bunch of helpers that are useful +# for doing stuff like preserving whitespace, +# creating nicely indented output for user-defined helpers, +# and other useful things. +# The helpers are all documented in the Haml::Helpers and Haml::Helpers::ActionViewExtensions modules. +# +# === Haml Options +# +# Options can be set by setting the hash Haml::Template.options +# from environment.rb in Rails, +# or by passing an options hash to Haml::Engine. +# Available options are: +# +# [:suppress_eval] Whether or not attribute hashes and Ruby scripts +# designated by = or ~ should be +# evaluated. If this is true, said scripts are +# rendered as empty strings. Defaults to false. +# +# [:attr_wrapper] The character that should wrap element attributes. +# This defaults to ' (an apostrophe). Characters +# of this type within the attributes will be escaped +# (e.g. by replacing them with ') if +# the character is an apostrophe or a quotation mark. +# +# [:filename] The name of the Haml file being parsed. +# This is only used as information when exceptions are raised. +# This is automatically assigned when working through ActionView, +# so it's really only useful for the user to assign +# when dealing with Haml programatically. +# +# [:filters] A hash of filters that can be applied to Haml code. +# The keys are the string names of the filters; +# the values are references to the classes of the filters. +# User-defined filters should always have lowercase keys, +# and should have: +# * An +initialize+ method that accepts one parameter, +# the text to be filtered. +# * A +render+ method that returns the result of the filtering. +# +# [:locals] The local variables that will be available within the +# template. For instance, if :locals is +# { :foo => "bar" }, then within the template, +# = foo will produce bar. +# +# [:autoclose] A list of tag names that should be automatically self-closed +# if they have no content. +# Defaults to ['meta', 'img', 'link', 'script', 'br', 'hr']. +# +module Haml; end + +require 'haml/engine' diff --git a/vendor/gems/haml-1.7.2/lib/haml/buffer.rb b/vendor/gems/haml-1.7.2/lib/haml/buffer.rb new file mode 100644 index 0000000..ca7674f --- /dev/null +++ b/vendor/gems/haml-1.7.2/lib/haml/buffer.rb @@ -0,0 +1,213 @@ +module Haml + # This class is used only internally. It holds the buffer of XHTML that + # is eventually output by Haml::Engine's to_html method. It's called + # from within the precompiled code, and helps reduce the amount of + # processing done within instance_eval'd code. + class Buffer + include Haml::Helpers + + # Set the maximum length for a line to be considered a one-liner. + # Lines <= the maximum will be rendered on one line, + # i.e.Hello world
+ ONE_LINER_LENGTH = 50 + + # The string that holds the compiled XHTML. This is aliased as + # _erbout for compatibility with ERB-specific code. + attr_accessor :buffer + + # Gets the current tabulation of the document. + def tabulation + @real_tabs + @tabulation + end + + # Sets the current tabulation of the document. + def tabulation=(val) + val = val - @real_tabs + @tabulation = val > -1 ? val : 0 + end + + # Creates a new buffer. + def initialize(options = {}) + @options = options + @quote_escape = options[:attr_wrapper] == '"' ? """ : "'" + @other_quote_char = options[:attr_wrapper] == '"' ? "'" : '"' + @buffer = "" + @one_liner_pending = false + @tabulation = 0 + + # The number of tabs that Engine thinks we should have + # @real_tabs + @tabulation is the number of tabs actually output + @real_tabs = 0 + end + + # Renders +text+ with the proper tabulation. This also deals with + # making a possible one-line tag one line or not. + def push_text(text, tabulation) + if @one_liner_pending && Buffer.one_liner?(text) + @buffer << text + else + if @one_liner_pending + @buffer << "\n" + @one_liner_pending = false + end + @buffer << "#{tabs(tabulation)}#{text}\n" + end + end + + # Properly formats the output of a script that was run in the + # instance_eval. + def push_script(result, tabulation, flattened) + if flattened + result = Haml::Helpers.find_and_preserve(result) + end + + result = result.to_s + while result[-1] == 10 # \n + # String#chomp is slow + result = result[0...-1] + end + + result = result.gsub("\n", "\n#{tabs(tabulation)}") + push_text result, tabulation + nil + end + + + def open_prerendered_tag(tag, tabulation) + @buffer << "#{tabs(tabulation)}#{tag}" + @real_tabs += 1 + end + + # Takes the various information about the opening tag for an + # element, formats it, and adds it to the buffer. + def open_tag(name, tabulation, atomic, try_one_line, class_id, obj_ref, attributes_hash) + attributes = class_id + if attributes_hash + attributes_hash.keys.each { |key| attributes_hash[key.to_s] = attributes_hash.delete(key) } + self.class.merge_attrs(attributes, attributes_hash) + end + self.class.merge_attrs(attributes, parse_object_ref(obj_ref)) if obj_ref + + @one_liner_pending = false + if atomic + str = " />\n" + elsif try_one_line + @one_liner_pending = true + str = ">" + else + str = ">\n" + end + @buffer << "#{tabs(tabulation)}<#{name}#{build_attributes(attributes)}#{str}" + @real_tabs += 1 + end + + def self.merge_attrs(to, from) + if to['id'] && from['id'] + to['id'] << '_' << from.delete('id') + end + + if to['class'] && from['class'] + # Make sure we don't duplicate class names + from['class'] = (from['class'].split(' ') | to['class'].split(' ')).join(' ') + end + + to.merge!(from) + end + + # Creates a closing tag with the given name. + def close_tag(name, tabulation) + if @one_liner_pending + @buffer << "#{name}>\n" + @one_liner_pending = false + else + push_text("#{name}>", tabulation) + end + end + + # Opens an XHTML comment. + def open_comment(try_one_line, conditional, tabulation) + conditional << ">" if conditional + @buffer << "#{tabs(tabulation)}" : "-->" + if @one_liner_pending + @buffer << " #{close_tag}\n" + @one_liner_pending = false + else + push_text(close_tag, tabulation) + end + end + + # Some of these methods are exposed as public class methods + # so they can be re-used in helpers. + + # Takes a hash and builds a list of XHTML attributes from it, returning + # the result. + def build_attributes(attributes = {}) + result = attributes.collect do |a,v| + v = v.to_s + unless v.nil? || v.empty? + attr_wrapper = @options[:attr_wrapper] + if v.include? attr_wrapper + if v.include? @other_quote_char + v = v.gsub(attr_wrapper, @quote_escape) + else + attr_wrapper = @other_quote_char + end + end + " #{a}=#{attr_wrapper}#{v}#{attr_wrapper}" + end + end + result.compact.sort.join + end + + # Returns whether or not the given value is short enough to be rendered + # on one line. + def self.one_liner?(value) + value.length <= ONE_LINER_LENGTH && value.scan(/\n/).empty? + end + + private + + @@tab_cache = {} + # Gets count tabs. Mostly for internal use. + def tabs(count) + @real_tabs = count + tabs = count + @tabulation + ' ' * tabs + @@tab_cache[tabs] ||= ' ' * tabs + end + + # Takes an array of objects and uses the class and id of the first + # one to create an attributes hash. + def parse_object_ref(ref) + ref = ref[0] + # Let's make sure the value isn't nil. If it is, return the default Hash. + return {} if ref.nil? + class_name = underscore(ref.class) + id = "#{class_name}_#{ref.id || 'new'}" + + {'id' => id, 'class' => class_name} + end + + # Changes a word from camel case to underscores. + # Based on the method of the same name in Rails' Inflector, + # but copied here so it'll run properly without Rails. + def underscore(camel_cased_word) + camel_cased_word.to_s.gsub(/::/, '_'). + gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). + gsub(/([a-z\d])([A-Z])/,'\1_\2'). + tr("-", "_"). + downcase + end + end +end diff --git a/vendor/gems/haml-1.7.2/lib/haml/engine.rb b/vendor/gems/haml-1.7.2/lib/haml/engine.rb new file mode 100644 index 0000000..32d2e42 --- /dev/null +++ b/vendor/gems/haml-1.7.2/lib/haml/engine.rb @@ -0,0 +1,876 @@ +require 'haml/helpers' +require 'haml/buffer' +require 'haml/filters' +require 'haml/error' +require 'haml/util' + +module Haml + # This is the class where all the parsing and processing of the Haml + # template is done. It can be directly used by the user by creating a + # new instance and calling to_html to render the template. For example: + # + # template = File.read('templates/really_cool_template.haml') + # haml_engine = Haml::Engine.new(template) + # output = haml_engine.to_html + # puts output + class Engine + # Allow reading and writing of the options hash + attr :options, true + + # Designates an XHTML/XML element. + ELEMENT = ?% + + # Designates aAll the stuff
+ #A book about all the stuff.
+ #bar
+ # baz + # + def tab_up(i = 1) + buffer.tabulation += i + end + + # Increments the number of tabs the buffer automatically adds + # to the lines of the template. + # + # See tab_up. + def tab_down(i = 1) + buffer.tabulation -= i + end + + # Surrounds the given block of Haml code with the given characters, + # with no whitespace in between. + # For example: + # + # = surround '(', ')' do + # %a{:href => "food"} chicken + # + # Produces: + # + # (chicken) + # + # and + # + # = surround '*' do + # %strong angry + # + # Produces: + # + # *angry* + # + def surround(front, back = nil, &block) + back ||= front + output = capture_haml(&block) + + "#{front}#{output.chomp}#{back}\n" + end + + # Prepends the given character to the beginning of the Haml block, + # with no whitespace between. + # For example: + # + # = precede '*' do + # %span.small Not really + # + # Produces: + # + # *Not really + # + def precede(char, &block) + "#{char}#{capture_haml(&block).chomp}\n" + end + + # Appends the given character to the end of the Haml block, + # with no whitespace between. + # For example: + # + # click + # = succeed '.' do + # %a{:href=>"thing"} here + # + # Produces: + # + # click + # here. + # + def succeed(char, &block) + "#{capture_haml(&block).chomp}#{char}\n" + end + + # Captures the result of the given block of Haml code, + # gets rid of the excess indentation, + # and returns it as a string. + # For example, after the following, + # + # .foo + # - foo = capture_haml(13) do |a| + # %p= a + # + # the local variable foo would be assigned to "13
\n". + # + def capture_haml(*args, &block) + capture_haml_with_buffer(buffer.buffer, *args, &block) + end + + # Outputs text directly to the Haml buffer, with the proper tabulation + def puts(text = "") + buffer.buffer << (' ' * buffer.tabulation) << text.to_s << "\n" + nil + end + + # + # call-seq: + # open(name, attributes = {}) {...} + # open(name, text, attributes = {}) {...} + # + # Creates an HTML tag with the given name and optionally text and attributes. + # Can take a block that will be executed + # between when the opening and closing tags are output. + # If the block is a Haml block or outputs text using puts, + # the text will be properly indented. + # + # For example, + # + # open :table do + # open :tr do + # open :td, {:class => 'cell'} do + # open :strong, "strong!" + # puts "data" + # end + # open :td do + # puts "more_data" + # end + # end + # end + # + # outputs + # + #+ # + # strong! + # + # data + # | + #+ # more_data + # | + #
foo
", render("%p{:class => 1+2} foo").chomp) + end + + def test_nil_should_render_empty_tag + assert_equal("Hello
", render('%p Hello').chomp) + end + + def test_long_liner_should_not_print_on_one_line + assert_equal("Hello World
\n", render('%p== Hello #{who}', :locals => {:who => 'World'})) + assert_equal("\n Hello World\n
\n", render("%p\n == Hello \#{who}", :locals => {:who => 'World'})) + end + + def test_nil_tag_value_should_render_as_empty + assert_equal("\n", render("%p= nil")) + end + + def test_tag_with_failed_if_should_render_as_empty + assert_equal("\n", render("%p= 'Hello' if false")) + end + + # Options tests + + def test_stop_eval + assert_equal("", render("= 'Hello'", :suppress_eval => true)) + assert_equal("", render("- puts 'foo'", :suppress_eval => true)) + assert_equal("\n", render("#foo{:yes => 'no'}/", :suppress_eval => true)) + assert_equal("\n", render("#foo{:yes => 'no', :call => a_function() }/", :suppress_eval => true)) + assert_equal("\n", render("%div[1]/", :suppress_eval => true)) + + begin + assert_equal("", render(":ruby\n puts 'hello'", :suppress_eval => true)) + rescue Haml::HamlError => err + caught = true + assert_equal('Filter "ruby" is not defined!', err.message) + end + assert(caught, "Rendering a ruby filter without evaluating didn't throw an error!") + end + + def test_attr_wrapper + assert_equal("\n
\n", render("%p{ :strange => 'attrs'}", :attr_wrapper => '*')) + assert_equal("\n
\n", render("%p{ :escaped => 'quo\"te'}", :attr_wrapper => '"')) + assert_equal("\n
\n", render("%p{ :escaped => 'q\\'uo\"te'}", :attr_wrapper => '"')) + assert_equal("\n", render("!!! XML", :attr_wrapper => '"')) + end + + def test_attrs_parsed_correctly + assert_equal("biddly='bar => baz'>\n
\n", render("%p{'boom=>biddly' => 'bar => baz'}")) + assert_equal("\n
\n", render("%p{'foo,bar' => 'baz, qux'}")) + assert_equal("\n
\n", render("%p{ :escaped => \"quo\\nte\"}")) + assert_equal("\n
\n", render("%p{ :escaped => \"quo\#{2 + 2}te\"}")) + end + + def test_locals + assert_equal("Paragraph!
\n", render("%p= text", :locals => { :text => "Paragraph!" })) + end + + def test_recompile_with_new_locals + template = "%p= (text == 'first time') ? text : new_text" + assert_equal("first time
\n", render(template, :locals => { :text => "first time" })) + assert_equal("second time
\n", render(template, :locals => { :text => "recompile", :new_text => "second time" })) + + # Make sure the method called will return junk unless recompiled + method_name = Haml::Engine.send(:class_variable_get, '@@method_names')[template] + Haml::Engine::CompiledTemplates.module_eval "def #{method_name}(stuff); @haml_stack[-1].push_text 'NOT RECOMPILED', 0; end" + + assert_equal("NOT RECOMPILED\n", render(template, :locals => { :text => "first time" })) + assert_equal("first time
\n", render(template, :locals => { :text => "first time", :foo => 'bar' })) + end + + def test_dynamc_attrs_shouldnt_register_as_literal_values + assert_equal("\n
\n", render('%p{:a => "b#{1 + 1}c"}')) + assert_equal("\n
\n", render("%p{:a => 'b' + (1 + 1).to_s + 'c'}")) + end + + def test_rec_merge + hash1 = {1=>2, 3=>{5=>7, 8=>9}} + hash2 = {4=>5, 3=>{5=>2, 16=>12}} + hash3 = {1=>2, 4=>5, 3=>{5=>2, 8=>9, 16=>12}} + + hash1.rec_merge!(hash2) + assert_equal(hash3, hash1) + end + + def test_exception_type + begin + render("%p hi\n= undefined") + rescue Exception => e + assert(e.is_a?(Haml::Error)) + assert_equal(2, e.haml_line) + assert_equal(nil, e.haml_filename) + assert_equal('(haml):2', e.backtrace[0]) + else + # Test failed... should have raised an exception + assert(false) + end + end + + def test_syntax_errors + errs = [ "!!!\n a", "a\n b", "a\n:foo\nb", "/ a\n b", + "% a", "%p a\n b", "a\n%p=\nb", "%p=\n a", + "a\n%p~\nb", "a\n~\nb", "a\n~\n b", "%p~\n b", "%p/\n a", + "%p\n \t%a b", "%a\n b\nc", "%a\n b\nc", + ":notafilter\n This isn't\n a filter!", + ".{} a", "\#{} a", ".= 'foo'", "%a/ b", "%p..class", "%p..#." ] + errs.each do |err| + begin + render(err) + rescue Exception => e + assert(e.is_a?(Haml::Error), + "#{err.dump} doesn't produce Haml::SyntaxError!") + else + assert(false, + "#{err.dump} doesn't produce an exception!") + end + end + end + + def test_compile_error + begin + render("a\nb\n- fee do\nc") + rescue Exception => e + assert_equal(3, e.haml_line) + else + assert(false, + '"a\nb\n- fee do\nc" doesn\'t produce an exception!') + end + end + + def test_no_bluecloth + old_markdown = false + if defined?(Haml::Filters::Markdown) + old_markdown = Haml::Filters::Markdown + end + + Kernel.module_eval do + alias_method :haml_old_require, :gem_original_require + + def gem_original_require(file) + raise LoadError if file == 'bluecloth' + haml_old_require(file) + end + end + + if old_markdown + Haml::Filters.instance_eval do + remove_const 'Markdown' + end + end + + # This is purposefully redundant, so it doesn't stop + # haml/filters from being required later on. + require 'haml/../haml/filters' + + assert_equal("- a\n- b
\n", + Haml::Engine.new(":markdown\n Foo\n ===\n - a\n - b").to_html) + + Haml::Filters.instance_eval do + remove_const 'Markdown' + end + + Haml::Filters.const_set('Markdown', old_markdown) if old_markdown + + Kernel.module_eval do + alias_method :gem_original_require, :haml_old_require + end + + NOT_LOADED.delete 'bluecloth' + end + + def test_no_redcloth + Kernel.module_eval do + alias_method :haml_old_require2, :gem_original_require + + def gem_original_require(file) + raise LoadError if file == 'redcloth' + haml_old_require2(file) + end + end + + # This is purposefully redundant, so it doesn't stop + # haml/filters from being required later on. + require 'haml/../haml/../haml/filters' + + begin + Haml::Engine.new(":redcloth\n _foo_").to_html + rescue Haml::HamlError + else + assert(false, "No exception raised!") + end + + Kernel.module_eval do + alias_method :gem_original_require2, :haml_old_require + end + + NOT_LOADED.delete 'redcloth' + end + + def test_local_assigns_dont_modify_class + assert_equal("bar\n", render("= foo", :locals => {:foo => 'bar'})) + assert_equal(nil, defined?(foo)) + end + + def test_object_ref_with_nil_id + user = Struct.new('User', :id).new + assert_equal("New User
\n", + render("%p[user] New User", :locals => {:user => user})) + end +end diff --git a/vendor/gems/haml-1.7.2/test/haml/helper_test.rb b/vendor/gems/haml-1.7.2/test/haml/helper_test.rb new file mode 100644 index 0000000..f0f30d4 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/haml/helper_test.rb @@ -0,0 +1,123 @@ +#!/usr/bin/env ruby + +require 'rubygems' +require 'active_support' +require 'action_controller' +require 'action_view' + +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/haml' +require 'haml/template' + +class HelperTest < Test::Unit::TestCase + include Haml::Helpers + + def setup + ActionView::Base.register_template_handler("haml", Haml::Template) + @base = ActionView::Base.new + @base.controller = ActionController::Base.new + end + + def render(text, options = {}) + if options == :action_view + @base.render :inline => text, :type => :haml + else + scope = options.delete :scope_object + Haml::Engine.new(text, options).to_html(scope ? scope : Object.new) + end + end + + def test_flatten + assert_equal(flatten("FooBar"), "FooBar") + + assert_equal(flatten("Foo\rBar"), "FooBar") + + assert_equal(flatten("Foo\nBar"), "Foo Bar") + + assert_equal(flatten("Hello\nWorld!\nYOU ARE \rFLAT?\n\rOMGZ!"), + "Hello World! YOU ARE FLAT? OMGZ!") + end + + def test_list_of_should_render_correctly + assert_equal("A word!
\nA word!
\nA word!
\nA word!
\n13
\\n\"\n", render("- foo = capture_haml(13) do |a|\n %p= a\n= foo.dump")) + end + + def test_is_haml + assert(!ActionView::Base.new.is_haml?) + assert_equal("true\n", render("= is_haml?")) + assert_equal("true\n", render("= is_haml?", :action_view)) + assert_equal("false", @base.render(:inline => '<%= is_haml? %>')) + assert_equal("false\n", render("= render :inline => '<%= is_haml? %>'", :action_view)) + end + + def test_page_class + controller = Struct.new(:controller_name, :action_name).new('troller', 'tion') + scope = Struct.new(:controller).new(controller) + result = render("%div{:class => page_class} MyDiv", :scope_object => scope) + expected = "All
+This
+ Should render +This is preformatted!
+Look at that!
+Wowie-zowie!
+
+
+ boldilicious!
+pretty much the same as above
+This + Is + Plain + Text + %strong right? + + a + + b + + c + + d + + e + + f + + g + + h + + i + + j +Title
++ Woah this is really crazy + I mean wow, + man. +
+Title
++ Woah this is really crazy + I mean wow, + man. +
+Title
++ Woah this is really crazy + I mean wow, + man. +
+foo
++ reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong +
+Small
+ +foo
+baz
+boom
+foo ++
+ ++ foo +
+ + strong! + + data + | ++ more_data + | +
+ Escape + - character + %p foo + yee\ha +
+ + + +class attribute shouldn't appear!
+ + + +testtest +Blah
+Blump
+Woah inner quotes ++
+ diff --git a/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml new file mode 100644 index 0000000..b8ef0b0 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/haml/results/list.xhtml @@ -0,0 +1,12 @@ +! Not a Doctype ! ++ Lorem ipsum dolor sit amet, consectetur adipisicing elit +
+Cigarettes!
++ This is some text that's in a pre block! + Let's see what happens when it's rendered! What about now, since we're on a new line? ++
+ @foo = + value one +
++ @foo = + value two +
++ @foo = + value two +
++ @foo = + value three +
++ @foo = + value three +
diff --git a/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml b/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml new file mode 100644 index 0000000..76e90e0 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/haml/results/silent_script.xhtml @@ -0,0 +1,74 @@ ++ "false" is: + false +
+ Even! + Odd! + Even! + Odd! + Even! +boom
++ Holy cow multiline tags! A pipe (|) even! + PipesIgnored|PipesIgnored|PipesIgnored| + 1|2|3 +
+foo bar+
foo bar+
foo bar+
+ foo + bar +
+foo bar+
foo bar+
foo bar+
+ foo + bar +
++ ___ ,o88888 ,o8888888' ,:o:o:oooo. ,8O88Pd8888" ,.::.::o:ooooOoOoO. ,oO8O8Pd888'" ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O" , ..:.::o:ooOoOOOO8OOOOo.FdO8O8" , ..:.::o:ooOoOO8O888O8O,COCOO" , . ..:.::o:ooOoOOOO8OOOOCOCO" . ..:.::o:ooOoOoOO8O8OCCCC"o . ..:.::o:ooooOoCoCCC"o:o . ..:.::o:o:,cooooCo"oo:o: ` . . ..:.:cocoooo"'o:o:::' .` . ..::ccccoc"'o:o:o:::' :.:. ,c:cccc"':.:.:.:.:.' ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/ ...:.'.:.::::"' . . . . .' .. . ....:."' ` . . . '' . . . ...."' .. . ."' -hrr- . It's a planet! %strong This shouldn't be bold! ++ This should! + +
+ __ ______ __ ______ .----.| |--.|__ |.----.| |--..--------.| __ | | __|| ||__ || __|| < | || __ | |____||__|__||______||____||__|__||__|__|__||______| ++
+foo + bar +diff --git a/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml b/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml new file mode 100644 index 0000000..ce1fcee --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/haml/rhtml/standard.rhtml @@ -0,0 +1,55 @@ + + + +
+ <%= "Holy cow " + + "multiline " + + "tags! " + + "A pipe (|) even!" %> + <%= [1, 2, 3].collect { |n| "PipesIgnored|" } %> + <%= [1, 2, 3].collect { |n| + n.to_s + }.join("|") %> +
+something
", render("%p= @content_for_layout").chomp) + + @base.instance_eval("@author = 'Hampton Catlin'") + assert_equal(" ", render(".author= @author").chomp) + + @base.instance_eval("@author = 'Hampton'") + assert_equal("Hampton", render("= @author").chomp) + + @base.instance_eval("@author = 'Catlin'") + assert_equal("Catlin", render("= @author").chomp) + end + + def test_instance_variables_should_work_inside_attributes + @base.instance_eval("@author = 'hcatlin'") + assert_equal("foo
", render("%p{:class => @author} foo").chomp) + end + + def test_template_renders_should_eval + assert_equal("2\n", render("= 1+1")) + end + + def test_rhtml_still_renders + # Make sure it renders normally + res = @base.render("../rhtml/standard") + assert !(res.nil? || res.empty?) + + # Register Haml stuff in @base... + @base.render("standard") + + # Does it still render? + res = @base.render("../rhtml/standard") + assert !(res.nil? || res.empty?) + end + + def test_haml_options + Haml::Template.options = { :suppress_eval => true } + assert_equal({ :suppress_eval => true }, Haml::Template.options) + assert_renders_correctly("eval_suppressed") + Haml::Template.options = {} + end + + def test_exceptions_should_work_correctly + begin + Haml::Template.new(@base).render(File.dirname(__FILE__) + '/templates/breakage.haml') + rescue Exception => e + assert_equal("./test/haml/templates/breakage.haml:4", e.backtrace[0]) + else + assert false + end + + begin + render("- raise 'oops!'") + rescue Exception => e + assert_equal("(haml):1", e.backtrace[0]) + else + assert false + end + + template = <foo bar" + ~ "
foo\nbar" + %p~ "
foo\nbar" + %p~ "foo\nbar" +.foo + ~ 13 + ~ ['a', 'b', 'c'].map do |a| + - "" +#whitespace_test + = render :file => "_text_area.haml", :locals => { :value => "Oneline" } + = render :file => "_text_area.haml", :locals => { :value => "Two\nlines" } + = find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Oneline" }) + = find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Two\nlines" }) + #flattened= find_and_preserve render(:file => "_text_area.haml", :locals => { :value => "Two\nlines" }) +.hithere + = find_and_preserve("Foo bar") + = find_and_preserve("
foo bar") + = find_and_preserve("
foo\nbar") + %p= find_and_preserve("
foo\nbar") + %p= find_and_preserve("foo\nbar") + %pre + :preserve + ___ + ,o88888 + ,o8888888' + ,:o:o:oooo. ,8O88Pd8888" + ,.::.::o:ooooOoOoO. ,oO8O8Pd888'" + ,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O" + , ..:.::o:ooOoOOOO8OOOOo.FdO8O8" + , ..:.::o:ooOoOO8O888O8O,COCOO" + , . ..:.::o:ooOoOOOO8OOOOCOCO" + . ..:.::o:ooOoOoOO8O8OCCCC"o + . ..:.::o:ooooOoCoCCC"o:o + . ..:.::o:o:,cooooCo"oo:o: + ` . . ..:.:cocoooo"'o:o:::' + .` . ..::ccccoc"'o:o:o:::' + :.:. ,c:cccc"':.:.:.:.:.' + ..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/ + ...:.'.:.::::"' . . . . .' + .. . ....:."' ` . . . '' + . . . ...."' + .. . ."' -hrr- + . + + + It's a planet! + %strong This shouldn't be bold! + %strong This should! + %textarea + :preserve + ___ ___ ___ ___ + /\__\ /\ \ /\__\ /\__\ + /:/ / /::\ \ /::| | /:/ / + /:/__/ /:/\:\ \ /:|:| | /:/ / + /::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ / + /:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/ + \/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \ + \::/ / \::/ / /:/ / \:\ \ + /:/ / /:/ / /:/ / \:\ \ + /:/ / /:/ / /:/ / \:\__\ + \/__/ \/__/ \/__/ \/__/ + + Many + thanks + to + http://www.network-science.de/ascii/ + %strong indeed! +.foo + = find_and_preserve(13) +%pre + :preserve + __ ______ __ ______ + .----.| |--.|__ |.----.| |--..--------.| __ | + | __|| ||__ || __|| < | || __ | + |____||__|__||______||____||__|__||__|__|__||______| +%pre + :preserve + foo + bar diff --git a/vendor/gems/haml-1.7.2/test/profile.rb b/vendor/gems/haml-1.7.2/test/profile.rb new file mode 100644 index 0000000..62969e9 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/profile.rb @@ -0,0 +1,65 @@ +require 'rubygems' +require 'active_support' +require 'action_controller' +require 'action_view' + +require File.dirname(__FILE__) + '/../lib/haml' +require 'haml/template' +require 'profiler' +require 'stringio' + +module Haml + # Used by both Haml::Profiler and Sass::Profiler. + # Encapsulates profiling behavior. + module AbstractProfiler + def self.profile(times, &block) + # Runs the profiler, collects information + Profiler__::start_profile + times.times &block + Profiler__::stop_profile + + # Outputs information to a StringIO, returns result + io = StringIO.new + Profiler__::print_profile(io) + io.pos = 0 + result = io.read + io.close + result + end + end + + # A profiler for Haml, mostly for development use. This simply implements + # the Ruby profiler for profiling haml code. + class Profiler + + # Creates a new profiler that looks for templates in the base + # directory. + def initialize(base = File.join(File.dirname(__FILE__), 'haml', 'templates')) + ActionView::Base.register_template_handler("haml", Haml::Template) + unless base.class == ActionView::Base + @base = ActionView::Base.new(base) + else + @base = base + end + end + + # Profiles haml on the given template with the given number of runs. + # The template name shouldn't have a file extension; this will + # automatically look for a haml template. + # + # Returns the results of the profiling as a string. + def profile(runs = 100, template_name = 'standard') + AbstractProfiler.profile(runs) { @base.render template_name } + end + end +end + +module Sass + class Profiler + def profile(runs = 100, template_name = 'complex') + Haml::AbstractProfiler.profile(runs) do + Sass::Engine.new("#{File.dirname(__FILE__)}/sass/templates/#{template_name}.sass").render + end + end + end +end diff --git a/vendor/gems/haml-1.7.2/test/sass/engine_test.rb b/vendor/gems/haml-1.7.2/test/sass/engine_test.rb new file mode 100644 index 0000000..74d3ceb --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/engine_test.rb @@ -0,0 +1,116 @@ +#!/usr/bin/env ruby + +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/sass' +require 'sass/engine' + +class SassEngineTest < Test::Unit::TestCase + EXCEPTION_MAP = { + "!a = 1 + " => 'Constant arithmetic error: "1 +"', + "!a = 1 + 2 +" => 'Constant arithmetic error: "1 + 2 +"', + "!a = \"b" => 'Unterminated string: "\\"b"', + "!a = #aaa - a" => 'Undefined operation: "#aaaaaa minus a"', + "!a = #aaa / a" => 'Undefined operation: "#aaaaaa div a"', + "!a = #aaa * a" => 'Undefined operation: "#aaaaaa times a"', + "!a = #aaa % a" => 'Undefined operation: "#aaaaaa mod a"', + "!a = 1 - a" => 'Undefined operation: "1 minus a"', + "!a = 1 * a" => 'Undefined operation: "1 times a"', + "!a = 1 / a" => 'Undefined operation: "1 div a"', + "!a = 1 % a" => 'Undefined operation: "1 mod a"', + ":" => 'Invalid attribute: ":"', + ": a" => 'Invalid attribute: ": a"', + ":= a" => 'Invalid attribute: ":= a"', + "a\n :b" => 'Invalid attribute: ":b "', + "a\n :b: c" => 'Invalid attribute: ":b: c"', + "a\n :b:c d" => 'Invalid attribute: ":b:c d"', + "a\n :b=c d" => 'Invalid attribute: ":b=c d"', + "a\n :b c;" => 'Invalid attribute: ":b c;" (This isn\'t CSS!)', + "a\n b : c" => 'Invalid attribute: "b : c"', + "a\n b=c: d" => 'Invalid attribute: "b=c: d"', + ":a" => 'Attributes aren\'t allowed at the root of a document.', + "!" => 'Invalid constant: "!"', + "!a" => 'Invalid constant: "!a"', + "! a" => 'Invalid constant: "! a"', + "!a b" => 'Invalid constant: "!a b"', + "a\n\t:b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", + "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", + "a\n :b c" => "Illegal Indentation: Only two space characters are allowed as tabulation.", + "a\n :b c\n !d = 3" => "Constants may only be declared at the root of a document.", + "!a = 1b + 2c" => "Incompatible units: b and c", + "& a\n :b c" => "Base-level rules cannot contain the parent-selector-referencing character '&'", + "a\n :b\n c" => "Illegal nesting: Only attributes may be nested beneath attributes.", + "!a = b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath constants.", + "@import foo.sass" => "File to import not found or unreadable: foo.sass", + "@import templates/basic\n foo" => "Illegal nesting: Nothing may be nested beneath import directives.", + "foo\n @import templates/basic" => "Import directives may only be used at the root of a document.", + "@foo bar boom" => "Unknown compiler directive: \"@foo bar boom\"", + } + + def test_basic_render + renders_correctly "basic", { :style => :compact } + end + + def test_alternate_styles + renders_correctly "expanded", { :style => :expanded } + renders_correctly "compact", { :style => :compact } + renders_correctly "nested", { :style => :nested } + end + + def test_exceptions + EXCEPTION_MAP.each do |key, value| + begin + Sass::Engine.new(key).render + rescue Sass::SyntaxError => err + assert_equal(value, err.message) + assert(err.sass_line, "Line: #{key}") + assert_match(/\(sass\):[0-9]+/, err.backtrace[0], "Line: #{key}") + else + assert(false, "Exception not raised for\n#{key}") + end + end + end + + def test_exception_line + to_render = "rule\n :attr val\n// comment!\n\n :broken\n" + begin + Sass::Engine.new(to_render).render + rescue Sass::SyntaxError => err + assert_equal(5, err.sass_line) + else + assert(false, "Exception not raised for '#{to_render}'!") + end + end + + def test_imported_exception + [1, 2].each do |i| + i = nil if i == 1 + begin + Sass::Engine.new("@import bork#{i}", :load_paths => [File.dirname(__FILE__) + '/templates/']).render + rescue Sass::SyntaxError => err + assert_equal(2, err.sass_line) + assert_match(/bork#{i}\.sass$/, err.sass_filename) + else + assert(false, "Exception not raised for imported template: bork#{i}") + end + end + end + + def test_empty_first_line + assert_equal("#a {\n b: c; }\n", Sass::Engine.new("#a\n\n b: c").render) + end + + private + + def renders_correctly(name, options={}) + sass_file = load_file(name, "sass") + css_file = load_file(name, "css") + css_result = Sass::Engine.new(sass_file, options).render + assert_equal css_file, css_result + end + + def load_file(name, type = "sass") + @result = '' + File.new(File.dirname(__FILE__) + "/#{type == 'sass' ? 'templates' : 'results'}/#{name}.#{type}").each_line { |l| @result += l } + @result + end +end diff --git a/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb b/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb new file mode 100644 index 0000000..0239ead --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/plugin_test.rb @@ -0,0 +1,136 @@ +#!/usr/bin/env ruby + +MERB_ENV = RAILS_ENV = 'testing' +RAILS_ROOT = '.' + +require 'test/unit' +require 'fileutils' +require File.dirname(__FILE__) + '/../../lib/sass' +require 'rubygems' + +require 'action_controller' +require 'sass/plugin' + +class SassPluginTest < Test::Unit::TestCase + @@templates = %w{ + complex constants parent_ref import alt + subdir/subdir subdir/nested_subdir/nested_subdir + } + + def setup + FileUtils.mkdir File.dirname(__FILE__) + '/tmp' + set_plugin_opts + Sass::Plugin.update_stylesheets + end + + def teardown + FileUtils.rm_r File.dirname(__FILE__) + '/tmp' + end + + def test_templates_should_render_correctly + @@templates.each { |name| assert_renders_correctly(name) } + end + + def test_no_update + File.delete(tempfile_loc('basic')) + assert Sass::Plugin.stylesheet_needs_update?('basic') + Sass::Plugin.update_stylesheets + assert !Sass::Plugin.stylesheet_needs_update?('basic') + end + + def test_full_exception_handling + File.delete(tempfile_loc('bork')) + Sass::Plugin.update_stylesheets + File.open(tempfile_loc('bork')) do |file| + assert_equal("/*\nSass::SyntaxError: Undefined constant: \"!bork\"\non line 2 of #{File.dirname(__FILE__) + '/templates/bork.sass'}\n\n1: bork\n2: :bork= !bork", file.read.split("\n")[0...6].join("\n")) + end + File.delete(tempfile_loc('bork')) + end + + def test_nonfull_exception_handling + Sass::Plugin.options[:full_exception] = false + + File.delete(tempfile_loc('bork')) + Sass::Plugin.update_stylesheets + assert_equal("/* Internal stylesheet error */", File.read(tempfile_loc('bork'))) + File.delete(tempfile_loc('bork')) + + Sass::Plugin.options[:full_exception] = true + end + + def test_rails_update + File.delete(tempfile_loc('basic')) + assert Sass::Plugin.stylesheet_needs_update?('basic') + + ActionController::Base.new.process + + assert !Sass::Plugin.stylesheet_needs_update?('basic') + end + + def test_merb_update + begin + require 'merb' + rescue LoadError + puts "\nmerb couldn't be loaded, skipping a test" + return + end + + require 'sass/plugin/merb' + MerbHandler.send(:define_method, :process_without_sass) { |*args| } + set_plugin_opts + + File.delete(tempfile_loc('basic')) + assert Sass::Plugin.stylesheet_needs_update?('basic') + + MerbHandler.new('.').process nil, nil + + assert !Sass::Plugin.stylesheet_needs_update?('basic') + end + + + private + + def assert_renders_correctly(name) + File.read(result_loc(name)).split("\n").zip(File.read(tempfile_loc(name)).split("\n")).each_with_index do |pair, line| + message = "template: #{name}\nline: #{line + 1}" + assert_equal(pair.first, pair.last, message) + end + end + + def tempfile_loc(name) + File.dirname(__FILE__) + "/tmp/#{name}.css" + end + + def result_loc(name) + File.dirname(__FILE__) + "/results/#{name}.css" + end + + def set_plugin_opts + Sass::Plugin.options = { + :template_location => File.dirname(__FILE__) + '/templates', + :css_location => File.dirname(__FILE__) + '/tmp', + :style => :compact, + :load_paths => [File.dirname(__FILE__) + '/results'], + :always_update => true, + } + end +end + +module Sass::Plugin + class << self + public :stylesheet_needs_update? + end +end + +class Sass::Engine + alias_method :old_render, :render + + def render + raise "bork bork bork!" if @template[0] == "{bork now!}" + old_render + end +end + +class ActionController::Base + def sass_old_process(*args); end +end diff --git a/vendor/gems/haml-1.7.2/test/sass/results/alt.css b/vendor/gems/haml-1.7.2/test/sass/results/alt.css new file mode 100644 index 0000000..8484343 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/alt.css @@ -0,0 +1,4 @@ +h1 { float: left; width: 274px; height: 75px; margin: 0; background-repeat: no-repeat; background-image: none; } +h1 a:hover, h1 a:visited { color: green; } +h1 b:hover { color: red; background-color: green; } +h1 const { nosp: 3; sp: 3; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/basic.css b/vendor/gems/haml-1.7.2/test/sass/results/basic.css new file mode 100644 index 0000000..b0d1182 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/basic.css @@ -0,0 +1,9 @@ +body { font: Arial; background: blue; } + +#page { width: 700px; height: 100; } +#page #header { height: 300px; } +#page #header h1 { font-size: 50px; color: blue; } + +#content.user.show #container.top #column.left { width: 100px; } +#content.user.show #container.top #column.right { width: 600px; } +#content.user.show #container.bottom { background: brown; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/compact.css b/vendor/gems/haml-1.7.2/test/sass/results/compact.css new file mode 100644 index 0000000..bd6bc91 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/compact.css @@ -0,0 +1,5 @@ +#main { width: 15em; color: #0000ff; } +#main p { border-style: dotted; border-width: 2px; } +#main .cool { width: 100px; } + +#left { font-size: 2em; font-weight: bold; float: left; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/complex.css b/vendor/gems/haml-1.7.2/test/sass/results/complex.css new file mode 100644 index 0000000..6b3123b --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/complex.css @@ -0,0 +1,87 @@ +body { margin: 0; font: 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif; color: #fff; background: url(/images/global_bg.gif); } + +#page { width: 900px; margin: 0 auto; background: #440008; border-top-width: 5px; border-top-style: solid; border-top-color: #ff8500; } + +#header { height: 75px; padding: 0; } +#header h1 { float: left; width: 274px; height: 75px; margin: 0; background-image: url(/images/global_logo.gif); background-repeat: no-repeat; text-indent: -9999px; } +#header .status { float: right; padding-top: .5em; padding-left: .5em; padding-right: .5em; padding-bottom: 0; } +#header .status p { float: left; margin-top: 0; margin-right: 0.5em; margin-bottom: 0; margin-left: 0; } +#header .status ul { float: left; margin: 0; padding: 0; } +#header .status li { list-style-type: none; display: inline; margin: 0 5px; } +#header .status a:link, #header .status a:visited { color: #ff8500; text-decoration: none; } +#header .status a:hover { text-decoration: underline; } +#header .search { float: right; clear: right; margin: 12px 0 0 0; } +#header .search form { margin: 0; } +#header .search input { margin: 0 3px 0 0; padding: 2px; border: none; } + +#menu { clear: both; text-align: right; height: 20px; border-bottom: 5px solid #006b95; background: #00a4e4; } +#menu .contests ul { margin: 0 5px 0 0; padding: 0; } +#menu .contests ul li { list-style-type: none; margin: 0 5px; padding: 5px 5px 0 5px; display: inline; font-size: 1.1em; color: #fff; background: #00a4e4; } +#menu .contests ul li / This rule isn't a comment! { red: green; } +#menu .contests a:link, #menu .contests a:visited { color: #fff; text-decoration: none; font-weight: bold; } +#menu .contests a:hover { text-decoration: underline; } + +#content { clear: both; } +#content .container { clear: both; } +#content .container .column { float: left; } +#content .container .column .right { float: right; } +#content a:link, #content a:visited { color: #93d700; text-decoration: none; } +#content a:hover { text-decoration: underline; } + +#content p, #content div { width: 40em; } +#content p li, #content p dt, #content p dd, #content div li, #content div dt, #content div dd { color: #ddffdd; background-color: #4792bb; } +#content .container.video .column.left { width: 200px; } +#content .container.video .column.left .box { margin-top: 10px; } +#content .container.video .column.left .box p { margin: 0 1em auto 1em; } +#content .container.video .column.left .box.participants img { float: left; margin: 0 1em auto 1em; border: 1px solid #6e000d; border-style: solid; } +#content .container.video .column.left .box.participants h2 { margin: 0 0 10px 0; padding: 0.5em; /* The background image is a gif! */ background: #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat; /* Okay check this out Multiline comments Wow dude I mean seriously, WOW */ text-indent: -9999px; border-top-width: 5px; border-top-style: solid; border-top-color: #a20013; border-right-width: 1px; border-right-style: dotted; } +#content .container.video .column.middle { width: 500px; } +#content .container.video .column.right { width: 200px; } +#content .container.video .column.right .box { margin-top: 0; } +#content .container.video .column.right .box p { margin: 0 1em auto 1em; } +#content .container.video .column p { margin-top: 0; } + +#content.contests .container.information .column.right .box { margin: 1em 0; } +#content.contests .container.information .column.right .box.videos .thumbnail img { width: 200px; height: 150px; margin-bottom: 5px; } +#content.contests .container.information .column.right .box.videos a:link, #content.contests .container.information .column.right .box.videos a:visited { color: #93d700; text-decoration: none; } +#content.contests .container.information .column.right .box.videos a:hover { text-decoration: underline; } +#content.contests .container.information .column.right .box.votes a { display: block; width: 200px; height: 60px; margin: 15px 0; background: url(/images/btn_votenow.gif) no-repeat; text-indent: -9999px; outline: none; border: none; } +#content.contests .container.information .column.right .box.votes h2 { margin: 52px 0 10px 0; padding: 0.5em; background: #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } + +#content.contests .container.video .box.videos h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } +#content.contests .container.video .box.videos table { width: 100; } +#content.contests .container.video .box.videos table td { padding: 1em; width: 25; vertical-align: top; } +#content.contests .container.video .box.videos table td p { margin: 0 0 5px 0; } +#content.contests .container.video .box.videos table td a:link, #content.contests .container.video .box.videos table td a:visited { color: #93d700; text-decoration: none; } +#content.contests .container.video .box.videos table td a:hover { text-decoration: underline; } +#content.contests .container.video .box.videos .thumbnail { float: left; } +#content.contests .container.video .box.videos .thumbnail img { width: 80px; height: 60px; margin: 0 10px 0 0; border: 1px solid #6e000d; } + +#content .container.comments .column { margin-top: 15px; } +#content .container.comments .column.left { width: 600px; } +#content .container.comments .column.left .box ol { margin: 0; padding: 0; } +#content .container.comments .column.left .box li { list-style-type: none; padding: 10px; margin: 0 0 1em 0; background: #6e000d; border-top: 5px solid #a20013; } +#content .container.comments .column.left .box li div { margin-bottom: 1em; } +#content .container.comments .column.left .box li ul { text-align: right; } +#content .container.comments .column.left .box li ul li { display: inline; border: none; padding: 0; } +#content .container.comments .column.right { width: 290px; padding-left: 10px; } +#content .container.comments .column.right h2 { margin: 0; padding: 0.5em; background: #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat; text-indent: -9999px; border-top: 5px solid #a20013; } +#content .container.comments .column.right .box textarea { width: 290px; height: 100px; border: none; } + +#footer { margin-top: 10px; padding: 1.2em 1.5em; background: #ff8500; } +#footer ul { margin: 0; padding: 0; list-style-type: none; } +#footer ul li { display: inline; margin: 0 0.5em; color: #440008; } +#footer ul.links { float: left; } +#footer ul.links a:link, #footer ul.links a:visited { color: #440008; text-decoration: none; } +#footer ul.links a:hover { text-decoration: underline; } +#footer ul.copyright { float: right; } + +.clear { clear: both; } + +.centered { text-align: center; } + +img { border: none; } + +button.short { width: 60px; height: 22px; padding: 0 0 2px 0; color: #fff; border: none; background: url(/images/btn_short.gif) no-repeat; } + +table { border-collapse: collapse; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/constants.css b/vendor/gems/haml-1.7.2/test/sass/results/constants.css new file mode 100644 index 0000000..d95c676 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/constants.css @@ -0,0 +1,12 @@ +#main { content: Hello!; qstr: Quo"ted"!; hstr: Hyph-en!; width: 30em; background-color: #000; color: #ffffaa; short-color: #112233; named-color: #808000; con: foo bar 9 hi there boom; con2: noquo quo; } +#main #sidebar { background-color: #00ff98; num-normal: 10; num-dec: 10.2; num-dec0: 99; num-neg: -10; esc: 10+12; many: 6; order: 7; complex: #4c9db1hi16; } + +#plus { num-num: 7; num-num-un: 25em; num-num-un2: 23em; num-num-neg: 9.87; num-str: 100px; num-col: #b7b7b7; num-perc: 31%; str-str: hi there; str-str2: hi there; str-col: 14em solid #112233; str-num: times: 13; col-num: #ff7b9d; col-col: #5173ff; } + +#minus { num-num: 900; col-num: #f9f9f4; col-col: #000035; unary-num: -1; unary-const: 10; unary-paren: -11; } + +#times { num-num: 7; num-col: #7496b8; col-num: #092345; col-col: #243648; } + +#div { num-num: 3.33333333333333; num-num2: 3; col-num: #092345; col-col: #0b0d0f; } + +#mod { num-num: 2; col-col: #0f0e05; col-num: #020001; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/expanded.css b/vendor/gems/haml-1.7.2/test/sass/results/expanded.css new file mode 100644 index 0000000..005586e --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/expanded.css @@ -0,0 +1,18 @@ +#main { + width: 15em; + color: #0000ff; +} +#main p { + border-style: dotted; + border-width: 2px; +} +#main .cool { + width: 100px; +} + +#left { + font-size: 2em; + font-weight: bold; + + float: left; +} diff --git a/vendor/gems/haml-1.7.2/test/sass/results/import.css b/vendor/gems/haml-1.7.2/test/sass/results/import.css new file mode 100644 index 0000000..1f5ebbc --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/import.css @@ -0,0 +1,27 @@ +imported { otherconst: hello; myconst: goodbye; } + +body { font: Arial; background: blue; } + +#page { width: 700px; height: 100; } +#page #header { height: 300px; } +#page #header h1 { font-size: 50px; color: blue; } + +#content.user.show #container.top #column.left { width: 100px; } +#content.user.show #container.top #column.right { width: 600px; } +#content.user.show #container.bottom { background: brown; } + +midrule { inthe: middle; } + +body { font: Arial; background: blue; } + +#page { width: 700px; height: 100; } +#page #header { height: 300px; } +#page #header h1 { font-size: 50px; color: blue; } + +#content.user.show #container.top #column.left { width: 100px; } +#content.user.show #container.top #column.right { width: 600px; } +#content.user.show #container.bottom { background: brown; } + +@import url(basic.css); +@import url(../results/complex.css); +nonimported { myconst: hello; otherconst: goodbye; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/nested.css b/vendor/gems/haml-1.7.2/test/sass/results/nested.css new file mode 100644 index 0000000..7f6ad82 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/nested.css @@ -0,0 +1,21 @@ +#main { + width: 15em; + color: #0000ff; } + #main p { + border-style: dotted; + border-width: 2px; } + #main .cool { + width: 100px; } + +#left { + font-size: 2em; + font-weight: bold; + + float: left; } + +#right .header { + border-style: solid; } +#right .body { + border-style: dotted; } +#right .footer { + border-style: dashed; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css b/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css new file mode 100644 index 0000000..c502a23 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/parent_ref.css @@ -0,0 +1,13 @@ +a { color: #000; } +a:hover { color: #f00; } + +p, div { width: 100em; } +p foo, div foo { width: 10em; } +p:hover, p bar, div:hover, div bar { height: 20em; } + +#cool { border-style: solid; border-width: 2em; } +.ie7 #cool, .ie6 #cool { content: string(Totally not cool.); } +.firefox #cool { content: string(Quite cool.); } + +.wow, .snazzy { font-family: fantasy; } +.wow:hover, .wow:visited, .snazzy:hover, .snazzy:visited { font-weight: bold; } diff --git a/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css b/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css new file mode 100644 index 0000000..7aadcfe --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/subdir/nested_subdir/nested_subdir.css @@ -0,0 +1 @@ +#pi { width: 314px; } \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css b/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css new file mode 100644 index 0000000..25c5c19 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/results/subdir/subdir.css @@ -0,0 +1 @@ +#subdir { font-size: 20px; font-weight: bold; } \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass b/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass new file mode 100644 index 0000000..f805e18 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/alt.sass @@ -0,0 +1,16 @@ +h1 + :float left + :width 274px + height: 75px + margin: 0 + background: + repeat: no-repeat + :image none + a:hover, a:visited + color: green + b:hover + color: red + :background-color green + const + nosp= 1 + 2 + sp = 1 + 2 diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass b/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass new file mode 100644 index 0000000..71117bf --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/basic.sass @@ -0,0 +1,23 @@ + + +body + :font Arial + :background blue + +#page + :width 700px + :height 100 + #header + :height 300px + h1 + :font-size 50px + :color blue + +#content.user.show + #container.top + #column.left + :width 100px + #column.right + :width 600px + #container.bottom + :background brown \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass b/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass new file mode 100644 index 0000000..b0d9abe --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/bork.sass @@ -0,0 +1,2 @@ +bork + :bork= !bork diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass b/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass new file mode 100644 index 0000000..462afb5 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/bork2.sass @@ -0,0 +1,2 @@ +bork + :bork: bork; diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass b/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass new file mode 100644 index 0000000..675fea4 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/compact.sass @@ -0,0 +1,15 @@ +#main + :width 15em + :color #0000ff + p + :border + :style dotted + :width 2px + .cool + :width 100px + +#left + :font + :size 2em + :weight bold + :float left diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass b/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass new file mode 100644 index 0000000..6517815 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/complex.sass @@ -0,0 +1,309 @@ +body + :margin 0 + :font 0.85em "Lucida Grande", "Trebuchet MS", Verdana, sans-serif + :color #fff + :background url(/images/global_bg.gif) + +#page + :width 900px + :margin 0 auto + :background #440008 + :border-top + :width 5px + :style solid + :color #ff8500 + +#header + :height 75px + :padding 0 + h1 + :float left + :width 274px + :height 75px + :margin 0 + :background + :image url(/images/global_logo.gif) + :repeat no-repeat + :text-indent -9999px + .status + :float right + :padding + :top .5em + :left .5em + :right .5em + :bottom 0 + p + :float left + :margin + :top 0 + :right 0.5em + :bottom 0 + :left 0 + ul + :float left + :margin 0 + :padding 0 + li + :list-style-type none + :display inline + :margin 0 5px + a:link, a:visited + :color #ff8500 + :text-decoration none + a:hover + :text-decoration underline + .search + :float right + :clear right + :margin 12px 0 0 0 + form + :margin 0 + input + :margin 0 3px 0 0 + :padding 2px + :border none + +#menu + :clear both + :text-align right + :height 20px + :border-bottom 5px solid #006b95 + :background #00a4e4 + .contests + ul + :margin 0 5px 0 0 + :padding 0 + li + :list-style-type none + :margin 0 5px + :padding 5px 5px 0 5px + :display inline +// This comment is in the middle of this rule + :font-size 1.1em + // This comment is properly indented + :color #fff + :background #00a4e4 + / This rule isn't a comment! + :red green + a:link, a:visited + :color #fff + :text-decoration none + :font-weight bold + a:hover + :text-decoration underline + +//General content information +#content + :clear both + .container + :clear both + .column + :float left + .left + .middle + .right + :float right + a:link, a:visited + :color #93d700 + :text-decoration none + a:hover + :text-decoration underline + +// A hard tab: + + +#content + p, div + :width 40em + li, dt, dd + :color #ddffdd + :background-color #4792bb + .container.video + .column.left + :width 200px + .box + :margin-top 10px + p + :margin 0 1em auto 1em + .box.participants + img + :float left + :margin 0 1em auto 1em + :border 1px solid #6e000d + :style solid + h2 + :margin 0 0 10px 0 + :padding 0.5em + /* The background image is a gif! + :background #6e000d url(/images/hdr_participant.gif) 2px 2px no-repeat + /* Okay check this out + Multiline comments + Wow dude + I mean seriously, WOW + :text-indent -9999px + // And also... + Multiline comments that don't output! + Snazzy, no? + :border + :top + :width 5px + :style solid + :color #a20013 + :right + :width 1px + :style dotted + .column.middle + :width 500px + .column.right + :width 200px + .box + :margin-top 0 + p + :margin 0 1em auto 1em + .column + p + :margin-top 0 + +#content.contests + .container.information + .column.right + .box + :margin 1em 0 + .box.videos + .thumbnail img + :width 200px + :height 150px + :margin-bottom 5px + a:link, a:visited + :color #93d700 + :text-decoration none + a:hover + :text-decoration underline + .box.votes + a + :display block + :width 200px + :height 60px + :margin 15px 0 + :background url(/images/btn_votenow.gif) no-repeat + :text-indent -9999px + :outline none + :border none + h2 + :margin 52px 0 10px 0 + :padding 0.5em + :background #6e000d url(/images/hdr_videostats.gif) 2px 2px no-repeat + :text-indent -9999px + :border-top 5px solid #a20013 + +#content.contests + .container.video + .box.videos + h2 + :margin 0 + :padding 0.5em + :background #6e000d url(/images/hdr_newestclips.gif) 2px 2px no-repeat + :text-indent -9999px + :border-top 5px solid #a20013 + table + :width 100 + td + :padding 1em + :width 25 + :vertical-align top + p + :margin 0 0 5px 0 + a:link, a:visited + :color #93d700 + :text-decoration none + a:hover + :text-decoration underline + .thumbnail + :float left + img + :width 80px + :height 60px + :margin 0 10px 0 0 + :border 1px solid #6e000d + +#content + .container.comments + .column + :margin-top 15px + .column.left + :width 600px + .box + ol + :margin 0 + :padding 0 + li + :list-style-type none + :padding 10px + :margin 0 0 1em 0 + :background #6e000d + :border-top 5px solid #a20013 + div + :margin-bottom 1em + ul + :text-align right + li + :display inline + :border none + :padding 0 + .column.right + :width 290px + :padding-left 10px + h2 + :margin 0 + :padding 0.5em + :background #6e000d url(/images/hdr_addcomment.gif) 2px 2px no-repeat + :text-indent -9999px + :border-top 5px solid #a20013 + .box + textarea + :width 290px + :height 100px + :border none + +#footer + :margin-top 10px + :padding 1.2em 1.5em + :background #ff8500 + ul + :margin 0 + :padding 0 + :list-style-type none + li + :display inline + :margin 0 0.5em + :color #440008 + ul.links + :float left + a:link, a:visited + :color #440008 + :text-decoration none + a:hover + :text-decoration underline + ul.copyright + :float right + + +.clear + :clear both + +.centered + :text-align center + +img + :border none + +button.short + :width 60px + :height 22px + :padding 0 0 2px 0 + :color #fff + :border none + :background url(/images/btn_short.gif) no-repeat + +table + :border-collapse collapse diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass b/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass new file mode 100644 index 0000000..6f2eda5 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/constants.sass @@ -0,0 +1,88 @@ +!width = 10em + 20 +!color = #00ff98 +!main_text = #ffa +!num = 10 +!dec = 10.2 +!dec_0 = 99.0 +!neg = -10 +!esc= 10\+12 +!str= "Hello!" +!qstr= "Quo\"ted\"!" +!hstr= "Hyph-en!" +!concat = (5 + 4) hi there +!percent= 11% + +#main + :content = !str + :qstr = !qstr + :hstr = !hstr + :width = !width + :background-color #000 + :color= !main_text + :short-color= #123 + :named-color= olive + :con= foo bar (!concat boom) + :con2= noquo "quo" + #sidebar + :background-color= !color + :num + :normal= !num + :dec= !dec + :dec0= !dec_0 + :neg= !neg + :esc= !esc + :many= 1 + 2 + 3 + :order= 1 + 2 * 3 + :complex= ((1 + 2) + 15)+#3a8b9f + (hi+(1 +1+ 2)* 4) + +#plus + :num + :num= 5+2 + :num-un= 10em + 15em + :num-un2= 10 + 13em + :num-neg= 10 + -.13 + :str= 100 + px + :col= 13 + #aaa + :perc = !percent + 20% + :str + :str= hi + \ there + :str2= hi + " there" + :col= "14em solid " + #123 + :num= times:\ + 13 + :col + :num= #f02 + 123.5 + :col= #12A + #405162 + +#minus + :num + :num= 912 - 12 + :col + :num= #fffffa - 5.2 + :col= #abcdef - #fedcba + :unary + :num= -1 + :const= -!neg + :paren= -(5 + 6) + +#times + :num + :num= 2 * 3.5 + :col= 2 * #3a4b5c + :col + :num= #12468a * 0.5 + :col= #121212 * #020304 + +#div + :num + :num= 10 / 3.0 + :num2= 10 / 3 + :col + :num= #12468a / 2 + :col= #abcdef / #0f0f0f + +#mod + :num + :num= 17 % 3 + :col + :col= #5f6e7d % #10200a + :num= #aaabac % 3 diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass b/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass new file mode 100644 index 0000000..675fea4 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/expanded.sass @@ -0,0 +1,15 @@ +#main + :width 15em + :color #0000ff + p + :border + :style dotted + :width 2px + .cool + :width 100px + +#left + :font + :size 2em + :weight bold + :float left diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/import.sass b/vendor/gems/haml-1.7.2/test/sass/templates/import.sass new file mode 100644 index 0000000..d286c1d --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/import.sass @@ -0,0 +1,8 @@ +!preconst = hello + +@import importee, basic, basic.css, ../results/complex.css + +nonimported + :myconst = !preconst + :otherconst = !postconst + diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass b/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass new file mode 100644 index 0000000..631aa25 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/importee.sass @@ -0,0 +1,10 @@ +!postconst = goodbye + +imported + :otherconst = !preconst + :myconst = !postconst + +@import basic + +midrule + :inthe middle \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass b/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass new file mode 100644 index 0000000..1adb4be --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/nested.sass @@ -0,0 +1,23 @@ +#main + :width 15em + :color #0000ff + p + :border + :style dotted + :width 2px + .cool + :width 100px + +#left + :font + :size 2em + :weight bold + :float left + +#right + .header + :border-style solid + .body + :border-style dotted + .footer + :border-style dashed diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass b/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass new file mode 100644 index 0000000..6b261d7 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/parent_ref.sass @@ -0,0 +1,25 @@ +a + :color #000 + &:hover + :color #f00 + +p, div + :width 100em + & foo + :width 10em + &:hover, bar + :height 20em + +#cool + :border + :style solid + :width 2em + .ie7 &, .ie6 & + :content string(Totally not cool.) + .firefox & + :content string(Quite cool.) + +.wow, .snazzy + :font-family fantasy + &:hover, &:visited + :font-weight bold diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass new file mode 100644 index 0000000..aae9eeb --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/nested_subdir/nested_subdir.sass @@ -0,0 +1,3 @@ +#pi + :width 314px + \ No newline at end of file diff --git a/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass new file mode 100644 index 0000000..bbe9810 --- /dev/null +++ b/vendor/gems/haml-1.7.2/test/sass/templates/subdir/subdir.sass @@ -0,0 +1,6 @@ +#subdir + :font + :size 20px + :weight bold + + \ No newline at end of file