haml-edge 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/EDGE_GEM_VERSION +1 -0
- data/FAQ +138 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +332 -0
- data/REVISION +1 -0
- data/Rakefile +226 -0
- data/VERSION +1 -0
- data/bin/css2sass +7 -0
- data/bin/haml +9 -0
- data/bin/html2haml +7 -0
- data/bin/sass +8 -0
- data/extra/edge_gem_watch.rb +13 -0
- data/extra/haml-mode.el +596 -0
- data/extra/sass-mode.el +200 -0
- data/init.rb +8 -0
- data/lib/haml/buffer.rb +255 -0
- data/lib/haml/engine.rb +268 -0
- data/lib/haml/error.rb +22 -0
- data/lib/haml/exec.rb +395 -0
- data/lib/haml/filters.rb +275 -0
- data/lib/haml/helpers/action_view_extensions.rb +45 -0
- data/lib/haml/helpers/action_view_mods.rb +181 -0
- data/lib/haml/helpers.rb +488 -0
- data/lib/haml/html.rb +222 -0
- data/lib/haml/precompiler.rb +904 -0
- data/lib/haml/shared.rb +45 -0
- data/lib/haml/template/patch.rb +58 -0
- data/lib/haml/template/plugin.rb +72 -0
- data/lib/haml/template.rb +42 -0
- data/lib/haml/util.rb +88 -0
- data/lib/haml/version.rb +47 -0
- data/lib/haml.rb +1044 -0
- data/lib/sass/css.rb +388 -0
- data/lib/sass/engine.rb +495 -0
- data/lib/sass/environment.rb +46 -0
- data/lib/sass/error.rb +35 -0
- data/lib/sass/plugin/merb.rb +56 -0
- data/lib/sass/plugin/rails.rb +24 -0
- data/lib/sass/plugin.rb +204 -0
- data/lib/sass/repl.rb +51 -0
- data/lib/sass/script/bool.rb +13 -0
- data/lib/sass/script/color.rb +97 -0
- data/lib/sass/script/funcall.rb +29 -0
- data/lib/sass/script/functions.rb +134 -0
- data/lib/sass/script/lexer.rb +148 -0
- data/lib/sass/script/literal.rb +82 -0
- data/lib/sass/script/number.rb +231 -0
- data/lib/sass/script/operation.rb +30 -0
- data/lib/sass/script/parser.rb +142 -0
- data/lib/sass/script/string.rb +9 -0
- data/lib/sass/script/unary_operation.rb +21 -0
- data/lib/sass/script/variable.rb +20 -0
- data/lib/sass/script.rb +38 -0
- data/lib/sass/tree/attr_node.rb +64 -0
- data/lib/sass/tree/comment_node.rb +30 -0
- data/lib/sass/tree/debug_node.rb +22 -0
- data/lib/sass/tree/directive_node.rb +50 -0
- data/lib/sass/tree/file_node.rb +27 -0
- data/lib/sass/tree/for_node.rb +29 -0
- data/lib/sass/tree/if_node.rb +27 -0
- data/lib/sass/tree/mixin_def_node.rb +18 -0
- data/lib/sass/tree/mixin_node.rb +35 -0
- data/lib/sass/tree/node.rb +99 -0
- data/lib/sass/tree/rule_node.rb +161 -0
- data/lib/sass/tree/variable_node.rb +24 -0
- data/lib/sass/tree/while_node.rb +21 -0
- data/lib/sass.rb +1062 -0
- data/rails/init.rb +1 -0
- data/test/benchmark.rb +99 -0
- data/test/haml/engine_test.rb +795 -0
- data/test/haml/helper_test.rb +228 -0
- data/test/haml/html2haml_test.rb +108 -0
- data/test/haml/markaby/standard.mab +52 -0
- data/test/haml/mocks/article.rb +6 -0
- data/test/haml/results/content_for_layout.xhtml +15 -0
- data/test/haml/results/eval_suppressed.xhtml +9 -0
- data/test/haml/results/filters.xhtml +62 -0
- data/test/haml/results/helpers.xhtml +93 -0
- data/test/haml/results/helpful.xhtml +10 -0
- data/test/haml/results/just_stuff.xhtml +68 -0
- data/test/haml/results/list.xhtml +12 -0
- data/test/haml/results/nuke_inner_whitespace.xhtml +40 -0
- data/test/haml/results/nuke_outer_whitespace.xhtml +148 -0
- data/test/haml/results/original_engine.xhtml +20 -0
- data/test/haml/results/partial_layout.xhtml +5 -0
- data/test/haml/results/partials.xhtml +21 -0
- data/test/haml/results/render_layout.xhtml +3 -0
- data/test/haml/results/silent_script.xhtml +74 -0
- data/test/haml/results/standard.xhtml +162 -0
- data/test/haml/results/tag_parsing.xhtml +23 -0
- data/test/haml/results/very_basic.xhtml +5 -0
- data/test/haml/results/whitespace_handling.xhtml +89 -0
- data/test/haml/rhtml/_av_partial_1.rhtml +12 -0
- data/test/haml/rhtml/_av_partial_2.rhtml +8 -0
- data/test/haml/rhtml/action_view.rhtml +62 -0
- data/test/haml/rhtml/standard.rhtml +54 -0
- data/test/haml/template_test.rb +204 -0
- data/test/haml/templates/_av_partial_1.haml +9 -0
- data/test/haml/templates/_av_partial_1_ugly.haml +9 -0
- data/test/haml/templates/_av_partial_2.haml +5 -0
- data/test/haml/templates/_av_partial_2_ugly.haml +5 -0
- data/test/haml/templates/_layout.erb +3 -0
- data/test/haml/templates/_layout_for_partial.haml +3 -0
- data/test/haml/templates/_partial.haml +8 -0
- data/test/haml/templates/_text_area.haml +3 -0
- data/test/haml/templates/action_view.haml +47 -0
- data/test/haml/templates/action_view_ugly.haml +47 -0
- data/test/haml/templates/breakage.haml +8 -0
- data/test/haml/templates/content_for_layout.haml +10 -0
- data/test/haml/templates/eval_suppressed.haml +11 -0
- data/test/haml/templates/filters.haml +66 -0
- data/test/haml/templates/helpers.haml +95 -0
- data/test/haml/templates/helpful.haml +11 -0
- data/test/haml/templates/just_stuff.haml +83 -0
- data/test/haml/templates/list.haml +12 -0
- data/test/haml/templates/nuke_inner_whitespace.haml +32 -0
- data/test/haml/templates/nuke_outer_whitespace.haml +144 -0
- data/test/haml/templates/original_engine.haml +17 -0
- data/test/haml/templates/partial_layout.haml +3 -0
- data/test/haml/templates/partialize.haml +1 -0
- data/test/haml/templates/partials.haml +12 -0
- data/test/haml/templates/render_layout.haml +2 -0
- data/test/haml/templates/silent_script.haml +40 -0
- data/test/haml/templates/standard.haml +42 -0
- data/test/haml/templates/standard_ugly.haml +42 -0
- data/test/haml/templates/tag_parsing.haml +21 -0
- data/test/haml/templates/very_basic.haml +4 -0
- data/test/haml/templates/whitespace_handling.haml +87 -0
- data/test/haml/util_test.rb +87 -0
- data/test/linked_rails.rb +12 -0
- data/test/sass/css2sass_test.rb +193 -0
- data/test/sass/engine_test.rb +709 -0
- data/test/sass/functions_test.rb +109 -0
- data/test/sass/more_results/more1.css +9 -0
- data/test/sass/more_results/more1_with_line_comments.css +26 -0
- data/test/sass/more_results/more_import.css +29 -0
- data/test/sass/more_templates/_more_partial.sass +2 -0
- data/test/sass/more_templates/more1.sass +23 -0
- data/test/sass/more_templates/more_import.sass +11 -0
- data/test/sass/plugin_test.rb +213 -0
- data/test/sass/results/alt.css +4 -0
- data/test/sass/results/basic.css +9 -0
- data/test/sass/results/compact.css +5 -0
- data/test/sass/results/complex.css +87 -0
- data/test/sass/results/compressed.css +1 -0
- data/test/sass/results/expanded.css +19 -0
- data/test/sass/results/import.css +29 -0
- data/test/sass/results/line_numbers.css +49 -0
- data/test/sass/results/mixins.css +95 -0
- data/test/sass/results/multiline.css +24 -0
- data/test/sass/results/nested.css +22 -0
- data/test/sass/results/parent_ref.css +13 -0
- data/test/sass/results/script.css +16 -0
- data/test/sass/results/subdir/nested_subdir/nested_subdir.css +1 -0
- data/test/sass/results/subdir/subdir.css +3 -0
- data/test/sass/results/units.css +11 -0
- data/test/sass/script_test.rb +250 -0
- data/test/sass/templates/_partial.sass +2 -0
- data/test/sass/templates/alt.sass +16 -0
- data/test/sass/templates/basic.sass +23 -0
- data/test/sass/templates/bork.sass +2 -0
- data/test/sass/templates/bork2.sass +2 -0
- data/test/sass/templates/compact.sass +17 -0
- data/test/sass/templates/complex.sass +309 -0
- data/test/sass/templates/compressed.sass +15 -0
- data/test/sass/templates/expanded.sass +17 -0
- data/test/sass/templates/import.sass +11 -0
- data/test/sass/templates/importee.sass +19 -0
- data/test/sass/templates/line_numbers.sass +13 -0
- data/test/sass/templates/mixins.sass +76 -0
- data/test/sass/templates/multiline.sass +20 -0
- data/test/sass/templates/nested.sass +25 -0
- data/test/sass/templates/parent_ref.sass +25 -0
- data/test/sass/templates/script.sass +101 -0
- data/test/sass/templates/subdir/nested_subdir/_nested_partial.sass +2 -0
- data/test/sass/templates/subdir/nested_subdir/nested_subdir.sass +3 -0
- data/test/sass/templates/subdir/subdir.sass +6 -0
- data/test/sass/templates/units.sass +11 -0
- data/test/test_helper.rb +21 -0
- metadata +278 -0
@@ -0,0 +1,54 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
2
|
+
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en-US' lang='en-US'>
|
3
|
+
<head>
|
4
|
+
<title>Hampton Catlin Is Totally Awesome</title>
|
5
|
+
<meta content='text/html; charset=utf-8' http-equiv='Content-Type' />
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<!-- You're In my house now! -->
|
9
|
+
<div class='header'>
|
10
|
+
Yes, ladies and gentileman. He is just that egotistical.
|
11
|
+
Fantastic! This should be multi-line output
|
12
|
+
The question is if this would translate! Ahah!
|
13
|
+
<%= 1 + 9 + 8 + 2 %>
|
14
|
+
<%# numbers should work and this should be ignored %>
|
15
|
+
</div>
|
16
|
+
<% 120.times do |number| -%>
|
17
|
+
<%= number %>
|
18
|
+
<% end -%>
|
19
|
+
<div id='body'><%= " Quotes should be loved! Just like people!" %></div>
|
20
|
+
Wow.
|
21
|
+
<p>
|
22
|
+
<%= "Holy cow " +
|
23
|
+
"multiline " +
|
24
|
+
"tags! " +
|
25
|
+
"A pipe (|) even!" %>
|
26
|
+
<%= [1, 2, 3].collect { |n| "PipesIgnored|" }.join %>
|
27
|
+
<%= [1, 2, 3].collect { |n|
|
28
|
+
n.to_s
|
29
|
+
}.join("|") %>
|
30
|
+
</p>
|
31
|
+
<div class='silent'>
|
32
|
+
<% foo = String.new
|
33
|
+
foo << "this"
|
34
|
+
foo << " shouldn't"
|
35
|
+
foo << " evaluate" %>
|
36
|
+
<%= foo + "but now it should!" %>
|
37
|
+
<%# Woah crap a comment! %>
|
38
|
+
</div>
|
39
|
+
<ul class='really cool'>
|
40
|
+
<% ('a'..'f').each do |a|%>
|
41
|
+
<li><%= a %></li>
|
42
|
+
<% end %>
|
43
|
+
<div class='of_divs_with_underscore' id='combo'><%= @should_eval = "with this text" %></div>
|
44
|
+
<%= "foo".each_line do |line|
|
45
|
+
nil
|
46
|
+
end %>
|
47
|
+
<div class='footer'>
|
48
|
+
<strong class='shout'>
|
49
|
+
<%= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid.\n" +
|
50
|
+
" So, I'm just making it *really* long. God, I hope this works" %>
|
51
|
+
</strong>
|
52
|
+
</div>
|
53
|
+
</body>
|
54
|
+
</html>
|
@@ -0,0 +1,204 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require File.dirname(__FILE__) + '/../test_helper'
|
3
|
+
require 'haml/template'
|
4
|
+
require 'sass/plugin'
|
5
|
+
require File.dirname(__FILE__) + '/mocks/article'
|
6
|
+
|
7
|
+
require 'action_pack/version'
|
8
|
+
|
9
|
+
module Haml::Filters::Test
|
10
|
+
include Haml::Filters::Base
|
11
|
+
|
12
|
+
def render(text)
|
13
|
+
"TESTING HAHAHAHA!"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module Haml::Helpers
|
18
|
+
def test_partial(name, locals = {})
|
19
|
+
Haml::Engine.new(File.read(File.join(TemplateTest::TEMPLATE_PATH, "_#{name}.haml"))).render(self, locals)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Egocentic
|
24
|
+
def method_missing(*args)
|
25
|
+
self
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class DummyController
|
30
|
+
attr_accessor :logger
|
31
|
+
def initialize
|
32
|
+
@logger = Egocentic.new
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.controller_path
|
36
|
+
''
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class TemplateTest < Test::Unit::TestCase
|
41
|
+
TEMPLATE_PATH = File.join(File.dirname(__FILE__), "templates")
|
42
|
+
TEMPLATES = %w{ very_basic standard helpers
|
43
|
+
whitespace_handling original_engine list helpful
|
44
|
+
silent_script tag_parsing just_stuff partials
|
45
|
+
filters nuke_outer_whitespace nuke_inner_whitespace
|
46
|
+
render_layout }
|
47
|
+
# partial layouts were introduced in 2.0.0
|
48
|
+
TEMPLATES << 'partial_layout' unless ActionPack::VERSION::MAJOR < 2
|
49
|
+
|
50
|
+
def setup
|
51
|
+
@base = create_base
|
52
|
+
|
53
|
+
# filters template uses :sass
|
54
|
+
Sass::Plugin.options.update(:line_comments => true, :style => :compact)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create_base
|
58
|
+
vars = { 'article' => Article.new, 'foo' => 'value one' }
|
59
|
+
|
60
|
+
unless Haml::Util.has?(:instance_method, ActionView::Base, :finder)
|
61
|
+
base = ActionView::Base.new(TEMPLATE_PATH, vars)
|
62
|
+
else
|
63
|
+
# Rails 2.1.0
|
64
|
+
base = ActionView::Base.new([], vars)
|
65
|
+
base.finder.append_view_path(TEMPLATE_PATH)
|
66
|
+
end
|
67
|
+
|
68
|
+
if Haml::Util.has?(:private_method, base, :evaluate_assigns)
|
69
|
+
base.send(:evaluate_assigns)
|
70
|
+
else
|
71
|
+
# Rails 2.2
|
72
|
+
base.send(:_evaluate_assigns_and_ivars)
|
73
|
+
end
|
74
|
+
|
75
|
+
# This is used by form_for.
|
76
|
+
# It's usually provided by ActionController::Base.
|
77
|
+
def base.protect_against_forgery?; false; end
|
78
|
+
|
79
|
+
base.controller = DummyController.new
|
80
|
+
base
|
81
|
+
end
|
82
|
+
|
83
|
+
def render(text)
|
84
|
+
Haml::Engine.new(text).to_html(@base)
|
85
|
+
end
|
86
|
+
|
87
|
+
def load_result(name)
|
88
|
+
@result = ''
|
89
|
+
File.new(File.dirname(__FILE__) + "/results/#{name}.xhtml").each_line { |l| @result += l }
|
90
|
+
@result
|
91
|
+
end
|
92
|
+
|
93
|
+
def assert_renders_correctly(name, &render_method)
|
94
|
+
if ActionPack::VERSION::MAJOR < 2 || ActionPack::VERSION::MINOR < 2
|
95
|
+
render_method ||= proc { |name| @base.render(name) }
|
96
|
+
else
|
97
|
+
render_method ||= proc { |name| @base.render(:file => name) }
|
98
|
+
end
|
99
|
+
|
100
|
+
load_result(name).split("\n").zip(render_method[name].split("\n")).each_with_index do |pair, line|
|
101
|
+
message = "template: #{name}\nline: #{line}"
|
102
|
+
assert_equal(pair.first, pair.last, message)
|
103
|
+
end
|
104
|
+
rescue ActionView::TemplateError => e
|
105
|
+
if e.message =~ /Can't run [\w:]+ filter; required (one of|file) ((?:'\w+'(?: or )?)+)(, but none were found| not found)/
|
106
|
+
puts "\nCouldn't require #{$2}; skipping a test."
|
107
|
+
else
|
108
|
+
raise e
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_empty_render_should_remain_empty
|
113
|
+
assert_equal('', render(''))
|
114
|
+
end
|
115
|
+
|
116
|
+
TEMPLATES.each do |template|
|
117
|
+
define_method "test_template_should_render_correctly [template: #{template}] " do
|
118
|
+
assert_renders_correctly template
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_templates_should_render_correctly_with_render_proc
|
123
|
+
assert_renders_correctly("standard") do |name|
|
124
|
+
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
|
125
|
+
engine.render_proc(@base).call
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_templates_should_render_correctly_with_def_method
|
130
|
+
assert_renders_correctly("standard") do |name|
|
131
|
+
engine = Haml::Engine.new(File.read(File.dirname(__FILE__) + "/templates/#{name}.haml"))
|
132
|
+
engine.def_method(@base, "render_standard")
|
133
|
+
@base.render_standard
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_action_view_templates_render_correctly
|
138
|
+
@base.instance_variable_set("@content_for_layout", 'Lorem ipsum dolor sit amet')
|
139
|
+
assert_renders_correctly 'content_for_layout'
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_instance_variables_should_work_inside_templates
|
143
|
+
@base.instance_variable_set("@content_for_layout", 'something')
|
144
|
+
assert_equal("<p>something</p>", render("%p= @content_for_layout").chomp)
|
145
|
+
|
146
|
+
@base.instance_eval("@author = 'Hampton Catlin'")
|
147
|
+
assert_equal("<div class='author'>Hampton Catlin</div>", render(".author= @author").chomp)
|
148
|
+
|
149
|
+
@base.instance_eval("@author = 'Hampton'")
|
150
|
+
assert_equal("Hampton", render("= @author").chomp)
|
151
|
+
|
152
|
+
@base.instance_eval("@author = 'Catlin'")
|
153
|
+
assert_equal("Catlin", render("= @author").chomp)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_instance_variables_should_work_inside_attributes
|
157
|
+
@base.instance_eval("@author = 'hcatlin'")
|
158
|
+
assert_equal("<p class='hcatlin'>foo</p>", render("%p{:class => @author} foo").chomp)
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_template_renders_should_eval
|
162
|
+
assert_equal("2\n", render("= 1+1"))
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_haml_options
|
166
|
+
Haml::Template.options = { :suppress_eval => true }
|
167
|
+
assert_equal({ :suppress_eval => true }, Haml::Template.options)
|
168
|
+
old_base, @base = @base, create_base
|
169
|
+
assert_renders_correctly("eval_suppressed")
|
170
|
+
@base = old_base
|
171
|
+
Haml::Template.options = {}
|
172
|
+
end
|
173
|
+
|
174
|
+
def test_exceptions_should_work_correctly
|
175
|
+
begin
|
176
|
+
render("- raise 'oops!'")
|
177
|
+
rescue Exception => e
|
178
|
+
assert_equal("oops!", e.message)
|
179
|
+
assert_match(/^\(haml\):1/, e.backtrace[0])
|
180
|
+
else
|
181
|
+
assert false
|
182
|
+
end
|
183
|
+
|
184
|
+
template = <<END
|
185
|
+
%p
|
186
|
+
%h1 Hello!
|
187
|
+
= "lots of lines"
|
188
|
+
= "even more!"
|
189
|
+
- raise 'oh no!'
|
190
|
+
%p
|
191
|
+
this is after the exception
|
192
|
+
%strong yes it is!
|
193
|
+
ho ho ho.
|
194
|
+
END
|
195
|
+
|
196
|
+
begin
|
197
|
+
render(template.chomp)
|
198
|
+
rescue Exception => e
|
199
|
+
assert_match(/^\(haml\):5/, e.backtrace[0])
|
200
|
+
else
|
201
|
+
assert false
|
202
|
+
end
|
203
|
+
end
|
204
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
!!!
|
2
|
+
%html{html_attrs}
|
3
|
+
%head
|
4
|
+
%title Hampton Catlin Is Totally Awesome
|
5
|
+
%meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
|
6
|
+
%body
|
7
|
+
%h1
|
8
|
+
This is very much like the standard template,
|
9
|
+
except that it has some ActionView-specific stuff.
|
10
|
+
It's only used for benchmarking.
|
11
|
+
.crazy_partials= render :partial => 'haml/templates/av_partial_1'
|
12
|
+
/ You're In my house now!
|
13
|
+
.header
|
14
|
+
Yes, ladies and gentileman. He is just that egotistical.
|
15
|
+
Fantastic! This should be multi-line output
|
16
|
+
The question is if this would translate! Ahah!
|
17
|
+
= 1 + 9 + 8 + 2 #numbers should work and this should be ignored
|
18
|
+
#body= " Quotes should be loved! Just like people!"
|
19
|
+
- 120.times do |number|
|
20
|
+
- number
|
21
|
+
Wow.|
|
22
|
+
%p
|
23
|
+
= "Holy cow " + |
|
24
|
+
"multiline " + |
|
25
|
+
"tags! " + |
|
26
|
+
"A pipe (|) even!" |
|
27
|
+
= [1, 2, 3].collect { |n| "PipesIgnored|" }
|
28
|
+
= [1, 2, 3].collect { |n| |
|
29
|
+
n.to_s |
|
30
|
+
}.join("|") |
|
31
|
+
%div.silent
|
32
|
+
- foo = String.new
|
33
|
+
- foo << "this"
|
34
|
+
- foo << " shouldn't"
|
35
|
+
- foo << " evaluate"
|
36
|
+
= foo + " but now it should!"
|
37
|
+
-# Woah crap a comment!
|
38
|
+
|
39
|
+
-# That was a line that shouldn't close everything.
|
40
|
+
%ul.really.cool
|
41
|
+
- ('a'..'f').each do |a|
|
42
|
+
%li= a
|
43
|
+
#combo.of_divs_with_underscore= @should_eval = "with this text"
|
44
|
+
= [ 104, 101, 108, 108, 111 ].map do |byte|
|
45
|
+
- byte.chr
|
46
|
+
.footer
|
47
|
+
%strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works"
|
@@ -0,0 +1,47 @@
|
|
1
|
+
!!!
|
2
|
+
%html{html_attrs}
|
3
|
+
%head
|
4
|
+
%title Hampton Catlin Is Totally Awesome
|
5
|
+
%meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
|
6
|
+
%body
|
7
|
+
%h1
|
8
|
+
This is very much like the standard template,
|
9
|
+
except that it has some ActionView-specific stuff.
|
10
|
+
It's only used for benchmarking.
|
11
|
+
.crazy_partials= render :partial => 'haml/templates/av_partial_1_ugly'
|
12
|
+
/ You're In my house now!
|
13
|
+
.header
|
14
|
+
Yes, ladies and gentileman. He is just that egotistical.
|
15
|
+
Fantastic! This should be multi-line output
|
16
|
+
The question is if this would translate! Ahah!
|
17
|
+
= 1 + 9 + 8 + 2 #numbers should work and this should be ignored
|
18
|
+
#body= " Quotes should be loved! Just like people!"
|
19
|
+
- 120.times do |number|
|
20
|
+
- number
|
21
|
+
Wow.|
|
22
|
+
%p
|
23
|
+
= "Holy cow " + |
|
24
|
+
"multiline " + |
|
25
|
+
"tags! " + |
|
26
|
+
"A pipe (|) even!" |
|
27
|
+
= [1, 2, 3].collect { |n| "PipesIgnored|" }
|
28
|
+
= [1, 2, 3].collect { |n| |
|
29
|
+
n.to_s |
|
30
|
+
}.join("|") |
|
31
|
+
%div.silent
|
32
|
+
- foo = String.new
|
33
|
+
- foo << "this"
|
34
|
+
- foo << " shouldn't"
|
35
|
+
- foo << " evaluate"
|
36
|
+
= foo + " but now it should!"
|
37
|
+
-# Woah crap a comment!
|
38
|
+
|
39
|
+
-# That was a line that shouldn't close everything.
|
40
|
+
%ul.really.cool
|
41
|
+
- ('a'..'f').each do |a|
|
42
|
+
%li= a
|
43
|
+
#combo.of_divs_with_underscore= @should_eval = "with this text"
|
44
|
+
= [ 104, 101, 108, 108, 111 ].map do |byte|
|
45
|
+
- byte.chr
|
46
|
+
.footer
|
47
|
+
%strong.shout= "This is a really long ruby quote. It should be loved and wrapped because its more than 50 characters. This value may change in the future and this test may look stupid. \nSo, I'm just making it *really* long. God, I hope this works"
|
@@ -0,0 +1,66 @@
|
|
1
|
+
%style
|
2
|
+
- width = 5 + 17
|
3
|
+
:sass
|
4
|
+
p
|
5
|
+
:border
|
6
|
+
:style dotted
|
7
|
+
:width #{width}px
|
8
|
+
:color #ff00ff
|
9
|
+
h1
|
10
|
+
:font-weight normal
|
11
|
+
|
12
|
+
:test
|
13
|
+
This
|
14
|
+
Should
|
15
|
+
Not
|
16
|
+
Print
|
17
|
+
|
18
|
+
%p
|
19
|
+
:javascript
|
20
|
+
function newline(str) {
|
21
|
+
return "\n" + str;
|
22
|
+
}
|
23
|
+
|
24
|
+
:plain
|
25
|
+
This
|
26
|
+
Is
|
27
|
+
Plain
|
28
|
+
Text
|
29
|
+
%strong right?
|
30
|
+
\#{not interpolated}
|
31
|
+
\\#{1 + 2}
|
32
|
+
\\\#{also not}
|
33
|
+
\\
|
34
|
+
|
35
|
+
- last = "noitalo"
|
36
|
+
%p
|
37
|
+
%pre
|
38
|
+
:preserve
|
39
|
+
This pre is pretty deeply
|
40
|
+
nested.
|
41
|
+
Does #{"interp" + last.reverse} work?
|
42
|
+
:preserve
|
43
|
+
This one is, too.
|
44
|
+
Nested, that is.
|
45
|
+
|
46
|
+
- num = 10
|
47
|
+
%ul
|
48
|
+
:erb
|
49
|
+
<% num.times do |c| %>
|
50
|
+
<li><%= (c+97).chr %></li>
|
51
|
+
<% end %>
|
52
|
+
<% res = 178 %>
|
53
|
+
|
54
|
+
.res= res
|
55
|
+
|
56
|
+
= "Text!"
|
57
|
+
|
58
|
+
- var = "Hello"
|
59
|
+
:ruby
|
60
|
+
printf "%s, World!\n", var
|
61
|
+
print "How are you doing today?\n"
|
62
|
+
|
63
|
+
:escaped
|
64
|
+
<div class="foo">
|
65
|
+
<p>I think — or do I?</p>
|
66
|
+
</div>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
= h("&&&&&&&&&&&") # This is an ActionView Helper... should load
|
2
|
+
- foo = capture do # This ActionView Helper is designed for ERB, but should work with haml
|
3
|
+
%div
|
4
|
+
%p.title Title
|
5
|
+
%p.text
|
6
|
+
Woah this is really crazy
|
7
|
+
I mean wow,
|
8
|
+
man.
|
9
|
+
- 3.times do
|
10
|
+
= foo
|
11
|
+
%p foo
|
12
|
+
- tab_up
|
13
|
+
%p reeeeeeeeeeeeeeeeeeeeeeeeeeeeeeally loooooooooooooooooong
|
14
|
+
- tab_down
|
15
|
+
.woah
|
16
|
+
#funky
|
17
|
+
= capture_haml do
|
18
|
+
%div
|
19
|
+
%h1 Big!
|
20
|
+
%p Small
|
21
|
+
/ Invisible
|
22
|
+
= capture do
|
23
|
+
.dilly
|
24
|
+
%p foo
|
25
|
+
%h1 bar
|
26
|
+
= surround '(', ')' do
|
27
|
+
%strong parentheses!
|
28
|
+
= precede '*' do
|
29
|
+
%span.small Not really
|
30
|
+
click
|
31
|
+
= succeed '.' do
|
32
|
+
%a{:href=>"thing"} here
|
33
|
+
%p baz
|
34
|
+
- haml_buffer.tabulation = 10
|
35
|
+
%p boom
|
36
|
+
- concat "foo\n"
|
37
|
+
- haml_buffer.tabulation = 0
|
38
|
+
-#
|
39
|
+
-# ActionPack pre-2.0 has weird url_for issues here.
|
40
|
+
- if ActionPack::VERSION::MAJOR < 2
|
41
|
+
:plain
|
42
|
+
<p>
|
43
|
+
<form action="" method="post">
|
44
|
+
</p>
|
45
|
+
<div>
|
46
|
+
<form action="" method="post">
|
47
|
+
<div><input name="commit" type="submit" value="save" /></div>
|
48
|
+
<p>
|
49
|
+
@foo =
|
50
|
+
value one
|
51
|
+
</p>
|
52
|
+
Toplevel? false
|
53
|
+
<p>
|
54
|
+
@foo =
|
55
|
+
value three
|
56
|
+
</p>
|
57
|
+
</form>
|
58
|
+
<form action="" method="post">
|
59
|
+
Title:
|
60
|
+
<input id="article_title" name="article[title]" size="30" type="text" value="Hello" />
|
61
|
+
Body:
|
62
|
+
<input id="article_body" name="article[body]" size="30" type="text" value="World" />
|
63
|
+
</form>
|
64
|
+
</div>
|
65
|
+
- else
|
66
|
+
%p
|
67
|
+
= form_tag ''
|
68
|
+
%div
|
69
|
+
- form_tag '' do
|
70
|
+
%div= submit_tag 'save'
|
71
|
+
- @foo = 'value one'
|
72
|
+
= test_partial 'partial'
|
73
|
+
- form_for :article, @article, :url => '' do |f|
|
74
|
+
Title:
|
75
|
+
= f.text_field :title
|
76
|
+
Body:
|
77
|
+
= f.text_field :body
|
78
|
+
= list_of({:google => 'http://www.google.com'}) do |name, link|
|
79
|
+
%a{ :href => link }= name
|
80
|
+
%p
|
81
|
+
- haml_concat "foo"
|
82
|
+
%div
|
83
|
+
- haml_concat "bar"
|
84
|
+
- haml_concat "boom"
|
85
|
+
baz
|
86
|
+
- haml_concat "boom, again"
|
87
|
+
- haml_tag :table do
|
88
|
+
- haml_tag :tr do
|
89
|
+
- haml_tag :td, {:class => 'cell'} do
|
90
|
+
- haml_tag :strong, "strong!"
|
91
|
+
- haml_concat "data"
|
92
|
+
- haml_tag :td do
|
93
|
+
- haml_concat "more_data"
|
94
|
+
- haml_tag :hr
|
95
|
+
- haml_tag :div, ''
|
@@ -0,0 +1,11 @@
|
|
1
|
+
%div[@article]
|
2
|
+
%h1= @article.title
|
3
|
+
%div= @article.body
|
4
|
+
#id[@article] id
|
5
|
+
.class[@article] class
|
6
|
+
#id.class[@article] id class
|
7
|
+
%div{:class => "article full"}[@article]= "boo"
|
8
|
+
%div{'class' => "article full"}[@article]= "moo"
|
9
|
+
%div.articleFull[@article]= "foo"
|
10
|
+
%span[@not_a_real_variable_and_will_be_nil]
|
11
|
+
Boo
|