haml 5.0.0 → 5.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +18 -0
- data/.gitmodules +3 -0
- data/.travis.yml +38 -0
- data/CHANGELOG.md +43 -19
- data/Gemfile +18 -0
- data/README.md +1 -0
- data/Rakefile +6 -12
- data/TODO +24 -0
- data/benchmark.rb +66 -0
- data/haml.gemspec +39 -0
- data/lib/haml/.gitattributes +1 -0
- data/lib/haml/attribute_parser.rb +4 -0
- data/lib/haml/compiler.rb +2 -1
- data/lib/haml/helpers/safe_erubi_template.rb +0 -8
- data/lib/haml/options.rb +3 -0
- data/lib/haml/railtie.rb +11 -2
- data/lib/haml/temple_engine.rb +1 -0
- data/lib/haml/version.rb +1 -1
- data/test/attribute_parser_test.rb +4 -0
- data/test/engine_test.rb +7 -0
- data/test/filters_test.rb +2 -7
- data/test/template_test.rb +10 -0
- data/yard/default/.gitignore +1 -0
- data/yard/default/fulldoc/html/css/common.sass +15 -0
- data/yard/default/layout/html/footer.erb +12 -0
- metadata +13 -65
- data/test/erb/_av_partial_1.erb +0 -12
- data/test/erb/_av_partial_2.erb +0 -8
- data/test/erb/action_view.erb +0 -62
- data/test/erb/standard.erb +0 -55
- data/test/gemfiles/Gemfile.rails-4.0.x +0 -11
- data/test/gemfiles/Gemfile.rails-4.0.x.lock +0 -87
- data/test/gemfiles/Gemfile.rails-4.1.x +0 -5
- data/test/gemfiles/Gemfile.rails-4.2.x +0 -5
- data/test/gemfiles/Gemfile.rails-5.0.x +0 -4
- data/test/markaby/standard.mab +0 -52
- data/test/mocks/article.rb +0 -6
- data/test/results/bemit.xhtml +0 -4
- data/test/results/content_for_layout.xhtml +0 -12
- data/test/results/eval_suppressed.xhtml +0 -9
- data/test/results/helpers.xhtml +0 -72
- data/test/results/helpful.xhtml +0 -13
- data/test/results/just_stuff.xhtml +0 -71
- data/test/results/list.xhtml +0 -12
- data/test/results/nuke_inner_whitespace.xhtml +0 -40
- data/test/results/nuke_outer_whitespace.xhtml +0 -140
- data/test/results/original_engine.xhtml +0 -20
- data/test/results/partial_layout.xhtml +0 -6
- data/test/results/partial_layout_erb.xhtml +0 -6
- data/test/results/partials.xhtml +0 -22
- data/test/results/render_layout.xhtml +0 -3
- data/test/results/silent_script.xhtml +0 -74
- data/test/results/standard.xhtml +0 -159
- data/test/results/tag_parsing.xhtml +0 -23
- data/test/results/very_basic.xhtml +0 -5
- data/test/results/whitespace_handling.xhtml +0 -91
- data/test/template_test_helper.rb +0 -38
- data/test/templates/_av_partial_1.haml +0 -9
- data/test/templates/_av_partial_2.haml +0 -5
- data/test/templates/_layout.erb +0 -3
- data/test/templates/_layout_for_partial.haml +0 -3
- data/test/templates/_partial.haml +0 -8
- data/test/templates/_text_area.haml +0 -3
- data/test/templates/_text_area_helper.html.haml +0 -4
- data/test/templates/action_view.haml +0 -47
- data/test/templates/bemit.haml +0 -3
- data/test/templates/breakage.haml +0 -8
- data/test/templates/content_for_layout.haml +0 -8
- data/test/templates/eval_suppressed.haml +0 -11
- data/test/templates/helpers.haml +0 -55
- data/test/templates/helpful.haml +0 -11
- data/test/templates/just_stuff.haml +0 -86
- data/test/templates/list.haml +0 -12
- data/test/templates/nuke_inner_whitespace.haml +0 -32
- data/test/templates/nuke_outer_whitespace.haml +0 -144
- data/test/templates/original_engine.haml +0 -17
- data/test/templates/partial_layout.haml +0 -3
- data/test/templates/partial_layout_erb.erb +0 -4
- data/test/templates/partialize.haml +0 -1
- data/test/templates/partials.haml +0 -12
- data/test/templates/render_layout.haml +0 -2
- data/test/templates/silent_script.haml +0 -45
- data/test/templates/standard.haml +0 -43
- data/test/templates/standard_ugly.haml +0 -1
- data/test/templates/tag_parsing.haml +0 -21
- data/test/templates/very_basic.haml +0 -4
- data/test/templates/whitespace_handling.haml +0 -87
- data/test/templates/with_bom.haml +0 -1
- data/test/test_helper.rb +0 -99
@@ -1,17 +0,0 @@
|
|
1
|
-
!!!
|
2
|
-
%html
|
3
|
-
%head
|
4
|
-
%title Stop. haml time
|
5
|
-
#content
|
6
|
-
%h1 This is a title!
|
7
|
-
%p Lorem ipsum dolor sit amet, consectetur adipisicing elit
|
8
|
-
%p{:class => 'foo'} Cigarettes!
|
9
|
-
%h2 Man alive!
|
10
|
-
%ul.things
|
11
|
-
%li Slippers
|
12
|
-
%li Shoes
|
13
|
-
%li Bathrobe
|
14
|
-
%li Coffee
|
15
|
-
%pre
|
16
|
-
This is some text that's in a pre block!
|
17
|
-
Let's see what happens when it's rendered! What about now, since we're on a new line?
|
@@ -1 +0,0 @@
|
|
1
|
-
= render :file => "#{name}.haml"
|
@@ -1,45 +0,0 @@
|
|
1
|
-
%div
|
2
|
-
%h1 I can count!
|
3
|
-
- (1..20).each do |i|
|
4
|
-
= i
|
5
|
-
%h1 I know my ABCs!
|
6
|
-
%ul
|
7
|
-
- ('a'..'z').each do |i|
|
8
|
-
%li= i
|
9
|
-
%h1 I can catch errors!
|
10
|
-
- begin
|
11
|
-
- raise "foo"
|
12
|
-
- rescue RuntimeError => e
|
13
|
-
= "Oh no! \"#{e}\" happened!"
|
14
|
-
%p
|
15
|
-
"false" is:
|
16
|
-
- if false
|
17
|
-
= "true"
|
18
|
-
- else
|
19
|
-
= "false"
|
20
|
-
- if true
|
21
|
-
- 5.times do |i|
|
22
|
-
- if i % 2 == 1
|
23
|
-
Odd!
|
24
|
-
- else
|
25
|
-
Even!
|
26
|
-
- unless true
|
27
|
-
Testing else indent
|
28
|
-
- case 1
|
29
|
-
- when 2
|
30
|
-
Also testing else indent
|
31
|
-
- else
|
32
|
-
= "This can't happen!"
|
33
|
-
- 13 |
|
34
|
-
.foo
|
35
|
-
%strong foobar
|
36
|
-
- 5.times |
|
37
|
-
do |
|
38
|
-
|a| |
|
39
|
-
%strong= a
|
40
|
-
.test
|
41
|
-
- "foo |
|
42
|
-
bar |
|
43
|
-
baz" |
|
44
|
-
|
45
|
-
%p boom
|
@@ -1,43 +0,0 @@
|
|
1
|
-
!!!
|
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
|
5
|
-
%meta{"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}
|
6
|
-
%body
|
7
|
-
/ You're In my house now!
|
8
|
-
.header
|
9
|
-
Yes, ladies and gentileman. He is just that egotistical.
|
10
|
-
Fantastic! This should be multi-line output
|
11
|
-
The question is if this would translate! Ahah!
|
12
|
-
= 1 + 9 + 8 + 2 #numbers should work and this should be ignored
|
13
|
-
#body= " Quotes should be loved! Just like people!"
|
14
|
-
- 120.times do |number|
|
15
|
-
= number
|
16
|
-
Wow.|
|
17
|
-
%p{:code => 1 + 2}
|
18
|
-
= "Holy cow " + |
|
19
|
-
"multiline " + |
|
20
|
-
"tags! " + |
|
21
|
-
"A pipe (|) even!" |
|
22
|
-
= [1, 2, 3].collect { |n| "PipesIgnored|" }.join
|
23
|
-
= [1, 2, 3].collect { |n| |
|
24
|
-
n.to_s |
|
25
|
-
}.join("|") |
|
26
|
-
- bar = 17
|
27
|
-
%div.silent{:foo => bar}
|
28
|
-
- foo = String.new
|
29
|
-
- foo << "this"
|
30
|
-
- foo << " shouldn't"
|
31
|
-
- foo << " evaluate"
|
32
|
-
= foo + " but now it should!"
|
33
|
-
-# Woah crap a comment!
|
34
|
-
|
35
|
-
-# That was a line that shouldn't close everything.
|
36
|
-
%ul.really.cool
|
37
|
-
- ('a'..'f').each do |a|
|
38
|
-
%li= a
|
39
|
-
#combo.of_divs_with_underscore= @should_eval = "with this text"
|
40
|
-
= "foo".each_line do |line|
|
41
|
-
- nil
|
42
|
-
.footer
|
43
|
-
%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"
|
@@ -1 +0,0 @@
|
|
1
|
-
test/templates/standard.haml
|
@@ -1,21 +0,0 @@
|
|
1
|
-
%div.tags
|
2
|
-
%foo 1
|
3
|
-
%FOO 2
|
4
|
-
%fooBAR 3
|
5
|
-
%fooBar 4
|
6
|
-
%foo_bar 5
|
7
|
-
%foo-bar 6
|
8
|
-
%foo:bar 7
|
9
|
-
%foo.bar 8
|
10
|
-
%fooBAr_baz:boom_bar 9
|
11
|
-
%foo13 10
|
12
|
-
%foo2u 11
|
13
|
-
%div.classes
|
14
|
-
%p.foo.bar#baz#boom
|
15
|
-
.fooBar a
|
16
|
-
.foo-bar b
|
17
|
-
.foo_bar c
|
18
|
-
.FOOBAR d
|
19
|
-
.foo16 e
|
20
|
-
.123 f
|
21
|
-
.foo2u g
|
@@ -1,87 +0,0 @@
|
|
1
|
-
#whitespace_test
|
2
|
-
= test_partial "text_area", :value => "Oneline"
|
3
|
-
= test_partial "text_area", :value => "Two\nlines"
|
4
|
-
~ test_partial "text_area", :value => "Oneline"
|
5
|
-
~ test_partial "text_area", :value => "Two\nlines"
|
6
|
-
#flattened~ test_partial "text_area", :value => "Two\nlines"
|
7
|
-
.hithere
|
8
|
-
~ "Foo bar"
|
9
|
-
~ "<pre>foo bar</pre>"
|
10
|
-
~ "<pre>foo\nbar</pre>"
|
11
|
-
%p~ "<pre>foo\nbar</pre>"
|
12
|
-
%p~ "foo\nbar"
|
13
|
-
.foo
|
14
|
-
~ 13
|
15
|
-
~ "<textarea>\na\n</textarea>".each_line do |l|
|
16
|
-
- haml_concat l.strip
|
17
|
-
#whitespace_test
|
18
|
-
= test_partial "text_area", :value => "Oneline"
|
19
|
-
= test_partial "text_area", :value => "Two\nlines"
|
20
|
-
= find_and_preserve test_partial("text_area", :value => "Oneline")
|
21
|
-
= find_and_preserve test_partial("text_area", :value => "Two\nlines")
|
22
|
-
#flattened= find_and_preserve test_partial("text_area", :value => "Two\nlines")
|
23
|
-
.hithere
|
24
|
-
= find_and_preserve("Foo bar")
|
25
|
-
= find_and_preserve("<pre>foo bar</pre>")
|
26
|
-
= find_and_preserve("<pre>foo\nbar</pre>")
|
27
|
-
%p= find_and_preserve("<pre>foo\nbar</pre>")
|
28
|
-
%p= find_and_preserve("foo\nbar")
|
29
|
-
%pre
|
30
|
-
:preserve
|
31
|
-
___
|
32
|
-
,o88888
|
33
|
-
,o8888888'
|
34
|
-
,:o:o:oooo. ,8O88Pd8888"
|
35
|
-
,.::.::o:ooooOoOoO. ,oO8O8Pd888'"
|
36
|
-
,.:.::o:ooOoOoOO8O8OOo.8OOPd8O8O"
|
37
|
-
, ..:.::o:ooOoOOOO8OOOOo.FdO8O8"
|
38
|
-
, ..:.::o:ooOoOO8O888O8O,COCOO"
|
39
|
-
, . ..:.::o:ooOoOOOO8OOOOCOCO"
|
40
|
-
. ..:.::o:ooOoOoOO8O8OCCCC"o
|
41
|
-
. ..:.::o:ooooOoCoCCC"o:o
|
42
|
-
. ..:.::o:o:,cooooCo"oo:o:
|
43
|
-
` . . ..:.:cocoooo"'o:o:::'
|
44
|
-
.` . ..::ccccoc"'o:o:o:::'
|
45
|
-
:.:. ,c:cccc"':.:.:.:.:.'
|
46
|
-
..:.:"'`::::c:"'..:.:.:.:.:.' http://www.chris.com/ASCII/
|
47
|
-
...:.'.:.::::"' . . . . .'
|
48
|
-
.. . ....:."' ` . . . ''
|
49
|
-
. . . ...."'
|
50
|
-
.. . ."' -hrr-
|
51
|
-
.
|
52
|
-
|
53
|
-
|
54
|
-
It's a planet!
|
55
|
-
%strong This shouldn't be bold!
|
56
|
-
%strong This should!
|
57
|
-
%textarea
|
58
|
-
:preserve
|
59
|
-
___ ___ ___ ___
|
60
|
-
/\__\ /\ \ /\__\ /\__\
|
61
|
-
/:/ / /::\ \ /::| | /:/ /
|
62
|
-
/:/__/ /:/\:\ \ /:|:| | /:/ /
|
63
|
-
/::\ \ ___ /::\~\:\ \ /:/|:|__|__ /:/ /
|
64
|
-
/:/\:\ /\__\ /:/\:\ \:\__\ /:/ |::::\__\ /:/__/
|
65
|
-
\/__\:\/:/ / \/__\:\/:/ / \/__/~~/:/ / \:\ \
|
66
|
-
\::/ / \::/ / /:/ / \:\ \
|
67
|
-
/:/ / /:/ / /:/ / \:\ \
|
68
|
-
/:/ / /:/ / /:/ / \:\__\
|
69
|
-
\/__/ \/__/ \/__/ \/__/
|
70
|
-
|
71
|
-
Many
|
72
|
-
thanks
|
73
|
-
to
|
74
|
-
http://www.network-science.de/ascii/
|
75
|
-
%strong indeed!
|
76
|
-
.foo
|
77
|
-
= find_and_preserve(13)
|
78
|
-
%pre
|
79
|
-
:preserve
|
80
|
-
__ ______ __ ______
|
81
|
-
.----.| |--.|__ |.----.| |--..--------.| __ |
|
82
|
-
| __|| ||__ || __|| < | || __ |
|
83
|
-
|____||__|__||______||____||__|__||__|__|__||______|
|
84
|
-
%pre
|
85
|
-
:preserve
|
86
|
-
foo
|
87
|
-
bar
|
@@ -1 +0,0 @@
|
|
1
|
-
BOMG
|
data/test/test_helper.rb
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
begin
|
2
|
-
if ENV['TRAVIS'] && RUBY_VERSION == '2.1.2' && !defined?(Rubinius)
|
3
|
-
require 'coveralls'
|
4
|
-
Coveralls.wear!
|
5
|
-
end
|
6
|
-
rescue LoadError
|
7
|
-
# ignore error for other test Gemfiles
|
8
|
-
end
|
9
|
-
|
10
|
-
if ENV["COVERAGE"]
|
11
|
-
require "simplecov"
|
12
|
-
SimpleCov.start
|
13
|
-
end
|
14
|
-
|
15
|
-
require 'bundler/setup'
|
16
|
-
require 'minitest/autorun'
|
17
|
-
require 'action_pack'
|
18
|
-
require 'action_controller'
|
19
|
-
require 'action_view'
|
20
|
-
require 'action_view/base'
|
21
|
-
require 'nokogiri'
|
22
|
-
require 'rails'
|
23
|
-
|
24
|
-
if defined?(I18n.enforce_available_locales)
|
25
|
-
I18n.enforce_available_locales = true
|
26
|
-
end
|
27
|
-
|
28
|
-
class TestApp < Rails::Application
|
29
|
-
config.eager_load = false
|
30
|
-
config.root = ""
|
31
|
-
end
|
32
|
-
Rails.application = TestApp
|
33
|
-
|
34
|
-
ActionController::Base.logger = Logger.new(nil)
|
35
|
-
|
36
|
-
require 'fileutils'
|
37
|
-
|
38
|
-
$VERBOSE = true
|
39
|
-
|
40
|
-
require 'haml'
|
41
|
-
require 'haml/template'
|
42
|
-
|
43
|
-
TestApp.initialize!
|
44
|
-
|
45
|
-
Haml::Template.options[:format] = :xhtml
|
46
|
-
|
47
|
-
BASE_TEST_CLASS = if defined?(Minitest::Test)
|
48
|
-
Minitest::Test
|
49
|
-
else
|
50
|
-
MiniTest::Unit::TestCase
|
51
|
-
end
|
52
|
-
|
53
|
-
module Declarative
|
54
|
-
def test(name, &block)
|
55
|
-
define_method("test_ #{name}", &block)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
class Haml::TestCase < BASE_TEST_CLASS
|
60
|
-
extend Declarative
|
61
|
-
|
62
|
-
def render(text, options = {}, base = nil, &block)
|
63
|
-
scope = options.delete(:scope) || Object.new
|
64
|
-
locals = options.delete(:locals) || {}
|
65
|
-
engine = Haml::Engine.new(text, options)
|
66
|
-
return engine.to_html(base) if base
|
67
|
-
engine.to_html(scope, locals, &block)
|
68
|
-
end
|
69
|
-
|
70
|
-
def assert_warning(message)
|
71
|
-
the_real_stderr, $stderr = $stderr, StringIO.new
|
72
|
-
yield
|
73
|
-
|
74
|
-
if message.is_a?(Regexp)
|
75
|
-
assert_match message, $stderr.string.strip
|
76
|
-
else
|
77
|
-
assert_equal message.strip, $stderr.string.strip
|
78
|
-
end
|
79
|
-
ensure
|
80
|
-
$stderr = the_real_stderr
|
81
|
-
end
|
82
|
-
|
83
|
-
def silence_warnings(&block)
|
84
|
-
Haml::Util.silence_warnings(&block)
|
85
|
-
end
|
86
|
-
|
87
|
-
def assert_raises_message(klass, message)
|
88
|
-
yield
|
89
|
-
rescue Exception => e
|
90
|
-
assert_instance_of(klass, e)
|
91
|
-
assert_equal(message, e.message)
|
92
|
-
else
|
93
|
-
flunk "Expected exception #{klass}, none raised"
|
94
|
-
end
|
95
|
-
|
96
|
-
def self.error(*args)
|
97
|
-
Haml::Error.message(*args)
|
98
|
-
end
|
99
|
-
end
|