hamlit 3.0.0-java → 3.0.2-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 12be429a8481d86e0dee762af8fa98eb8ef7ed5b131092f5cb47acc47655f5a0
4
- data.tar.gz: 55fad897b3938e57bb9986e3b0c2c6cb449634889fa0563e46cef0176358c280
3
+ metadata.gz: 8b1bf9d7169d21910155348a5e9a26e3b2ff1cdccaa998dd191145849366a1d3
4
+ data.tar.gz: 91c2f6d2fef0e0c92765195d30201027308fc1ba2cf581ee1264842026995c9a
5
5
  SHA512:
6
- metadata.gz: e89257b48ceebde299b037ef204f29d9f017c6f49c5687f38f31a5182c8b0eb6b53802dc5a1fdc7980163f2aad1b8a89c88e072ddde7d63294cf63638d9f7634
7
- data.tar.gz: 51da64cfc88e0a9625c1c60b7913099bec59f73bdc5e2b602383c9a4c685e887b74c8cb8445fd8e2c774397751f86f28fdfbe226d9d5fca9497ccd89f8d9adb8
6
+ metadata.gz: 02e5db6ffafa7815e18e6ab7455a4abe4fd731260961d35c815fa87423cc26abd159fdaea357943178eb6235de125c11f002d96255ac4e9d2f3582778da55716
7
+ data.tar.gz: 6d8fe8e3de9be2f50f82197955f7c6a2bacc275ac4942785af24515e845407a09a684dd482327016185dd25a3c5788c3a7050849115fae4c288f6d69ebd935f7
@@ -13,18 +13,6 @@ on:
13
13
  jobs:
14
14
  bench:
15
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
16
  steps:
29
17
  - uses: actions/checkout@v2
30
18
  - name: Set up Ruby
@@ -40,7 +28,3 @@ jobs:
40
28
  - name: bundle install
41
29
  run: bundle config path vendor/bundle && bundle install -j$(nproc) --retry 3
42
30
  - 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,6 +4,23 @@ 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
+ ## [3.0.2](https://github.com/k0kubun/hamlit/compare/v3.0.1...v3.0.2) - 2022-10-13
8
+
9
+ ### Changed
10
+
11
+ - `Hamlit::Engine` and `Hamlit::Template` use StringBuffer instead of ArrayBuffer
12
+ - It seems more performant in many cases with recent Ruby versions.
13
+ - `Hamlit::RailsTemplate` is not affected.
14
+
15
+ ## [3.0.1](https://github.com/k0kubun/hamlit/compare/v3.0.0...v3.0.1) - 2022-08-18
16
+
17
+ ### Changed
18
+
19
+ - coffee-script is removed from development dependency
20
+ - It's not runtime dependency, so it shouldn't impact your application
21
+ - `:coffee` filter still works if you explicitly install coffee-script,
22
+ however, it's no longer maintained and possibly removed in the future.
23
+
7
24
  ## [3.0.0](https://github.com/k0kubun/hamlit/compare/v2.16.2...v3.0.0) - 2022-08-07
8
25
 
9
26
  ### Changed
