hamlit 1.7.2 → 2.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 +4 -3
- data/.gitmodules +3 -0
- data/.travis.yml +25 -37
- data/CHANGELOG.md +18 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +23 -2
- data/README.md +106 -48
- data/REFERENCE.md +222 -0
- data/Rakefile +77 -19
- data/benchmark/boolean_attribute.haml +6 -0
- data/benchmark/class_attribute.haml +5 -0
- data/benchmark/common_attribute.haml +3 -0
- data/benchmark/data_attribute.haml +4 -0
- data/benchmark/dynamic_attributes/boolean_attribute.haml +4 -0
- data/benchmark/dynamic_attributes/class_attribute.haml +4 -0
- data/benchmark/dynamic_attributes/common_attribute.haml +2 -0
- data/benchmark/dynamic_attributes/data_attribute.haml +2 -0
- data/benchmark/dynamic_attributes/id_attribute.haml +2 -0
- data/benchmark/etc/attribute_builder.haml +5 -0
- data/benchmark/etc/real_sample.haml +888 -0
- data/benchmark/etc/real_sample.rb +11 -0
- data/benchmark/etc/static_analyzer.haml +1 -0
- data/benchmark/etc/tags.haml +3 -0
- data/benchmark/ext/build_data.rb +15 -0
- data/benchmark/ext/build_id.rb +13 -0
- data/benchmark/id_attribute.haml +3 -0
- data/benchmark/plain.haml +4 -0
- data/benchmark/script.haml +4 -0
- data/benchmark/slim/LICENSE +21 -0
- data/{benchmarks → benchmark/slim}/context.rb +2 -4
- data/benchmark/slim/run-benchmarks.rb +94 -0
- data/{benchmarks → benchmark/slim}/view.erb +3 -3
- data/{benchmarks → benchmark/slim}/view.haml +0 -0
- data/{benchmarks/view.escaped.slim → benchmark/slim/view.slim} +1 -1
- data/benchmark/string_interpolation.haml +2 -0
- data/benchmark/utils/benchmark_ips_extension.rb +43 -0
- data/bin/bench +85 -0
- data/bin/clone +14 -0
- data/bin/console +11 -0
- data/bin/lineprof +48 -0
- data/bin/ruby +3 -0
- data/bin/setup +7 -0
- data/bin/stackprof +27 -0
- data/{test → bin/test} +6 -10
- data/{bin → exe}/hamlit +0 -0
- data/ext/hamlit/extconf.rb +14 -0
- data/ext/hamlit/hamlit.c +512 -0
- data/ext/hamlit/houdini/.gitignore +3 -0
- data/ext/hamlit/houdini/COPYING +7 -0
- data/ext/hamlit/houdini/Makefile +79 -0
- data/ext/hamlit/houdini/README.md +59 -0
- data/ext/hamlit/houdini/buffer.c +249 -0
- data/ext/hamlit/houdini/buffer.h +113 -0
- data/ext/hamlit/houdini/houdini.h +46 -0
- data/ext/hamlit/houdini/houdini_href_e.c +115 -0
- data/ext/hamlit/houdini/houdini_html_e.c +90 -0
- data/ext/hamlit/houdini/houdini_html_u.c +122 -0
- data/ext/hamlit/houdini/houdini_js_e.c +90 -0
- data/ext/hamlit/houdini/houdini_js_u.c +60 -0
- data/ext/hamlit/houdini/houdini_uri_e.c +107 -0
- data/ext/hamlit/houdini/houdini_uri_u.c +68 -0
- data/ext/hamlit/houdini/houdini_xml_e.c +136 -0
- data/ext/hamlit/houdini/html_unescape.gperf +258 -0
- data/ext/hamlit/houdini/html_unescape.h +754 -0
- data/ext/hamlit/houdini/tools/build_table.py +13 -0
- data/ext/hamlit/houdini/tools/build_tables.c +51 -0
- data/ext/hamlit/houdini/tools/wikipedia_table.txt +2025 -0
- data/hamlit.gemspec +30 -31
- data/lib/hamlit.rb +3 -1
- data/lib/hamlit/attribute_builder.rb +12 -0
- data/lib/hamlit/cli.rb +44 -43
- data/lib/hamlit/compiler.rb +92 -16
- data/lib/hamlit/compiler/attribute_compiler.rb +148 -0
- data/lib/hamlit/compiler/children_compiler.rb +111 -0
- data/lib/hamlit/compiler/comment_compiler.rb +36 -0
- data/lib/hamlit/compiler/doctype_compiler.rb +45 -0
- data/lib/hamlit/compiler/script_compiler.rb +97 -0
- data/lib/hamlit/compiler/silent_script_compiler.rb +24 -0
- data/lib/hamlit/compiler/tag_compiler.rb +69 -0
- data/lib/hamlit/engine.rb +12 -7
- data/lib/hamlit/error.rb +14 -0
- data/lib/hamlit/escapable.rb +12 -0
- data/lib/hamlit/filters.rb +65 -0
- data/lib/hamlit/filters/base.rb +4 -62
- data/lib/hamlit/filters/coffee.rb +9 -7
- data/lib/hamlit/filters/css.rb +25 -8
- data/lib/hamlit/filters/erb.rb +4 -6
- data/lib/hamlit/filters/escaped.rb +11 -9
- data/lib/hamlit/filters/javascript.rb +25 -8
- data/lib/hamlit/filters/less.rb +9 -7
- data/lib/hamlit/filters/markdown.rb +5 -6
- data/lib/hamlit/filters/plain.rb +11 -15
- data/lib/hamlit/filters/preserve.rb +15 -5
- data/lib/hamlit/filters/ruby.rb +3 -5
- data/lib/hamlit/filters/sass.rb +9 -7
- data/lib/hamlit/filters/scss.rb +9 -7
- data/lib/hamlit/filters/text_base.rb +24 -0
- data/lib/hamlit/filters/tilt_base.rb +47 -0
- data/lib/hamlit/hash_parser.rb +107 -0
- data/lib/hamlit/html.rb +9 -6
- data/lib/hamlit/identity.rb +12 -0
- data/lib/hamlit/object_ref.rb +29 -0
- data/lib/hamlit/parser.rb +25 -142
- data/lib/hamlit/parser/MIT-LICENSE +20 -0
- data/lib/hamlit/parser/README.md +28 -0
- data/lib/hamlit/parser/haml_buffer.rb +348 -0
- data/lib/hamlit/parser/haml_compiler.rb +553 -0
- data/lib/hamlit/parser/haml_error.rb +61 -0
- data/lib/hamlit/parser/haml_helpers.rb +727 -0
- data/lib/hamlit/parser/haml_options.rb +286 -0
- data/lib/hamlit/parser/haml_parser.rb +801 -0
- data/lib/hamlit/parser/haml_util.rb +283 -0
- data/lib/hamlit/parser/haml_xss_mods.rb +109 -0
- data/lib/hamlit/{helpers.rb → rails_helpers.rb} +2 -7
- data/lib/hamlit/rails_template.rb +30 -0
- data/lib/hamlit/railtie.rb +1 -12
- data/lib/hamlit/ruby_expression.rb +31 -0
- data/lib/hamlit/static_analyzer.rb +49 -0
- data/lib/hamlit/string_interpolation.rb +69 -0
- data/lib/hamlit/template.rb +8 -0
- data/lib/hamlit/utils.rb +9 -0
- data/lib/hamlit/version.rb +1 -1
- metadata +116 -324
- data/.rspec +0 -2
- data/benchmarks/benchmark.rb +0 -110
- data/benchmarks/view.slim +0 -17
- data/doc/README.md +0 -19
- data/doc/engine/indent.md +0 -48
- data/doc/engine/new_attribute.md +0 -77
- data/doc/engine/old_attributes.md +0 -198
- data/doc/engine/silent_script.md +0 -97
- data/doc/engine/tag.md +0 -48
- data/doc/engine/text.md +0 -64
- data/doc/faml/README.md +0 -16
- data/doc/faml/engine/indent.md +0 -48
- data/doc/faml/engine/old_attributes.md +0 -111
- data/doc/faml/engine/silent_script.md +0 -97
- data/doc/faml/engine/text.md +0 -59
- data/doc/faml/filters/erb.md +0 -24
- data/doc/faml/filters/javascript.md +0 -27
- data/doc/faml/filters/less.md +0 -57
- data/doc/faml/filters/plain.md +0 -25
- data/doc/filters/erb.md +0 -31
- data/doc/filters/javascript.md +0 -83
- data/doc/filters/less.md +0 -57
- data/doc/filters/markdown.md +0 -31
- data/doc/filters/plain.md +0 -25
- data/doc/haml/README.md +0 -15
- data/doc/haml/engine/new_attribute.md +0 -77
- data/doc/haml/engine/old_attributes.md +0 -142
- data/doc/haml/engine/tag.md +0 -48
- data/doc/haml/engine/text.md +0 -29
- data/doc/haml/filters/erb.md +0 -26
- data/doc/haml/filters/javascript.md +0 -76
- data/doc/haml/filters/markdown.md +0 -31
- data/lib/hamlit/attribute.rb +0 -78
- data/lib/hamlit/compilers/attributes.rb +0 -108
- data/lib/hamlit/compilers/comment.rb +0 -13
- data/lib/hamlit/compilers/doctype.rb +0 -39
- data/lib/hamlit/compilers/filter.rb +0 -53
- data/lib/hamlit/compilers/new_attribute.rb +0 -115
- data/lib/hamlit/compilers/old_attribute.rb +0 -241
- data/lib/hamlit/compilers/runtime_attribute.rb +0 -58
- data/lib/hamlit/compilers/script.rb +0 -31
- data/lib/hamlit/compilers/strip.rb +0 -19
- data/lib/hamlit/compilers/text.rb +0 -111
- data/lib/hamlit/concerns/attribute_builder.rb +0 -22
- data/lib/hamlit/concerns/balanceable.rb +0 -68
- data/lib/hamlit/concerns/deprecation.rb +0 -20
- data/lib/hamlit/concerns/error.rb +0 -31
- data/lib/hamlit/concerns/escapable.rb +0 -17
- data/lib/hamlit/concerns/included.rb +0 -28
- data/lib/hamlit/concerns/indentable.rb +0 -117
- data/lib/hamlit/concerns/lexable.rb +0 -32
- data/lib/hamlit/concerns/line_reader.rb +0 -62
- data/lib/hamlit/concerns/registerable.rb +0 -24
- data/lib/hamlit/concerns/string_interpolation.rb +0 -48
- data/lib/hamlit/concerns/whitespace.rb +0 -91
- data/lib/hamlit/filters/tilt.rb +0 -41
- data/lib/hamlit/parsers/attribute.rb +0 -71
- data/lib/hamlit/parsers/comment.rb +0 -30
- data/lib/hamlit/parsers/doctype.rb +0 -18
- data/lib/hamlit/parsers/filter.rb +0 -18
- data/lib/hamlit/parsers/multiline.rb +0 -58
- data/lib/hamlit/parsers/script.rb +0 -126
- data/lib/hamlit/parsers/tag.rb +0 -83
- data/lib/hamlit/parsers/text.rb +0 -28
- data/lib/hamlit/temple.rb +0 -9
- data/release +0 -6
- data/spec/Rakefile +0 -72
- data/spec/hamlit/engine/comment_spec.rb +0 -56
- data/spec/hamlit/engine/doctype_spec.rb +0 -19
- data/spec/hamlit/engine/error_spec.rb +0 -135
- data/spec/hamlit/engine/indent_spec.rb +0 -42
- data/spec/hamlit/engine/multiline_spec.rb +0 -44
- data/spec/hamlit/engine/new_attribute_spec.rb +0 -110
- data/spec/hamlit/engine/old_attributes_spec.rb +0 -404
- data/spec/hamlit/engine/script_spec.rb +0 -116
- data/spec/hamlit/engine/silent_script_spec.rb +0 -213
- data/spec/hamlit/engine/tag_spec.rb +0 -295
- data/spec/hamlit/engine/text_spec.rb +0 -239
- data/spec/hamlit/engine_spec.rb +0 -58
- data/spec/hamlit/filters/coffee_spec.rb +0 -60
- data/spec/hamlit/filters/css_spec.rb +0 -33
- data/spec/hamlit/filters/erb_spec.rb +0 -16
- data/spec/hamlit/filters/javascript_spec.rb +0 -82
- data/spec/hamlit/filters/less_spec.rb +0 -37
- data/spec/hamlit/filters/markdown_spec.rb +0 -30
- data/spec/hamlit/filters/plain_spec.rb +0 -15
- data/spec/hamlit/filters/ruby_spec.rb +0 -24
- data/spec/hamlit/filters/sass_spec.rb +0 -33
- data/spec/hamlit/filters/scss_spec.rb +0 -37
- data/spec/hamlit/haml_spec.rb +0 -910
- data/spec/rails/.gitignore +0 -18
- data/spec/rails/.rspec +0 -2
- data/spec/rails/Gemfile +0 -19
- data/spec/rails/README.rdoc +0 -28
- data/spec/rails/Rakefile +0 -6
- data/spec/rails/app/assets/images/.keep +0 -0
- data/spec/rails/app/assets/javascripts/application.js +0 -15
- data/spec/rails/app/assets/stylesheets/application.css +0 -15
- data/spec/rails/app/controllers/application_controller.rb +0 -8
- data/spec/rails/app/controllers/concerns/.keep +0 -0
- data/spec/rails/app/controllers/users_controller.rb +0 -23
- data/spec/rails/app/helpers/application_helper.rb +0 -2
- data/spec/rails/app/mailers/.keep +0 -0
- data/spec/rails/app/models/.keep +0 -0
- data/spec/rails/app/models/concerns/.keep +0 -0
- data/spec/rails/app/views/application/index.html.haml +0 -18
- data/spec/rails/app/views/layouts/application.html.haml +0 -12
- data/spec/rails/app/views/users/capture.html.haml +0 -5
- data/spec/rails/app/views/users/capture_haml.html.haml +0 -5
- data/spec/rails/app/views/users/form.html.haml +0 -2
- data/spec/rails/app/views/users/helpers.html.haml +0 -10
- data/spec/rails/app/views/users/index.html.haml +0 -9
- data/spec/rails/app/views/users/inline.html.haml +0 -6
- data/spec/rails/app/views/users/old_attributes.html.haml +0 -5
- data/spec/rails/app/views/users/safe_buffer.html.haml +0 -4
- data/spec/rails/app/views/users/whitespace.html.haml +0 -4
- data/spec/rails/bin/bundle +0 -3
- data/spec/rails/bin/rails +0 -8
- data/spec/rails/bin/rake +0 -8
- data/spec/rails/bin/setup +0 -29
- data/spec/rails/bin/spring +0 -15
- data/spec/rails/config.ru +0 -4
- data/spec/rails/config/application.rb +0 -34
- data/spec/rails/config/boot.rb +0 -3
- data/spec/rails/config/database.yml +0 -25
- data/spec/rails/config/environment.rb +0 -5
- data/spec/rails/config/environments/development.rb +0 -41
- data/spec/rails/config/environments/production.rb +0 -79
- data/spec/rails/config/environments/test.rb +0 -42
- data/spec/rails/config/initializers/assets.rb +0 -11
- data/spec/rails/config/initializers/backtrace_silencers.rb +0 -7
- data/spec/rails/config/initializers/cookies_serializer.rb +0 -3
- data/spec/rails/config/initializers/filter_parameter_logging.rb +0 -4
- data/spec/rails/config/initializers/inflections.rb +0 -16
- data/spec/rails/config/initializers/mime_types.rb +0 -4
- data/spec/rails/config/initializers/session_store.rb +0 -3
- data/spec/rails/config/initializers/wrap_parameters.rb +0 -14
- data/spec/rails/config/locales/en.yml +0 -24
- data/spec/rails/config/routes.rb +0 -16
- data/spec/rails/config/secrets.yml +0 -22
- data/spec/rails/db/schema.rb +0 -16
- data/spec/rails/db/seeds.rb +0 -7
- data/spec/rails/lib/assets/.keep +0 -0
- data/spec/rails/lib/tasks/.keep +0 -0
- data/spec/rails/log/.keep +0 -0
- data/spec/rails/public/404.html +0 -67
- data/spec/rails/public/422.html +0 -67
- data/spec/rails/public/500.html +0 -66
- data/spec/rails/public/favicon.ico +0 -0
- data/spec/rails/public/robots.txt +0 -5
- data/spec/rails/spec/hamlit_spec.rb +0 -123
- data/spec/rails/spec/rails_helper.rb +0 -56
- data/spec/rails/spec/spec_helper.rb +0 -91
- data/spec/rails/vendor/assets/javascripts/.keep +0 -0
- data/spec/rails/vendor/assets/stylesheets/.keep +0 -0
- data/spec/spec_helper.rb +0 -36
- data/spec/spec_helper/document_generator.rb +0 -93
- data/spec/spec_helper/render_helper.rb +0 -120
- data/spec/spec_helper/test_case.rb +0 -55
data/.rspec
DELETED
data/benchmarks/benchmark.rb
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'), File.dirname(__FILE__))
|
4
|
-
|
5
|
-
require_relative './context'
|
6
|
-
require 'benchmark/ips'
|
7
|
-
|
8
|
-
require 'erubis'
|
9
|
-
require 'faml'
|
10
|
-
require 'haml'
|
11
|
-
require 'slim'
|
12
|
-
require 'hamlit'
|
13
|
-
|
14
|
-
class Benchmarks
|
15
|
-
def initialize(time, escape_enabled)
|
16
|
-
@time = time
|
17
|
-
@benches = []
|
18
|
-
@versions = {}
|
19
|
-
|
20
|
-
init_compiled_benches(escape_enabled)
|
21
|
-
if escape_enabled
|
22
|
-
init_escaped_benches
|
23
|
-
else
|
24
|
-
init_plain_benches
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def run
|
29
|
-
show_versions
|
30
|
-
result = Benchmark.ips do |x|
|
31
|
-
x.config(time: @time, warmup: 2)
|
32
|
-
@benches.each do |name, block|
|
33
|
-
x.report(name, &block)
|
34
|
-
end
|
35
|
-
x.compare!
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def init_compiled_benches(escape_enabled)
|
42
|
-
slim_path = "/view#{'.escaped' if escape_enabled}.slim"
|
43
|
-
@erb_code = File.read(File.dirname(__FILE__) + '/view.erb')
|
44
|
-
@haml_code = File.read(File.dirname(__FILE__) + '/view.haml')
|
45
|
-
@slim_code = File.read(File.dirname(__FILE__) + slim_path)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Totally the same as slim-template/slim's compiled bench.
|
49
|
-
def init_plain_benches
|
50
|
-
puts 'Compiled rendering benchmarks without HTML escape'
|
51
|
-
context = Context.new
|
52
|
-
define_plain_methods!(context)
|
53
|
-
|
54
|
-
bench('hamlit', Hamlit::VERSION) { context.run_hamlit }
|
55
|
-
bench('erubis', Erubis::VERSION) { context.run_erubis }
|
56
|
-
bench('slim', Slim::VERSION) { context.run_slim_ugly }
|
57
|
-
bench('haml', Haml::VERSION) { context.run_haml_ugly }
|
58
|
-
end
|
59
|
-
|
60
|
-
def define_plain_methods!(context)
|
61
|
-
haml_ugly = Haml::Engine.new(@haml_code, format: :html5, ugly: true)
|
62
|
-
haml_ugly.def_method(context, :run_haml_ugly)
|
63
|
-
context.instance_eval %{
|
64
|
-
def run_erubis; #{Erubis::Eruby.new(@erb_code).src}; end
|
65
|
-
def run_slim_ugly; #{Slim::Engine.new.call @slim_code}; end
|
66
|
-
def run_hamlit; #{Hamlit::Engine.new(escape_html: false).call @haml_code}; end
|
67
|
-
}
|
68
|
-
end
|
69
|
-
|
70
|
-
# slim-template/slim's compiled bench with HTML escaping.
|
71
|
-
def init_escaped_benches
|
72
|
-
puts 'Compiled rendering benchmarks with HTML escape'
|
73
|
-
context = Context.new
|
74
|
-
define_escaped_methods!(context)
|
75
|
-
|
76
|
-
bench('hamlit', Hamlit::VERSION) { context.run_hamlit }
|
77
|
-
bench('slim', Slim::VERSION) { context.run_slim_ugly }
|
78
|
-
bench('faml', Faml::VERSION) { context.run_faml }
|
79
|
-
bench('erubis', Erubis::VERSION) { context.run_erubis }
|
80
|
-
bench('haml', Haml::VERSION) { context.run_haml_ugly }
|
81
|
-
end
|
82
|
-
|
83
|
-
def define_escaped_methods!(context)
|
84
|
-
context.instance_eval("def header; '<script>'; end")
|
85
|
-
haml_ugly = Haml::Engine.new(@haml_code, format: :html5, ugly: true, escape_html: true)
|
86
|
-
haml_ugly.def_method(context, :run_haml_ugly)
|
87
|
-
context.instance_eval %{
|
88
|
-
def run_erubis; #{Erubis::EscapedEruby.new(@erb_code).src}; end
|
89
|
-
def run_slim_ugly; #{Slim::Engine.new.call @slim_code}; end
|
90
|
-
def run_faml; #{Faml::Engine.new.call @haml_code}; end
|
91
|
-
def run_hamlit; #{Hamlit::Engine.new.call @haml_code}; end
|
92
|
-
}
|
93
|
-
end
|
94
|
-
|
95
|
-
def bench(name, version, &block)
|
96
|
-
@benches.push([name, block])
|
97
|
-
@versions[name] = version
|
98
|
-
end
|
99
|
-
|
100
|
-
def show_versions
|
101
|
-
puts 'Versions ' + '-' * 40
|
102
|
-
@versions.each do |name, version|
|
103
|
-
printf "%20s %10s\n", name, "v#{version}"
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
time = (ENV['TIME'] || 5).to_i
|
109
|
-
bench = Benchmarks.new(time, ENV['HTML_ESCAPE'] == '1')
|
110
|
-
bench.run
|
data/benchmarks/view.slim
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
doctype html
|
2
|
-
html
|
3
|
-
head
|
4
|
-
title Simple Benchmark
|
5
|
-
body
|
6
|
-
h1 == header
|
7
|
-
- unless item.empty?
|
8
|
-
ul
|
9
|
-
- for i in item
|
10
|
-
- if i[:current]
|
11
|
-
li
|
12
|
-
strong == i[:name]
|
13
|
-
- else
|
14
|
-
li
|
15
|
-
a href==i[:url] == i[:name]
|
16
|
-
- else
|
17
|
-
p The list is empty.
|
data/doc/README.md
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
# Hamlit incompatibilities
|
2
|
-
This is a document generated from RSpec test cases.
|
3
|
-
Showing incompatibilities against [Haml](https://github.com/haml/haml) and [Faml](https://github.com/eagletmt/faml).
|
4
|
-
|
5
|
-
## engine
|
6
|
-
- [engine/indent\_spec.rb](engine/indent.md)
|
7
|
-
- [engine/new\_attribute\_spec.rb](engine/new_attribute.md)
|
8
|
-
- [engine/old\_attributes\_spec.rb](engine/old_attributes.md)
|
9
|
-
- [engine/silent\_script\_spec.rb](engine/silent_script.md)
|
10
|
-
- [engine/tag\_spec.rb](engine/tag.md)
|
11
|
-
- [engine/text\_spec.rb](engine/text.md)
|
12
|
-
|
13
|
-
|
14
|
-
## filters
|
15
|
-
- [filters/erb\_spec.rb](filters/erb.md)
|
16
|
-
- [filters/javascript\_spec.rb](filters/javascript.md)
|
17
|
-
- [filters/less\_spec.rb](filters/less.md)
|
18
|
-
- [filters/markdown\_spec.rb](filters/markdown.md)
|
19
|
-
- [filters/plain\_spec.rb](filters/plain.md)
|
data/doc/engine/indent.md
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
# [indent\_spec.rb:3](/spec/hamlit/engine/indent_spec.rb#L3)
|
2
|
-
## Input
|
3
|
-
```haml
|
4
|
-
%p
|
5
|
-
%a
|
6
|
-
|
7
|
-
```
|
8
|
-
|
9
|
-
## Output
|
10
|
-
### Haml, Hamlit
|
11
|
-
```html
|
12
|
-
<p>
|
13
|
-
<a></a>
|
14
|
-
</p>
|
15
|
-
|
16
|
-
```
|
17
|
-
|
18
|
-
### Faml
|
19
|
-
```html
|
20
|
-
Faml::IndentTracker::HardTabNotAllowed: Indentation with hard tabs are not allowed :-p
|
21
|
-
```
|
22
|
-
|
23
|
-
|
24
|
-
# [indent\_spec.rb:28](/spec/hamlit/engine/indent_spec.rb#L28)
|
25
|
-
## Input
|
26
|
-
```haml
|
27
|
-
%p
|
28
|
-
%span
|
29
|
-
foo
|
30
|
-
|
31
|
-
```
|
32
|
-
|
33
|
-
## Output
|
34
|
-
### Haml, Hamlit
|
35
|
-
```html
|
36
|
-
<p>
|
37
|
-
<span>
|
38
|
-
foo
|
39
|
-
</span>
|
40
|
-
</p>
|
41
|
-
|
42
|
-
```
|
43
|
-
|
44
|
-
### Faml
|
45
|
-
```html
|
46
|
-
Faml::IndentTracker::HardTabNotAllowed: Indentation with hard tabs are not allowed :-p
|
47
|
-
```
|
48
|
-
|
data/doc/engine/new_attribute.md
DELETED
@@ -1,77 +0,0 @@
|
|
1
|
-
# [new\_attribute\_spec.rb:19](/spec/hamlit/engine/new_attribute_spec.rb#L19)
|
2
|
-
## Input
|
3
|
-
```haml
|
4
|
-
%span(a=__LINE__
|
5
|
-
b=__LINE__)
|
6
|
-
= __LINE__
|
7
|
-
|
8
|
-
```
|
9
|
-
|
10
|
-
## Output
|
11
|
-
### Haml
|
12
|
-
```html
|
13
|
-
<span a='1' b='1'></span>
|
14
|
-
3
|
15
|
-
|
16
|
-
```
|
17
|
-
|
18
|
-
### Faml, Hamlit
|
19
|
-
```html
|
20
|
-
<span a='1' b='2'></span>
|
21
|
-
3
|
22
|
-
|
23
|
-
```
|
24
|
-
|
25
|
-
|
26
|
-
# [new\_attribute\_spec.rb:47](/spec/hamlit/engine/new_attribute_spec.rb#L47)
|
27
|
-
## Input
|
28
|
-
```haml
|
29
|
-
%a(title="'")
|
30
|
-
%a(title = "'\"")
|
31
|
-
%a(href='/search?foo=bar&hoge=<fuga>')
|
32
|
-
|
33
|
-
```
|
34
|
-
|
35
|
-
## Output
|
36
|
-
### Haml
|
37
|
-
```html
|
38
|
-
<a title="'"></a>
|
39
|
-
<a title=''"'></a>
|
40
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
41
|
-
|
42
|
-
```
|
43
|
-
|
44
|
-
### Faml, Hamlit
|
45
|
-
```html
|
46
|
-
<a title='''></a>
|
47
|
-
<a title=''"'></a>
|
48
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
49
|
-
|
50
|
-
```
|
51
|
-
|
52
|
-
|
53
|
-
# [new\_attribute\_spec.rb:59](/spec/hamlit/engine/new_attribute_spec.rb#L59)
|
54
|
-
## Input
|
55
|
-
```haml
|
56
|
-
- title = "'\""
|
57
|
-
- href = '/search?foo=bar&hoge=<fuga>'
|
58
|
-
%a(title=title)
|
59
|
-
%a(href=href)
|
60
|
-
|
61
|
-
```
|
62
|
-
|
63
|
-
## Output
|
64
|
-
### Haml
|
65
|
-
```html
|
66
|
-
<a title=''"'></a>
|
67
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
68
|
-
|
69
|
-
```
|
70
|
-
|
71
|
-
### Faml, Hamlit
|
72
|
-
```html
|
73
|
-
<a title=''"'></a>
|
74
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
75
|
-
|
76
|
-
```
|
77
|
-
|
@@ -1,198 +0,0 @@
|
|
1
|
-
# [old\_attributes\_spec.rb:43](/spec/hamlit/engine/old_attributes_spec.rb#L43)
|
2
|
-
## Input
|
3
|
-
```haml
|
4
|
-
%span{ class: '}}}', id: '{}}' } }{
|
5
|
-
|
6
|
-
```
|
7
|
-
|
8
|
-
## Output
|
9
|
-
### Haml
|
10
|
-
```html
|
11
|
-
Haml::SyntaxError: (haml):1: syntax error, unexpected tSTRING_DEND, expecting ')'
|
12
|
-
...l, class: ')}>}}', id: '{}}' } }{</span>\n";;_erbout
|
13
|
-
... ^
|
14
|
-
(haml):1: unterminated regexp meets end of file
|
15
|
-
```
|
16
|
-
|
17
|
-
### Faml
|
18
|
-
```html
|
19
|
-
Faml::Compiler::UnparsableRubyCode: Unparsable Ruby code is given to attributes: class: '
|
20
|
-
```
|
21
|
-
|
22
|
-
### Hamlit
|
23
|
-
```html
|
24
|
-
<span class='}}}' id='{}}'>}{</span>
|
25
|
-
|
26
|
-
```
|
27
|
-
|
28
|
-
|
29
|
-
# [old\_attributes\_spec.rb:132](/spec/hamlit/engine/old_attributes_spec.rb#L132)
|
30
|
-
## Input
|
31
|
-
```haml
|
32
|
-
.foo{ class: ['bar'] }
|
33
|
-
.foo{ class: ['bar', 'foo'] }
|
34
|
-
.foo{ class: ['bar', nil] }
|
35
|
-
.foo{ class: ['bar', 'baz'] }
|
36
|
-
|
37
|
-
```
|
38
|
-
|
39
|
-
## Output
|
40
|
-
### Haml, Hamlit
|
41
|
-
```html
|
42
|
-
<div class='bar foo'></div>
|
43
|
-
<div class='bar foo'></div>
|
44
|
-
<div class='bar foo'></div>
|
45
|
-
<div class='bar baz foo'></div>
|
46
|
-
|
47
|
-
```
|
48
|
-
|
49
|
-
### Faml
|
50
|
-
```html
|
51
|
-
<div class='bar foo'></div>
|
52
|
-
<div class='bar foo'></div>
|
53
|
-
<div class=' bar foo'></div>
|
54
|
-
<div class='bar baz foo'></div>
|
55
|
-
|
56
|
-
```
|
57
|
-
|
58
|
-
|
59
|
-
# [old\_attributes\_spec.rb:211](/spec/hamlit/engine/old_attributes_spec.rb#L211)
|
60
|
-
## Input
|
61
|
-
```haml
|
62
|
-
/ wontfix: Non-boolean attributes are not escaped for optimization.
|
63
|
-
- val = false
|
64
|
-
%a{ href: val }
|
65
|
-
- val = nil
|
66
|
-
%a{ href: val }
|
67
|
-
|
68
|
-
/ Boolean attributes are escaped correctly.
|
69
|
-
- val = false
|
70
|
-
%a{ disabled: val }
|
71
|
-
- val = nil
|
72
|
-
%a{ disabled: val }
|
73
|
-
|
74
|
-
```
|
75
|
-
|
76
|
-
## Output
|
77
|
-
### Haml, Faml
|
78
|
-
```html
|
79
|
-
<!-- wontfix: Non-boolean attributes are not escaped for optimization. -->
|
80
|
-
<a></a>
|
81
|
-
<a></a>
|
82
|
-
<!-- Boolean attributes are escaped correctly. -->
|
83
|
-
<a></a>
|
84
|
-
<a></a>
|
85
|
-
|
86
|
-
```
|
87
|
-
|
88
|
-
### Hamlit
|
89
|
-
```html
|
90
|
-
<!-- wontfix: Non-boolean attributes are not escaped for optimization. -->
|
91
|
-
<a href='false'></a>
|
92
|
-
<a href=''></a>
|
93
|
-
<!-- Boolean attributes are escaped correctly. -->
|
94
|
-
<a></a>
|
95
|
-
<a></a>
|
96
|
-
|
97
|
-
```
|
98
|
-
|
99
|
-
|
100
|
-
# [old\_attributes\_spec.rb:236](/spec/hamlit/engine/old_attributes_spec.rb#L236)
|
101
|
-
## Input
|
102
|
-
```haml
|
103
|
-
%a{title: "'"}
|
104
|
-
%a{title: "'\""}
|
105
|
-
%a{href: '/search?foo=bar&hoge=<fuga>'}
|
106
|
-
|
107
|
-
```
|
108
|
-
|
109
|
-
## Output
|
110
|
-
### Haml
|
111
|
-
```html
|
112
|
-
<a title="'"></a>
|
113
|
-
<a title=''"'></a>
|
114
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
115
|
-
|
116
|
-
```
|
117
|
-
|
118
|
-
### Faml, Hamlit
|
119
|
-
```html
|
120
|
-
<a title='''></a>
|
121
|
-
<a title=''"'></a>
|
122
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
123
|
-
|
124
|
-
```
|
125
|
-
|
126
|
-
|
127
|
-
# [old\_attributes\_spec.rb:248](/spec/hamlit/engine/old_attributes_spec.rb#L248)
|
128
|
-
## Input
|
129
|
-
```haml
|
130
|
-
- title = "'\""
|
131
|
-
- href = '/search?foo=bar&hoge=<fuga>'
|
132
|
-
%a{title: title}
|
133
|
-
%a{href: href}
|
134
|
-
|
135
|
-
```
|
136
|
-
|
137
|
-
## Output
|
138
|
-
### Haml
|
139
|
-
```html
|
140
|
-
<a title=''"'></a>
|
141
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
142
|
-
|
143
|
-
```
|
144
|
-
|
145
|
-
### Faml, Hamlit
|
146
|
-
```html
|
147
|
-
<a title=''"'></a>
|
148
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
149
|
-
|
150
|
-
```
|
151
|
-
|
152
|
-
|
153
|
-
# [old\_attributes\_spec.rb:260](/spec/hamlit/engine/old_attributes_spec.rb#L260)
|
154
|
-
## Input
|
155
|
-
```haml
|
156
|
-
- title = { title: "'\"" }
|
157
|
-
- href = { href: '/search?foo=bar&hoge=<fuga>' }
|
158
|
-
%a{ title }
|
159
|
-
%a{ href }
|
160
|
-
|
161
|
-
```
|
162
|
-
|
163
|
-
## Output
|
164
|
-
### Haml
|
165
|
-
```html
|
166
|
-
<a title=''"'></a>
|
167
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
168
|
-
|
169
|
-
```
|
170
|
-
|
171
|
-
### Faml, Hamlit
|
172
|
-
```html
|
173
|
-
<a title=''"'></a>
|
174
|
-
<a href='/search?foo=bar&hoge=<fuga>'></a>
|
175
|
-
|
176
|
-
```
|
177
|
-
|
178
|
-
|
179
|
-
# [old\_attributes\_spec.rb:283](/spec/hamlit/engine/old_attributes_spec.rb#L283)
|
180
|
-
## Input
|
181
|
-
```haml
|
182
|
-
%span{ data: { disable: true } } bar
|
183
|
-
|
184
|
-
```
|
185
|
-
|
186
|
-
## Output
|
187
|
-
### Haml, Hamlit
|
188
|
-
```html
|
189
|
-
<span data-disable>bar</span>
|
190
|
-
|
191
|
-
```
|
192
|
-
|
193
|
-
### Faml
|
194
|
-
```html
|
195
|
-
<span data-disable='true'>bar</span>
|
196
|
-
|
197
|
-
```
|
198
|
-
|