hamlit 2.14.5 → 2.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/bench.yml +46 -0
  3. data/CHANGELOG.md +28 -1
  4. data/hamlit.gemspec +1 -1
  5. data/lib/hamlit/attribute_builder.rb +1 -1
  6. data/lib/hamlit/engine.rb +1 -1
  7. data/lib/hamlit/railtie.rb +5 -0
  8. data/lib/hamlit/version.rb +1 -1
  9. metadata +4 -37
  10. data/benchmark/boolean_attribute.haml +0 -6
  11. data/benchmark/class_attribute.haml +0 -5
  12. data/benchmark/common_attribute.haml +0 -3
  13. data/benchmark/data_attribute.haml +0 -4
  14. data/benchmark/dynamic_attributes/boolean_attribute.haml +0 -4
  15. data/benchmark/dynamic_attributes/class_attribute.haml +0 -4
  16. data/benchmark/dynamic_attributes/common_attribute.haml +0 -2
  17. data/benchmark/dynamic_attributes/data_attribute.haml +0 -2
  18. data/benchmark/dynamic_attributes/id_attribute.haml +0 -2
  19. data/benchmark/dynamic_boolean_attribute.haml +0 -4
  20. data/benchmark/dynamic_merger/benchmark.rb +0 -25
  21. data/benchmark/dynamic_merger/hello.haml +0 -50
  22. data/benchmark/dynamic_merger/hello.string +0 -50
  23. data/benchmark/etc/attribute_builder.haml +0 -5
  24. data/benchmark/etc/real_sample.haml +0 -888
  25. data/benchmark/etc/real_sample.rb +0 -11
  26. data/benchmark/etc/static_analyzer.haml +0 -1
  27. data/benchmark/etc/string_interpolation.haml +0 -2
  28. data/benchmark/etc/tags.haml +0 -3
  29. data/benchmark/etc/tags_loop.haml +0 -2
  30. data/benchmark/ext/build_data.rb +0 -17
  31. data/benchmark/ext/build_id.rb +0 -13
  32. data/benchmark/graph/graph.key +0 -0
  33. data/benchmark/graph/graph.png +0 -0
  34. data/benchmark/id_attribute.haml +0 -3
  35. data/benchmark/plain.haml +0 -4
  36. data/benchmark/script.haml +0 -4
  37. data/benchmark/slim/LICENSE +0 -21
  38. data/benchmark/slim/context.rb +0 -11
  39. data/benchmark/slim/run-benchmarks.rb +0 -94
  40. data/benchmark/slim/view.erb +0 -23
  41. data/benchmark/slim/view.haml +0 -18
  42. data/benchmark/slim/view.slim +0 -17
  43. data/benchmark/utils/benchmark_ips_extension.rb +0 -43
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c58f9be7c1f06eb9104542ca749b10a2833a23d5db7b12bf9f16744461b3e83
4
- data.tar.gz: 6130138aa3ecf4cafd996b89b3442b8c354d3085da8045a627e04f72dd0aa3fb
3
+ metadata.gz: 0d94d8367c92ca140f6438760deeecddf3e59d4f7e5edef0833e9afbe5851e68
4
+ data.tar.gz: dc6cfc8aa8ed607bdb4da4d99a60d391d0fe0bf773059bf868053248949f3bae
5
5
  SHA512:
6
- metadata.gz: ffd47c2339cbbb0f9c9bb84ab1dc5d41edeb91e05a4cc6b1a5d79fe71d72ee67ef881ac9816f474ec2376e8dcc2416e65caeeb72fc6094c4e7844626ab126117
7
- data.tar.gz: d2292193a05d671053022da852b9456622d23214d73d785d079f0eabeacd12fdbd2eabcacfc94496be59f55e5cf7e905223d7afab042cc5361bdb227230c7f99
6
+ metadata.gz: 2704b342b72349cd9d4ed144671ed4a0e829f8194d920c4591c129d5be81fc73cf79b11e3917f10b3981570896794293a82bd66e959654d2072c1c348d747b2c
7
+ data.tar.gz: 90151c07372ca4fbc5d25674d47a239fcd47e87619b7d0bc117f51b8b77d03b649179467ae590e3f11b509e5a576404b08dbb723ba7f7add4c27fa5106326b3b
@@ -0,0 +1,46 @@
1
+ name: bench
2
+ on:
3
+ push:
4
+ branches:
5
+ - master
6
+ pull_request:
7
+ types:
8
+ - opened
9
+ - synchronize
10
+ - reopened
11
+ schedule:
12
+ - cron: "00 15 * * *" # 7:00 PST (-8), 8:00 PDT (-7)
13
+ jobs:
14
+ bench:
15
+ runs-on: ubuntu-latest
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ include:
20
+ - slim: 1
21
+ - template: 'benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml'
22
+ - template: 'benchmark/dynamic_attributes/boolean_attribute.haml,benchmark/dynamic_attributes/class_attribute.haml,benchmark/dynamic_attributes/id_attribute.haml,benchmark/dynamic_attributes/data_attribute.haml,benchmark/dynamic_attributes/common_attribute.haml'
23
+ - template: 'benchmark/etc/attribute_builder.haml'
24
+ - template: 'benchmark/etc/static_analyzer.haml'
25
+ - template: 'benchmark/etc/string_interpolation.haml'
26
+ - template: 'test/haml/templates/standard.haml'
27
+ compile: 1
28
+ steps:
29
+ - uses: actions/checkout@v2
30
+ - name: Set up Ruby
31
+ uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: '3.0'
34
+ - uses: actions/cache@v2
35
+ with:
36
+ path: vendor/bundle
37
+ key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
38
+ restore-keys: ${{ runner.os }}-gems-
39
+ - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
40
+ - name: bundle install
41
+ run: bundle config path vendor/bundle && bundle install -j$(nproc) --retry 3
42
+ - run: bundle exec rake bench
43
+ env:
44
+ SLIM_BENCH: ${{ matrix.slim }}
45
+ TEMPLATE: ${{ matrix.template }}
46
+ COMPILE: ${{ matrix.compile }}
data/CHANGELOG.md CHANGED
@@ -4,11 +4,38 @@ All notable changes to this project will be documented in this file. This
4
4
  project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