@@ -26,7 +43,7 @@ project adheres to [Semantic Versioning](http://semver.org/). This change log is
26
43
  - Default: `disable_capture: true` (backward-compatible)
27
44
  - For Rails, this must be `true` anyway to use Rails-native capturing.
28
45
  - If you override the option like `disable_capture: false` in Hamlit::Template,
29
- scripts starting with `=` (e.g. `= render do ...`) capture a block content.
46
+ scripts starting with `=` (e.g. `= render do`) capture a block content.
30
47
  - Scripts starting with `-` (e.g. `- users.each do`) are not impacted.
31
48
 
32
49
  ## [2.16.0](https://github.com/k0kubun/hamlit/compare/v2.15.2...v2.16.0) - 2022-02-03
data/Gemfile CHANGED
@@ -18,7 +18,6 @@ else
18
18
  gem 'redcarpet'
19
19
 
20
20
  if RUBY_PLATFORM !~ /mswin|mingw/ && RUBY_ENGINE != 'truffleruby'
21
- gem 'faml'
22
21
  gem 'stackprof'
23
22
  end
24
23
  end
data/README.md CHANGED
@@ -5,12 +5,22 @@
5
5
 
6
6
  Hamlit is a high performance [Haml](https://github.com/haml/haml) implementation.
7
7
 
8
+ ## Project status
9
+
10
+ **Hamlit's implementation was copied to Haml 6.**
11
+ From Haml 6, you don't need to switch to Hamlit.
12
+
13
+ Both Haml 6 and Hamlit are still maintained by [@k0kubun](https://github.com/k0kubun).
14
+ While you don't need to immediately deprecate Hamlit, Haml 6 has more maintainers
15
+ and you'd better start a new project with Haml rather than Hamlit,
16
+ given no performance difference between them.
17
+
8
18
  ## Introduction
9
19
 
10
20
  ### What is Hamlit?
11
21
  Hamlit is another implementation of [Haml](https://github.com/haml/haml).
12
- With some [limitations](REFERENCE.md#limitations) by design for performance,
13
- Hamlit is **1.94x times faster** than original haml gem in [this benchmark](benchmark/slim/run-benchmarks.rb),
22
+ With some [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics) for performance,
23
+ Hamlit is **1.94x times faster** than the original Haml 5 in [this benchmark](benchmark/run-benchmarks.rb),
14
24
  which is an HTML-escaped version of [slim-template/slim's one](https://github.com/slim-template/slim/blob/4.1.0/benchmarks/run-benchmarks.rb) for fairness. ([Result on Travis](https://travis-ci.org/github/k0kubun/hamlit/jobs/732178446))
15
25
 
16
26
  <img src="https://raw.githubusercontent.com/k0kubun/hamlit/afcc2b36c4861c2f764baa09afd9530ca25eeafa/benchmark/graph/graph.png" width="600x" alt="Hamlit Benchmark" />
@@ -23,11 +33,12 @@ which is an HTML-escaped version of [slim-template/slim's one](https://github.co
23
33
  haml v5.2.0: 127834.4 i/s - 1.94x slower
24
34
  ```
25
35
 
26
- ### Why is Hamlit faster?
36
+ ### Why is Hamlit fast?
27
37
 
28
38
  #### Less string concatenation by design
29
- As written in [limitations](REFERENCE.md#limitations), Hamlit drops some not-so-important features which require
30
- works on runtime. With the optimized language design, we can reduce the string concatenation
39
+ As written in [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics),
40
+ Hamlit drops some not-so-important features which require works on runtime.
41
+ With the optimized language design, we can reduce the string concatenation
31
42
  to build attributes.
32
43
 
33
44
  #### Static analyzer
@@ -42,7 +53,7 @@ with C extension.
42
53
 
43
54
  ## Usage
44
55
 
45
- Hamlit currently supports Ruby 2.1 and higher. See [REFERENCE.md](REFERENCE.md) for detail features of Hamlit.
56
+ See [REFERENCE.md](REFERENCE.md) for details.
46
57
 
47
58
  ### Rails
48
59
 
@@ -97,40 +108,6 @@ $ hamlit render in.haml
97
108
 
98
109
  ## Contributing
99
110
 
100
- ### Test latest version
101
-
102
- ```rb
103
- # Gemfile
104
- gem 'hamlit', github: 'k0kubun/hamlit', submodules: true
105
- ```
106
-
107
- ### Development
108
-
109
- Contributions are welcomed. It'd be good to see
110
- [Temple's EXPRESSIONS.md](https://github.com/judofyr/temple/blob/v0.7.6/EXPRESSIONS.md)
111
- to learn Temple which is a template engine framework used in Hamlit.
112
-
113
- ```bash
114
- $ git clone --recursive https://github.com/k0kubun/hamlit
115
- $ cd hamlit
116
- $ bundle install
117
-
118
- # Run all tests
119
- $ bundle exec rake test
120
-
121
- # Run one test
122
- $ bundle exec ruby -Ilib:test -rtest_helper test/hamlit/line_number_test.rb -l 12
123
-
124
- # Show compiling/rendering result of some template
125
- $ bundle exec exe/hamlit compile in.haml
126
- $ bundle exec exe/hamlit render in.haml
127
-
128
- # Use rails app to debug Hamlit
129
- $ cd sample/rails
130
- $ bundle install
131
- $ bundle exec rails s
132
- ```
133
-
134
111
  ### Reporting an issue
135
112
 
136
113
  Please report an issue with following information:
data/REFERENCE.md CHANGED
@@ -5,81 +5,7 @@ See [Haml's tutorial](http://haml.info/tutorial.html) if you are not familiar wi
5
5
 
6
6
  [REFERENCE - Haml Documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
7
7
 
8
- ## Supported features
9
-
10
- See [Haml's reference](http://haml.info/docs/yardoc/file.REFERENCE.html)
11
- for full features in original implementation.
12
-
13
- - [ ] Using Haml
14
- - [x] Rails XSS Protection
15
- - [x] Ruby Module
16
- - [x] Options
17
- - [ ] Encodings
18
- - [x] Plain Text
19
- - [x] Escaping: \
20
- - [ ] HTML Elements
21
- - [x] Element Name: %
22
- - [ ] Attributes: `
23
- - [x] :class and :id Attributes
24
- - [x] HTML-style Attributes: ()
25
- - [x] Ruby 1.9-style Hashes
26
- - [ ] Attribute Methods
27
- - [x] Boolean Attributes
28
- - [x] HTML5 Custom Data Attributes
29
- - [x] Class and ID: . and #
30
- - Implicit Div Elements
31
- - [x] Empty (void) Tags: /
32
- - [x] Whitespace Removal: > and <
33
- - [x] Object Reference: []
34
- - [x] Doctype: !!!
35
- - [x] Comments
36
- - [x] HTML Comments: /
37
- - [x] Conditional Comments: /[]
38
- - [x] Haml Comments: -#
39
- - [x] Ruby Evaluation
40
- - [x] Inserting Ruby: =
41
- - [x] Running Ruby: -
42
- - [x] Ruby Blocks
43
- - [x] Whitespace Preservation: ~
44
- - [x] Ruby Interpolation: #{}
45
- - [x] Escaping HTML: &=
46
- - [x] Unescaping HTML: !=
47
- - [ ] Filters
48
- - [x] :cdata
49
- - [x] :coffee
50
- - [x] :css
51
- - [x] :erb
52
- - [x] :escaped
53
- - [x] :javascript
54
- - [x] :less
55
- - [x] :markdown
56
- - [ ] :maruku
57
- - [x] :plain
58
- - [x] :preserve
59
- - [x] :ruby
60
- - `haml_io` API is not supported. Use [hamlit-haml\_io.gem](https://github.com/hamlit/hamlit-haml_io) if you need.
61
- - [x] :sass
62
- - [x] :scss
63
- - [ ] :textile
64
- - [ ] Custom Filters
65
- - [x] Helper Methods
66
- - [x] preserve
67
- - [x] surround
68
- - [x] precede
69
- - [x] succeed
70
- - [x] Multiline: |
71
- - [x] Whitespace Preservation
72
- - [ ] Helpers
73
-
74
-
75
- ## Limitations
76
-
77
- ### No Haml buffer
78
- Hamlit uses `Array` as buffer for performance. So you can't touch Haml::Buffer from template when using Hamlit.
79
-
80
- ### Haml helpers are still in development
81
- At the same time, because some methods in `Haml::Helpers` require `Haml::Buffer`, they are not supported now.
82
- But some helpers are supported on Rails. Some of not-implemented methods are planned to be supported.
8
+ ## Hamlit's characteristics
83
9
 
84
10
  ### Limited attributes hyphenation
85
11
  In Haml, `%a{ foo: { bar: 'baz' } }` is rendered as `<a foo-bar='baz'></a>`, whatever foo is.
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
- require 'bundler/setup'
2
1
  require 'bundler/gem_tasks'
3
2
 
4
3
  #
@@ -105,11 +104,7 @@ end
105
104
 
106
105
  desc 'bench task for CI'
107
106
  task bench: :compile do
108
- if ENV['SLIM_BENCH'] == '1'
109
- cmd = %w[bundle exec ruby benchmark/slim/run-benchmarks.rb]
110
- else
111
- cmd = ['bin/bench', 'bench', ('-c' if ENV['COMPILE'] == '1'), *ENV['TEMPLATE'].split(',')].compact
112
- end
107
+ cmd = %w[bundle exec ruby benchmark/run-benchmarks.rb]
113
108
  exit system(*cmd)
114
109
  end
115
110
 
data/bin/bench CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  require 'bundler/setup'
4
4
  require 'hamlit'
5
- require 'faml'
6
5
  require 'thor'
7
6
  require 'benchmark/ips'
8
7
  require_relative '../benchmark/utils/benchmark_ips_extension'
@@ -26,7 +25,6 @@ class Bench < Thor
26
25
 
27
26
  Benchmark.ips do |x|
28
27
  x.report("haml v#{Haml::VERSION}") { Haml::Engine.new(haml, escape_html: true, escape_attrs: true).precompiled }
29
- x.report("faml v#{Faml::VERSION}") { Faml::Engine.new.call(haml) }
30
28
  x.report("hamlit v#{Hamlit::VERSION}") { Hamlit::Engine.new.call(haml) }
31
29
  x.compare!
32
30
  end
@@ -44,12 +42,10 @@ class Bench < Thor
44
42
  end
45
43
 
46
44
  Haml::Engine.new(haml, escape_html: true, escape_attrs: true).def_method(object, :haml)
47
- object.instance_eval "def faml; #{Faml::Engine.new.call(haml)}; end"
48
45
  object.instance_eval "def hamlit; #{Hamlit::Engine.new.call(haml)}; end"
49
46
 
50
47
  Benchmark.ips do |x|
51
48
  x.report("haml v#{Haml::VERSION}") { object.haml }
52
- x.report("faml v#{Faml::VERSION}") { object.faml }
53
49
  x.report("hamlit v#{Hamlit::VERSION}") { object.hamlit }
54
50
  x.compare!
55
51
  end
@@ -60,8 +56,6 @@ class Bench < Thor
60
56
  haml = File.read(file)
61
57
  puts "#{?= * 49}\n Haml Source: #{file}\n#{?= * 49}"
62
58
  puts Haml::Engine.new(haml, escape_html: true, escape_attrs: true).precompiled
63
- puts "\n#{?= * 49}\n Faml Source: #{file}\n#{?= * 49}"
64
- puts Faml::Engine.new.call(haml)
65
59
  puts "\n#{?= * 49}\n Hamlit Source: #{file}\n#{?= * 49}"
66
60
  puts Hamlit::Engine.new.call(haml)
67
61
  end
data/hamlit.gemspec CHANGED
@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
32
32
 
33
33
  spec.add_development_dependency 'benchmark_driver'
34
34
  spec.add_development_dependency 'bundler'
35
- spec.add_development_dependency 'coffee-script'
36
35
  spec.add_development_dependency 'erubi'
37
36
  spec.add_development_dependency 'haml', '>= 5'
38
37
  spec.add_development_dependency 'less'
data/lib/hamlit/engine.rb CHANGED
@@ -12,7 +12,7 @@ module Hamlit
12
12
  class Engine < Temple::Engine
13
13
  define_options(
14
14
  :buffer_class,
15
- generator: Temple::Generators::ArrayBuffer,
15
+ generator: Temple::Generators::StringBuffer,
16
16
  format: :html,
17
17
  attr_quote: "'",
18
18
  escape_html: true,
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '3.0.0'
3
+ VERSION = '3.0.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: 3.0.0
4
+ version: 3.0.2
5
5
  platform: java
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-09 00:00:00.000000000 Z
11
+ date: 2022-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- - !ruby/object:Gem::Dependency
84
- requirement: !ruby/object:Gem::Requirement
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: '0'
89
- name: coffee-script
90
- prerelease: false
91
- type: :development
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  requirement: !ruby/object:Gem::Requirement
99
85
  requirements: