faml 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/benchmark/compiling.rb +1 -0
- data/benchmark/context.rb +1 -0
- data/benchmark/rendering.rb +1 -0
- data/benchmark/slim.rb +1 -0
- data/ext/attribute_builder/extconf.rb +1 -0
- data/faml.gemspec +1 -1
- data/haml_spec_test.rb +1 -0
- data/incompatibilities/README.md +1 -1
- data/incompatibilities/spec/compiler_newline_spec.md +1 -1
- data/incompatibilities/spec/render/attribute_spec.md +314 -28
- data/incompatibilities/spec/render/comment_spec.md +1 -1
- data/incompatibilities/spec/render/doctype_spec.md +1 -1
- data/incompatibilities/spec/render/element_spec.md +1 -1
- data/incompatibilities/spec/render/filters/cdata_spec.md +1 -1
- data/incompatibilities/spec/render/filters/css_spec.md +1 -1
- data/incompatibilities/spec/render/filters/escaped_spec.md +1 -1
- data/incompatibilities/spec/render/filters/javascript_spec.md +1 -1
- data/incompatibilities/spec/render/filters/markdown_spec.md +1 -1
- data/incompatibilities/spec/render/filters/plain_spec.md +2 -2
- data/incompatibilities/spec/render/filters/preserve_spec.md +1 -1
- data/incompatibilities/spec/render/helpers_spec.md +2 -2
- data/incompatibilities/spec/render/multiline_spec.md +2 -2
- data/incompatibilities/spec/render/newline_spec.md +4 -4
- data/incompatibilities/spec/render/plain_spec.md +1 -1
- data/incompatibilities/spec/render/sanitize_spec.md +2 -2
- data/incompatibilities/spec/render/silent_script_spec.md +1 -1
- data/incompatibilities/spec/render/unescape_spec.md +3 -3
- data/lib/faml.rb +1 -0
- data/lib/faml/attribute_compiler.rb +1 -0
- data/lib/faml/attribute_optimizer.rb +14 -3
- data/lib/faml/cli.rb +1 -0
- data/lib/faml/compiler.rb +1 -0
- data/lib/faml/engine.rb +1 -0
- data/lib/faml/error.rb +1 -0
- data/lib/faml/filter_compilers.rb +1 -0
- data/lib/faml/filter_compilers/base.rb +1 -0
- data/lib/faml/filter_compilers/cdata.rb +1 -0
- data/lib/faml/filter_compilers/coffee.rb +1 -0
- data/lib/faml/filter_compilers/css.rb +1 -0
- data/lib/faml/filter_compilers/escaped.rb +1 -0
- data/lib/faml/filter_compilers/javascript.rb +1 -0
- data/lib/faml/filter_compilers/markdown.rb +1 -0
- data/lib/faml/filter_compilers/plain.rb +1 -0
- data/lib/faml/filter_compilers/preserve.rb +1 -0
- data/lib/faml/filter_compilers/ruby.rb +1 -0
- data/lib/faml/filter_compilers/sass.rb +1 -0
- data/lib/faml/filter_compilers/scss.rb +1 -0
- data/lib/faml/filter_compilers/tilt_base.rb +1 -0
- data/lib/faml/helpers.rb +1 -0
- data/lib/faml/html.rb +1 -0
- data/lib/faml/newline.rb +1 -0
- data/lib/faml/object_ref.rb +1 -0
- data/lib/faml/rails_handler.rb +1 -0
- data/lib/faml/rails_helpers.rb +1 -0
- data/lib/faml/railtie.rb +1 -0
- data/lib/faml/ruby_syntax_checker.rb +1 -0
- data/lib/faml/script_end.rb +1 -0
- data/lib/faml/static_hash_parser.rb +37 -13
- data/lib/faml/stats.rb +1 -0
- data/lib/faml/text_compiler.rb +1 -0
- data/lib/faml/tilt.rb +1 -0
- data/lib/faml/version.rb +2 -1
- data/spec/compiler_newline_spec.rb +1 -0
- data/spec/rails/app/controllers/application_controller.rb +1 -0
- data/spec/rails/app/controllers/books_controller.rb +1 -0
- data/spec/rails/app/helpers/application_helper.rb +1 -0
- data/spec/rails/app/models/book.rb +1 -0
- data/spec/rails/config/application.rb +1 -0
- data/spec/rails/config/boot.rb +1 -0
- data/spec/rails/config/environment.rb +1 -0
- data/spec/rails/config/environments/development.rb +1 -0
- data/spec/rails/config/environments/production.rb +1 -0
- data/spec/rails/config/environments/test.rb +1 -0
- data/spec/rails/config/initializers/assets.rb +1 -0
- data/spec/rails/config/initializers/backtrace_silencers.rb +1 -0
- data/spec/rails/config/initializers/cookies_serializer.rb +1 -0
- data/spec/rails/config/initializers/filter_parameter_logging.rb +1 -0
- data/spec/rails/config/initializers/inflections.rb +1 -0
- data/spec/rails/config/initializers/mime_types.rb +1 -0
- data/spec/rails/config/initializers/secret_key_base.rb +1 -0
- data/spec/rails/config/initializers/session_store.rb +1 -0
- data/spec/rails/config/initializers/wrap_parameters.rb +1 -0
- data/spec/rails/config/routes.rb +1 -0
- data/spec/rails/db/seeds.rb +1 -0
- data/spec/rails/spec/requests/faml_spec.rb +1 -0
- data/spec/rails_helper.rb +1 -0
- data/spec/render/attribute_spec.rb +33 -0
- data/spec/render/comment_spec.rb +1 -0
- data/spec/render/doctype_spec.rb +1 -0
- data/spec/render/element_spec.rb +1 -0
- data/spec/render/filters/cdata_spec.rb +1 -0
- data/spec/render/filters/coffee_spec.rb +1 -0
- data/spec/render/filters/css_spec.rb +1 -0
- data/spec/render/filters/escaped_spec.rb +1 -0
- data/spec/render/filters/javascript_spec.rb +1 -0
- data/spec/render/filters/markdown_spec.rb +1 -0
- data/spec/render/filters/plain_spec.rb +1 -0
- data/spec/render/filters/preserve_spec.rb +1 -0
- data/spec/render/filters/ruby_spec.rb +1 -0
- data/spec/render/filters/sass_spec.rb +1 -0
- data/spec/render/filters/scss_spec.rb +1 -0
- data/spec/render/filters_spec.rb +1 -0
- data/spec/render/haml_comment_spec.rb +1 -0
- data/spec/render/helpers_spec.rb +1 -0
- data/spec/render/multiline_spec.rb +1 -0
- data/spec/render/newline_spec.rb +1 -0
- data/spec/render/plain_spec.rb +1 -0
- data/spec/render/preserve_spec.rb +1 -0
- data/spec/render/sanitize_spec.rb +1 -0
- data/spec/render/script_spec.rb +1 -0
- data/spec/render/silent_script_spec.rb +1 -0
- data/spec/render/unescape_spec.rb +1 -0
- data/spec/spec_helper.rb +1 -0
- data/spec/support/incompatibilities_generator.rb +2 -1
- data/spec/tilt_spec.rb +1 -0
- metadata +3 -3
data/lib/faml/stats.rb
CHANGED
data/lib/faml/text_compiler.rb
CHANGED
data/lib/faml/tilt.rb
CHANGED
data/lib/faml/version.rb
CHANGED
data/spec/rails/config/boot.rb
CHANGED
data/spec/rails/config/routes.rb
CHANGED
data/spec/rails/db/seeds.rb
CHANGED
data/spec/rails_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen-string-literal: true
|
1
2
|
require 'spec_helper'
|
2
3
|
|
3
4
|
RSpec.describe 'Attributes rendering', type: :render do
|
@@ -228,4 +229,36 @@ HAML
|
|
228
229
|
expect(render_string('%span#baz[Faml::TestStruct.new(123)]{id: "foo"} hello')).to eq("<span class='faml_test_struct' id='baz_foo_faml_test_struct_123'>hello</span>\n")
|
229
230
|
end
|
230
231
|
end
|
232
|
+
|
233
|
+
context 'when old attributes and new attributes have the same key' do
|
234
|
+
it 'prefers old attributes' do
|
235
|
+
aggregate_failures do
|
236
|
+
expect(render_string('%span{foo: 1}(foo=2)')).to eq("<span foo='1'></span>\n")
|
237
|
+
expect(render_string('%span(foo=2){foo: 1}')).to eq("<span foo='1'></span>\n")
|
238
|
+
expect(render_string("- v = 2\n%span{foo: v-1}(foo=v)")).to eq("<span foo='1'></span>\n")
|
239
|
+
expect(render_string("- v = 2\n%span(foo=v){foo: v-1}")).to eq("<span foo='1'></span>\n")
|
240
|
+
expect(render_string("- h = {foo: 1}\n%span{h}(foo=2)")).to eq("<span foo='1'></span>\n")
|
241
|
+
expect(render_string("- h = {foo: 1}\n%span(foo=2){h}")).to eq("<span foo='1'></span>\n")
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
it 'merges class attribute' do
|
246
|
+
aggregate_failures do
|
247
|
+
expect(render_string('%span{class: 1}(class=2)')).to eq("<span class='1 2'></span>\n")
|
248
|
+
expect(render_string("- v = 2\n%span{class: v-1}(class=v)")).to eq("<span class='1 2'></span>\n")
|
249
|
+
expect(render_string("- h = {class: 1}\n%span{h}(class=2)")).to eq("<span class='1 2'></span>\n")
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
it 'merges id attribute' do
|
254
|
+
aggregate_failures do
|
255
|
+
expect(render_string('%span{id: 1}(id=2)')).to eq("<span id='2_1'></span>\n")
|
256
|
+
expect(render_string('%span(id=2){id: 1}')).to eq("<span id='2_1'></span>\n")
|
257
|
+
expect(render_string("- v = 2\n%span{id: v-1}(id=v)")).to eq("<span id='2_1'></span>\n")
|
258
|
+
expect(render_string("- v = 2\n%span(id=v){id: v-1}")).to eq("<span id='2_1'></span>\n")
|
259
|
+
expect(render_string("- h = {id: 1}\n%span{h}(id=2)")).to eq("<span id='2_1'></span>\n")
|
260
|
+
expect(render_string("- h = {id: 1}\n%span(id=2){h}")).to eq("<span id='2_1'></span>\n")
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
231
264
|
end
|
data/spec/render/comment_spec.rb
CHANGED
data/spec/render/doctype_spec.rb
CHANGED
data/spec/render/element_spec.rb
CHANGED
data/spec/render/filters_spec.rb
CHANGED
data/spec/render/helpers_spec.rb
CHANGED
data/spec/render/newline_spec.rb
CHANGED
data/spec/render/plain_spec.rb
CHANGED
data/spec/render/script_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen-string-literal: true
|
1
2
|
require 'pathname'
|
2
3
|
require 'singleton'
|
3
4
|
require 'hamlit/engine'
|
@@ -100,7 +101,7 @@ EOS
|
|
100
101
|
def render_input_title(options)
|
101
102
|
title = 'Input'
|
102
103
|
unless options.empty?
|
103
|
-
title
|
104
|
+
title += " (with options=#{options.inspect})"
|
104
105
|
end
|
105
106
|
title
|
106
107
|
end
|
data/spec/tilt_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: faml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kohei Suzuki
|
@@ -226,14 +226,14 @@ dependencies:
|
|
226
226
|
requirements:
|
227
227
|
- - ">="
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '3'
|
229
|
+
version: '3.3'
|
230
230
|
type: :development
|
231
231
|
prerelease: false
|
232
232
|
version_requirements: !ruby/object:Gem::Requirement
|
233
233
|
requirements:
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: '3'
|
236
|
+
version: '3.3'
|
237
237
|
- !ruby/object:Gem::Dependency
|
238
238
|
name: rubocop
|
239
239
|
requirement: !ruby/object:Gem::Requirement
|