5
5
  [keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
6
6
 
7
+ ## [2.15.2](https://github.com/k0kubun/hamlit/compare/v2.15.1...v2.15.2) - 2022-01-04
8
+
9
+ ### Fixed
10
+
11
+ - Consider `playsinline` a boolean attribute [#187](https://github.com/k0kubun/hamlit/issues/187)
12
+ *Thanks to @ghiculescu*
13
+
14
+ ## [2.15.1](https://github.com/k0kubun/hamlit/compare/v2.15.0...v2.15.1) - 2021-07-23
15
+
16
+ ### Fixed
17
+
18
+ - Remove `benchmark` from the gem package to reduce its size [#186](https://github.com/k0kubun/hamlit/issues/186)
19
+ *Thanks to @pocke*
20
+
21
+ ## [2.15.0](https://github.com/k0kubun/hamlit/compare/v2.14.6...v2.15.0) - 2021-04-12
22
+
23
+ ### Added
24
+
25
+ - Always use Hamlit when both haml.gem and hamlit.gem are installed in Rails
26
+ *Thanks to @igor-drozdov*
27
+
28
+ ## [2.14.6](https://github.com/k0kubun/hamlit/compare/v2.14.5...v2.14.6) - 2021-03-23
29
+
30
+ ### Fixed
31
+
32
+ - Optimize v2.14.5's implementation a little
33
+
7
34
  ## [2.14.5](https://github.com/k0kubun/hamlit/compare/v2.14.4...v2.14.5) - 2021-03-23
8
35
 
9
36
  ### Added
10
37
 
11
- - Support `config.action_view.annotate_template_file_names = true` of Rails 6.1
38
+ - Support `config.action_view.annotate_rendered_view_with_filenames = true` of Rails 6.1
12
39
  *Thanks to @kirin121*
13
40
 
14
41
  ## [2.14.4](https://github.com/k0kubun/hamlit/compare/v2.14.3...v2.14.4) - 2021-02-01
data/hamlit.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = 'https://github.com/k0kubun/hamlit'
15
15
  spec.license = 'MIT'
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sample)/}) }
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sample|benchmark)/}) }
18
18
  spec.bindir = 'exe'
19
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
20
  spec.require_paths = ['lib']
@@ -7,7 +7,7 @@ module Hamlit::AttributeBuilder
7
7
  defer reversed ismap seamless muted required
8
8
  autofocus novalidate formnovalidate open pubdate
9
9
  itemscope allowfullscreen default inert sortable
10
- truespeed typemustmatch download].freeze
10
+ truespeed typemustmatch download playsinline].freeze
11
11
 
12
12
  # Java extension is not implemented for JRuby yet.
13
13
  # TruffleRuby does not implement `rb_ary_sort_bang`, etc.
data/lib/hamlit/engine.rb CHANGED
@@ -31,10 +31,10 @@ module Hamlit
31
31
  use Escapable
32
32
  use ForceEscapable
33
33
  filter :ControlFlow
34
+ use Ambles
34
35
  filter :MultiFlattener
35
36
  filter :StaticMerger
36
37
  use DynamicMerger
37
- use Ambles
38
38
  use :Generator, -> { options[:generator] }
39
39
  end
40
40
  end
@@ -4,6 +4,11 @@ require 'rails'
4
4
  module Hamlit
5
5
  class Railtie < ::Rails::Railtie
6
6
  initializer :hamlit, before: :load_config_initializers do |app|
7
+ # Load haml/plugin first to override if available
8
+ begin
9
+ require 'haml/plugin'
10
+ rescue LoadError
11
+ end
7
12
  require 'hamlit/rails_template'
8
13
  end
9
14
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.14.5'
3
+ VERSION = '2.15.2'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hamlit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.14.5
4
+ version: 2.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2022-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: temple
@@ -258,6 +258,7 @@ extensions:
258
258
  extra_rdoc_files: []
259
259
  files:
260
260
  - ".github/FUNDING.yml"
261
+ - ".github/workflows/bench.yml"
261
262
  - ".github/workflows/test.yml"
262
263
  - ".gitignore"
263
264
  - CHANGELOG.md
@@ -266,40 +267,6 @@ files:
266
267
  - README.md
267
268
  - REFERENCE.md
268
269
  - Rakefile
269
- - benchmark/boolean_attribute.haml
270
- - benchmark/class_attribute.haml
271
- - benchmark/common_attribute.haml
272
- - benchmark/data_attribute.haml
273
- - benchmark/dynamic_attributes/boolean_attribute.haml
274
- - benchmark/dynamic_attributes/class_attribute.haml
275
- - benchmark/dynamic_attributes/common_attribute.haml
276
- - benchmark/dynamic_attributes/data_attribute.haml
277
- - benchmark/dynamic_attributes/id_attribute.haml
278
- - benchmark/dynamic_boolean_attribute.haml
279
- - benchmark/dynamic_merger/benchmark.rb
280
- - benchmark/dynamic_merger/hello.haml
281
- - benchmark/dynamic_merger/hello.string
282
- - benchmark/etc/attribute_builder.haml
283
- - benchmark/etc/real_sample.haml
284
- - benchmark/etc/real_sample.rb
285
- - benchmark/etc/static_analyzer.haml
286
- - benchmark/etc/string_interpolation.haml
287
- - benchmark/etc/tags.haml
288
- - benchmark/etc/tags_loop.haml
289
- - benchmark/ext/build_data.rb
290
- - benchmark/ext/build_id.rb
291
- - benchmark/graph/graph.key
292
- - benchmark/graph/graph.png
293
- - benchmark/id_attribute.haml
294
- - benchmark/plain.haml
295
- - benchmark/script.haml
296
- - benchmark/slim/LICENSE
297
- - benchmark/slim/context.rb
298
- - benchmark/slim/run-benchmarks.rb
299
- - benchmark/slim/view.erb
300
- - benchmark/slim/view.haml
301
- - benchmark/slim/view.slim
302
- - benchmark/utils/benchmark_ips_extension.rb
303
270
  - bin/bench
304
271
  - bin/console
305
272
  - bin/ruby
@@ -393,7 +360,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
393
360
  - !ruby/object:Gem::Version
394
361
  version: '0'
395
362
  requirements: []
396
- rubygems_version: 3.2.3
363
+ rubygems_version: 3.1.2
397
364
  signing_key:
398
365
  specification_version: 4
399
366
  summary: High Performance Haml Implementation
@@ -1,6 +0,0 @@
1
- %input{ disabled: false }
2
- %input{ disabled: true }
3
- - disabled = false
4
- %input{ disabled: disabled }
5
- - disabled = true
6
- %input{ disabled: disabled }
@@ -1,5 +0,0 @@
1
- .book{ class: 'content active' }
2
- .book(class='content active')
3
-
4
- - klass = %w[content active]
5
- .book{ class: klass }
@@ -1,3 +0,0 @@
1
- %a{ href: '&"\'<>' }
2
- - href = '&"\'<>'
3
- %a{ href: href }
@@ -1,4 +0,0 @@
1
- %div{ data: { disabled: false } }
2
- %div{ data: { disabled: true } }
3
- - hash = { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 }
4
- %div{ data: hash } data
@@ -1,4 +0,0 @@
1
- - hash = { disabled: false }
2
- %input{ hash }
3
- - hash = { disabled: true }
4
- %input{ hash }
@@ -1,4 +0,0 @@
1
- - hash = { class: %w[content active] }
2
- .book{ hash }
3
- - arr = %w[foo bar]
4
- .book(class=arr){ hash }
@@ -1,2 +0,0 @@
1
- - hash = { href: '&"\'<>' }
2
- %a{ hash }
@@ -1,2 +0,0 @@
1
- - hash = { data: { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 } }
2
- %div{ hash } data
@@ -1,2 +0,0 @@
1
- - hash = { id: %w[content active] }
2
- #book{ hash }
@@ -1,4 +0,0 @@
1
- - disabled = false
2
- %input{ disabled: disabled }
3
- - disabled = true
4
- %input{ disabled: disabled }
@@ -1,25 +0,0 @@
1
- # Original: https://github.com/amatsuda/string_template/blob/master/benchmark.rb
2
- require 'benchmark_driver'
3
-
4
- Benchmark.driver(repeat_count: 8) do |x|
5
- x.prelude %{
6
- require 'rails'
7
- require 'action_view'
8
- require 'string_template'
9
- StringTemplate::Railtie.run_initializers
10
- require 'hamlit'
11
- Hamlit::Railtie.run_initializers
12
- Hamlit::RailsTemplate.set_options(escape_html: false, generator: Temple::Generators::ArrayBuffer)
13
- require 'action_view/base'
14
-
15
- (view = Class.new(ActionView::Base).new(ActionView::LookupContext.new(''))).instance_variable_set(:@world, 'world!')
16
-
17
- # compile template
18
- hello = 'benchmark/dynamic_merger/hello'
19
- view.render(template: hello, handlers: 'string')
20
- view.render(template: hello, handlers: 'haml')
21
- }
22
- x.report 'string', %{ view.render(template: hello, handlers: 'string') }
23
- x.report 'hamlit', %{ view.render(template: hello, handlers: 'haml') }
24
- x.loop_count 100_000
25
- end
@@ -1,50 +0,0 @@
1
- hello, #{ @world }
2
- hello, #{ @world }
3
- hello, #{ @world }
4
- hello, #{ @world }
5
- hello, #{ @world }
6
- hello, #{ @world }
7
- hello, #{ @world }
8
- hello, #{ @world }
9
- hello, #{ @world }
10
- hello, #{ @world }
11
- hello, #{ @world }
12
- hello, #{ @world }
13
- hello, #{ @world }
14
- hello, #{ @world }
15
- hello, #{ @world }
16
- hello, #{ @world }
17
- hello, #{ @world }
18
- hello, #{ @world }
19
- hello, #{ @world }
20
- hello, #{ @world }
21
- hello, #{ @world }
22
- hello, #{ @world }
23
- hello, #{ @world }
24
- hello, #{ @world }
25
- hello, #{ @world }
26
- hello, #{ @world }
27
- hello, #{ @world }
28
- hello, #{ @world }
29
- hello, #{ @world }
30
- hello, #{ @world }
31
- hello, #{ @world }
32
- hello, #{ @world }
33
- hello, #{ @world }
34
- hello, #{ @world }
35
- hello, #{ @world }
36
- hello, #{ @world }
37
- hello, #{ @world }
38
- hello, #{ @world }
39
- hello, #{ @world }
40
- hello, #{ @world }
41
- hello, #{ @world }
42
- hello, #{ @world }
43
- hello, #{ @world }
44
- hello, #{ @world }
45
- hello, #{ @world }
46
- hello, #{ @world }
47
- hello, #{ @world }
48
- hello, #{ @world }
49
- hello, #{ @world }
50
- hello, #{ @world }
@@ -1,50 +0,0 @@
1
- hello, #{ @world }
2
- hello, #{ @world }
3
- hello, #{ @world }
4
- hello, #{ @world }
5
- hello, #{ @world }
6
- hello, #{ @world }
7
- hello, #{ @world }
8
- hello, #{ @world }
9
- hello, #{ @world }
10
- hello, #{ @world }
11
- hello, #{ @world }
12
- hello, #{ @world }
13
- hello, #{ @world }
14
- hello, #{ @world }
15
- hello, #{ @world }
16
- hello, #{ @world }
17
- hello, #{ @world }
18
- hello, #{ @world }
19
- hello, #{ @world }
20
- hello, #{ @world }
21
- hello, #{ @world }
22
- hello, #{ @world }
23
- hello, #{ @world }
24
- hello, #{ @world }
25
- hello, #{ @world }
26
- hello, #{ @world }
27
- hello, #{ @world }
28
- hello, #{ @world }
29
- hello, #{ @world }
30
- hello, #{ @world }
31
- hello, #{ @world }
32
- hello, #{ @world }
33
- hello, #{ @world }
34
- hello, #{ @world }
35
- hello, #{ @world }
36
- hello, #{ @world }
37
- hello, #{ @world }
38
- hello, #{ @world }
39
- hello, #{ @world }
40
- hello, #{ @world }
41
- hello, #{ @world }
42
- hello, #{ @world }
43
- hello, #{ @world }
44
- hello, #{ @world }
45
- hello, #{ @world }
46
- hello, #{ @world }
47
- hello, #{ @world }
48
- hello, #{ @world }
49
- hello, #{ @world }
50
- hello, #{ @world }
@@ -1,5 +0,0 @@
1
- - h = { 'user' => { id: 1234, name: 'eagletmt' }, book_id: 5432 }
2
- - c = %w[content active]
3
-
4
- %span.book{data: h, class: c}
5
- Book