New Upstream Release - ruby-hamlit
Ready changes
Summary
Merged new upstream version: 3.0.3 (was: 2.15.1).
Resulting package
Built on 2023-02-26T11:10 (took 2m30s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases ruby-hamlit-dbgsymapt install -t fresh-releases ruby-hamlit
Diff
diff --git a/.github/workflows/bench.yml b/.github/workflows/bench.yml
index 29ca59f..9171431 100644
--- a/.github/workflows/bench.yml
+++ b/.github/workflows/bench.yml
@@ -13,34 +13,12 @@ on:
jobs:
bench:
runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- include:
- - slim: 1
- - template: 'benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml'
- - 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'
- - template: 'benchmark/etc/attribute_builder.haml'
- - template: 'benchmark/etc/static_analyzer.haml'
- - template: 'benchmark/etc/string_interpolation.haml'
- - template: 'test/haml/templates/standard.haml'
- compile: 1
steps:
- uses: actions/checkout@v2
+ - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
- ruby-version: 3.0
- - uses: actions/cache@v2
- with:
- path: vendor/bundle
- key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
- restore-keys: ${{ runner.os }}-gems-
- - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
- - name: bundle install
- run: bundle config path vendor/bundle && bundle install -j$(nproc) --retry 3
+ ruby-version: '3.0'
+ bundler-cache: true
- run: bundle exec rake bench
- env:
- SLIM_BENCH: ${{ matrix.slim }}
- TEMPLATE: ${{ matrix.template }}
- COMPILE: ${{ matrix.compile }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 074eded..0c3fb84 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -25,16 +25,10 @@ jobs:
- truffleruby-head
steps:
- uses: actions/checkout@v2
+ - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- - uses: actions/cache@v2
- with:
- path: vendor/bundle
- key: ${{ runner.os }}-${{ matrix.ruby }}-gems-${{ hashFiles('**/Gemfile.lock') }}
- restore-keys: ${{ runner.os }}-gems-
- - run: sudo apt-get update && sudo apt-get install -y nodejs libxslt-dev # nodejs for execjs, libxslt for TruffleRuby nokogiri
- - name: bundle install
- run: bundle config path vendor/bundle && bundle install -j$(nproc) --retry 3
+ bundler-cache: true
- run: bundle exec rake test
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee39fad..b7228a6 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,70 @@ All notable changes to this project will be documented in this file. This
project adheres to [Semantic Versioning](http://semver.org/). This change log is based upon
[keep-a-changelog](https://github.com/olivierlacan/keep-a-changelog).
+## [3.0.3](https://github.com/k0kubun/hamlit/compare/v3.0.2...v3.0.3) - 2022-11-07
+
+### Added
+
+- Support sass-embedded [#196](https://github.com/k0kubun/hamlit/issues/196)
+ *Thanks to @ntkme*
+
+## [3.0.2](https://github.com/k0kubun/hamlit/compare/v3.0.1...v3.0.2) - 2022-10-13
+
+### Changed
+
+- `Hamlit::Engine` and `Hamlit::Template` use StringBuffer instead of ArrayBuffer
+ - It seems more performant in many cases with recent Ruby versions.
+ - `Hamlit::RailsTemplate` is not affected.
+
+## [3.0.1](https://github.com/k0kubun/hamlit/compare/v3.0.0...v3.0.1) - 2022-08-18
+
+### Changed
+
+- coffee-script is removed from development dependency
+ - It's not runtime dependency, so it shouldn't impact your application
+ - `:coffee` filter still works if you explicitly install coffee-script,
+ however, it's no longer maintained and possibly removed in the future.
+
+## [3.0.0](https://github.com/k0kubun/hamlit/compare/v2.16.2...v3.0.0) - 2022-08-07
+
+### Changed
+
+- [**breaking**] Use `disable_capture: false` for non-Rails environments
+ - `:disable_capture` is an option introduced in v2.16.1. See its release notes for details.
+ - If you use Rails, it continues to use `disable_capture: true`, so you're not impacted by this change.
+
+## [2.16.2](https://github.com/k0kubun/hamlit/compare/v2.16.1...v2.16.2) - 2022-08-07
+
+### Fixed
+
+- Fix an issue when `disable_capture: false` is set and a Ruby comment is put after `do`
+
+## [2.16.1](https://github.com/k0kubun/hamlit/compare/v2.16.0...v2.16.1) - 2022-08-07
+
+### Added
+
+- Introduce `:disable_capture` option to capture a block
+ - Default: `disable_capture: true` (backward-compatible)
+ - For Rails, this must be `true` anyway to use Rails-native capturing.
+ - If you override the option like `disable_capture: false` in Hamlit::Template,
+ scripts starting with `=` (e.g. `= render do`) capture a block content.
+ - Scripts starting with `-` (e.g. `- users.each do`) are not impacted.
+
+## [2.16.0](https://github.com/k0kubun/hamlit/compare/v2.15.2...v2.16.0) - 2022-02-03
+
+### Added
+
+- Raise an exception on a Haml-level syntax error with `hamlit compile -c`
+ [#189](https://github.com/k0kubun/hamlit/issues/189)
+ *Thanks to @dlwr*
+
+## [2.15.2](https://github.com/k0kubun/hamlit/compare/v2.15.1...v2.15.2) - 2022-01-04
+
+### Fixed
+
+- Consider `playsinline` a boolean attribute [#187](https://github.com/k0kubun/hamlit/issues/187)
+ *Thanks to @ghiculescu*
+
## [2.15.1](https://github.com/k0kubun/hamlit/compare/v2.15.0...v2.15.1) - 2021-07-23
### Fixed
diff --git a/Gemfile b/Gemfile
index 9515326..24d81c7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -18,7 +18,6 @@ else
gem 'redcarpet'
if RUBY_PLATFORM !~ /mswin|mingw/ && RUBY_ENGINE != 'truffleruby'
- gem 'faml'
gem 'stackprof'
end
end
diff --git a/README.md b/README.md
index 3211b67..c729b52 100644
--- a/README.md
+++ b/README.md
@@ -5,12 +5,22 @@
Hamlit is a high performance [Haml](https://github.com/haml/haml) implementation.
+## Project status
+
+**Hamlit's implementation was copied to Haml 6.**
+From Haml 6, you don't need to switch to Hamlit.
+
+Both Haml 6 and Hamlit are still maintained by [@k0kubun](https://github.com/k0kubun).
+While you don't need to immediately deprecate Hamlit, Haml 6 has more maintainers
+and you'd better start a new project with Haml rather than Hamlit,
+given no performance difference between them.
+
## Introduction
### What is Hamlit?
Hamlit is another implementation of [Haml](https://github.com/haml/haml).
-With some [limitations](REFERENCE.md#limitations) by design for performance,
-Hamlit is **1.94x times faster** than original haml gem in [this benchmark](benchmark/slim/run-benchmarks.rb),
+With some [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics) for performance,
+Hamlit is **1.94x times faster** than the original Haml 5 in [this benchmark](benchmark/run-benchmarks.rb),
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))
<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
haml v5.2.0: 127834.4 i/s - 1.94x slower
```
-### Why is Hamlit faster?
+### Why is Hamlit fast?
#### Less string concatenation by design
-As written in [limitations](REFERENCE.md#limitations), Hamlit drops some not-so-important features which require
-works on runtime. With the optimized language design, we can reduce the string concatenation
+As written in [Hamlit's characteristics](REFERENCE.md#hamlits-characteristics),
+Hamlit drops some not-so-important features which require works on runtime.
+With the optimized language design, we can reduce the string concatenation
to build attributes.
#### Static analyzer
@@ -42,7 +53,7 @@ with C extension.
## Usage
-Hamlit currently supports Ruby 2.1 and higher. See [REFERENCE.md](REFERENCE.md) for detail features of Hamlit.
+See [REFERENCE.md](REFERENCE.md) for details.
### Rails
@@ -97,40 +108,6 @@ $ hamlit render in.haml
## Contributing
-### Test latest version
-
-```rb
-# Gemfile
-gem 'hamlit', github: 'k0kubun/hamlit', submodules: true
-```
-
-### Development
-
-Contributions are welcomed. It'd be good to see
-[Temple's EXPRESSIONS.md](https://github.com/judofyr/temple/blob/v0.7.6/EXPRESSIONS.md)
-to learn Temple which is a template engine framework used in Hamlit.
-
-```bash
-$ git clone --recursive https://github.com/k0kubun/hamlit
-$ cd hamlit
-$ bundle install
-
-# Run all tests
-$ bundle exec rake test
-
-# Run one test
-$ bundle exec ruby -Ilib:test -rtest_helper test/hamlit/line_number_test.rb -l 12
-
-# Show compiling/rendering result of some template
-$ bundle exec exe/hamlit compile in.haml
-$ bundle exec exe/hamlit render in.haml
-
-# Use rails app to debug Hamlit
-$ cd sample/rails
-$ bundle install
-$ bundle exec rails s
-```
-
### Reporting an issue
Please report an issue with following information:
diff --git a/REFERENCE.md b/REFERENCE.md
index 73d9baa..541d360 100644
--- a/REFERENCE.md
+++ b/REFERENCE.md
@@ -5,81 +5,7 @@ See [Haml's tutorial](http://haml.info/tutorial.html) if you are not familiar wi
[REFERENCE - Haml Documentation](http://haml.info/docs/yardoc/file.REFERENCE.html)
-## Supported features
-
-See [Haml's reference](http://haml.info/docs/yardoc/file.REFERENCE.html)
-for full features in original implementation.
-
-- [ ] Using Haml
- - [x] Rails XSS Protection
- - [x] Ruby Module
- - [x] Options
- - [ ] Encodings
-- [x] Plain Text
- - [x] Escaping: \
-- [ ] HTML Elements
- - [x] Element Name: %
- - [ ] Attributes: `
- - [x] :class and :id Attributes
- - [x] HTML-style Attributes: ()
- - [x] Ruby 1.9-style Hashes
- - [ ] Attribute Methods
- - [x] Boolean Attributes
- - [x] HTML5 Custom Data Attributes
- - [x] Class and ID: . and #
- - Implicit Div Elements
- - [x] Empty (void) Tags: /
- - [x] Whitespace Removal: > and <
- - [x] Object Reference: []
-- [x] Doctype: !!!
-- [x] Comments
- - [x] HTML Comments: /
- - [x] Conditional Comments: /[]
- - [x] Haml Comments: -#
-- [x] Ruby Evaluation
- - [x] Inserting Ruby: =
- - [x] Running Ruby: -
- - [x] Ruby Blocks
- - [x] Whitespace Preservation: ~
- - [x] Ruby Interpolation: #{}
- - [x] Escaping HTML: &=
- - [x] Unescaping HTML: !=
-- [ ] Filters
- - [x] :cdata
- - [x] :coffee
- - [x] :css
- - [x] :erb
- - [x] :escaped
- - [x] :javascript
- - [x] :less
- - [x] :markdown
- - [ ] :maruku
- - [x] :plain
- - [x] :preserve
- - [x] :ruby
- - `haml_io` API is not supported. Use [hamlit-haml\_io.gem](https://github.com/hamlit/hamlit-haml_io) if you need.
- - [x] :sass
- - [x] :scss
- - [ ] :textile
- - [ ] Custom Filters
-- [x] Helper Methods
- - [x] preserve
- - [x] surround
- - [x] precede
- - [x] succeed
-- [x] Multiline: |
-- [x] Whitespace Preservation
-- [ ] Helpers
-
-
-## Limitations
-
-### No Haml buffer
-Hamlit uses `Array` as buffer for performance. So you can't touch Haml::Buffer from template when using Hamlit.
-
-### Haml helpers are still in development
-At the same time, because some methods in `Haml::Helpers` require `Haml::Buffer`, they are not supported now.
-But some helpers are supported on Rails. Some of not-implemented methods are planned to be supported.
+## Hamlit's characteristics
### Limited attributes hyphenation
In Haml, `%a{ foo: { bar: 'baz' } }` is rendered as `<a foo-bar='baz'></a>`, whatever foo is.
diff --git a/Rakefile b/Rakefile
index a8554ff..4b336df 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,4 +1,3 @@
-require 'bundler/setup'
require 'bundler/gem_tasks'
#
@@ -105,11 +104,7 @@ end
desc 'bench task for CI'
task bench: :compile do
- if ENV['SLIM_BENCH'] == '1'
- cmd = %w[bundle exec ruby benchmark/slim/run-benchmarks.rb]
- else
- cmd = ['bin/bench', 'bench', ('-c' if ENV['COMPILE'] == '1'), *ENV['TEMPLATE'].split(',')].compact
- end
+ cmd = %w[bundle exec ruby benchmark/run-benchmarks.rb]
exit system(*cmd)
end
diff --git a/benchmark/slim/LICENSE b/benchmark/LICENSE
similarity index 100%
rename from benchmark/slim/LICENSE
rename to benchmark/LICENSE
diff --git a/benchmark/boolean_attribute.haml b/benchmark/boolean_attribute.haml
deleted file mode 100644
index 82587a6..0000000
--- a/benchmark/boolean_attribute.haml
+++ /dev/null
@@ -1,6 +0,0 @@
-%input{ disabled: false }
-%input{ disabled: true }
-- disabled = false
-%input{ disabled: disabled }
-- disabled = true
-%input{ disabled: disabled }
diff --git a/benchmark/class_attribute.haml b/benchmark/class_attribute.haml
deleted file mode 100644
index 2faaf7e..0000000
--- a/benchmark/class_attribute.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-.book{ class: 'content active' }
-.book(class='content active')
-
-- klass = %w[content active]
-.book{ class: klass }
diff --git a/benchmark/common_attribute.haml b/benchmark/common_attribute.haml
deleted file mode 100644
index 7516da9..0000000
--- a/benchmark/common_attribute.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-%a{ href: '&"\'<>' }
-- href = '&"\'<>'
-%a{ href: href }
diff --git a/benchmark/slim/context.rb b/benchmark/context.rb
similarity index 100%
rename from benchmark/slim/context.rb
rename to benchmark/context.rb
diff --git a/benchmark/data_attribute.haml b/benchmark/data_attribute.haml
deleted file mode 100644
index b2ba20c..0000000
--- a/benchmark/data_attribute.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-%div{ data: { disabled: false } }
-%div{ data: { disabled: true } }
-- hash = { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 }
-%div{ data: hash } data
diff --git a/benchmark/dynamic_attributes/boolean_attribute.haml b/benchmark/dynamic_attributes/boolean_attribute.haml
deleted file mode 100644
index f619d53..0000000
--- a/benchmark/dynamic_attributes/boolean_attribute.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- hash = { disabled: false }
-%input{ hash }
-- hash = { disabled: true }
-%input{ hash }
diff --git a/benchmark/dynamic_attributes/class_attribute.haml b/benchmark/dynamic_attributes/class_attribute.haml
deleted file mode 100644
index 3c750de..0000000
--- a/benchmark/dynamic_attributes/class_attribute.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- hash = { class: %w[content active] }
-.book{ hash }
-- arr = %w[foo bar]
-.book(class=arr){ hash }
diff --git a/benchmark/dynamic_attributes/common_attribute.haml b/benchmark/dynamic_attributes/common_attribute.haml
deleted file mode 100644
index 9c3e19f..0000000
--- a/benchmark/dynamic_attributes/common_attribute.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- hash = { href: '&"\'<>' }
-%a{ hash }
diff --git a/benchmark/dynamic_attributes/data_attribute.haml b/benchmark/dynamic_attributes/data_attribute.haml
deleted file mode 100644
index a53d89b..0000000
--- a/benchmark/dynamic_attributes/data_attribute.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- hash = { data: { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 } }
-%div{ hash } data
diff --git a/benchmark/dynamic_attributes/id_attribute.haml b/benchmark/dynamic_attributes/id_attribute.haml
deleted file mode 100644
index 2969893..0000000
--- a/benchmark/dynamic_attributes/id_attribute.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- hash = { id: %w[content active] }
-#book{ hash }
diff --git a/benchmark/dynamic_boolean_attribute.haml b/benchmark/dynamic_boolean_attribute.haml
deleted file mode 100644
index e8b9c90..0000000
--- a/benchmark/dynamic_boolean_attribute.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- disabled = false
-%input{ disabled: disabled }
-- disabled = true
-%input{ disabled: disabled }
diff --git a/benchmark/dynamic_merger/benchmark.rb b/benchmark/dynamic_merger/benchmark.rb
deleted file mode 100644
index 220281f..0000000
--- a/benchmark/dynamic_merger/benchmark.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-# Original: https://github.com/amatsuda/string_template/blob/master/benchmark.rb
-require 'benchmark_driver'
-
-Benchmark.driver(repeat_count: 8) do |x|
- x.prelude %{
- require 'rails'
- require 'action_view'
- require 'string_template'
- StringTemplate::Railtie.run_initializers
- require 'hamlit'
- Hamlit::Railtie.run_initializers
- Hamlit::RailsTemplate.set_options(escape_html: false, generator: Temple::Generators::ArrayBuffer)
- require 'action_view/base'
-
- (view = Class.new(ActionView::Base).new(ActionView::LookupContext.new(''))).instance_variable_set(:@world, 'world!')
-
- # compile template
- hello = 'benchmark/dynamic_merger/hello'
- view.render(template: hello, handlers: 'string')
- view.render(template: hello, handlers: 'haml')
- }
- x.report 'string', %{ view.render(template: hello, handlers: 'string') }
- x.report 'hamlit', %{ view.render(template: hello, handlers: 'haml') }
- x.loop_count 100_000
-end
diff --git a/benchmark/dynamic_merger/hello.haml b/benchmark/dynamic_merger/hello.haml
deleted file mode 100644
index 57755b0..0000000
--- a/benchmark/dynamic_merger/hello.haml
+++ /dev/null
@@ -1,50 +0,0 @@
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
diff --git a/benchmark/dynamic_merger/hello.string b/benchmark/dynamic_merger/hello.string
deleted file mode 100644
index 57755b0..0000000
--- a/benchmark/dynamic_merger/hello.string
+++ /dev/null
@@ -1,50 +0,0 @@
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
-hello, #{ @world }
diff --git a/benchmark/etc/attribute_builder.haml b/benchmark/etc/attribute_builder.haml
deleted file mode 100644
index 7c607e1..0000000
--- a/benchmark/etc/attribute_builder.haml
+++ /dev/null
@@ -1,5 +0,0 @@
-- h = { 'user' => { id: 1234, name: 'eagletmt' }, book_id: 5432 }
-- c = %w[content active]
-
-%span.book{data: h, class: c}
- Book
diff --git a/benchmark/etc/real_sample.haml b/benchmark/etc/real_sample.haml
deleted file mode 100644
index 1119690..0000000
--- a/benchmark/etc/real_sample.haml
+++ /dev/null
@@ -1,888 +0,0 @@
-#id-1
- = render partial: 'test'
-
- %ul#id-2.class-1.class-2
-
- %section#id-3
- .class-3 string-1
- .class-4
- .class-5 string-2
- %pre.class-6(readonly="readonly" style='width:1px')
- :preserve
- .class-7 string-3
-
- .class-8 string-4
- %pre.class-9(readonly="readonly" style='width:2px')
- :preserve
- .class-10 string-5
- %p
- Hello world
-
- .class-12 string-6
- %pre.class-13(readonly="readonly" style='width:3px')
- :preserve
- .class-14 string-7
- %p
- Hello world
-
- %section#id-4
- .class-17 string-8
- .class-18
- .class-19 string-9
- %pre.class-20(readonly="readonly" style='width:4px')
- :preserve
- .class-21 string-10
-
- .class-22 string-11
- %pre.class-23(readonly="readonly" style='width:5px')
- :preserve
- .class-24 string-12
-
- .class-25.class-26 Hello world
- %pre.class-27(readonly="readonly" style='width:6px')
- :preserve
- .class-28.class-29 Hello world
-
- %section#id-5
- .class-30 string-13
- .class-31 string-14
- .class-32
- %pre.class-33(readonly="readonly" style='width:7px')
- :preserve
- .class-34 string-15
-
- %section#id-6
- .class-35 string-16
- %ul.class-36.class-37
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
- .class-38
- %p text-17
- %p text-18
- %pre.class-41(readonly="readonly" style='width:8px')
- :preserve
- %ul.class-42.class-43
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
- %li
- = link_to 'link', '#', class: 'klass'
-
- %section#id-7
- .class-44 string-19
- %ul.class-45.class-46
- %li#id-8
- = link_to 'link', '#', class: 'klass1 klass2'
- .class-47.class-48.class-49
- Hello world
- .class-50
- %pre.class-51(readonly="readonly" style='width:9px')
- :preserve
- %ul.class-52.class-53
- %li#id-10
- = link_to 'link',
- '#id-11',
- class: 'klass1 klass2'
- .class-54.class-55.class-56
- Hello world
-
- %section#id-12
- .class-57 string-20
- %ul.class-58.class-59
- %li
- = link_to 'link', '#'
- .class-60 string-21
- .class-61 string-22
- %li
- = link_to 'link', '#'
- .class-62 string-23
- .class-63 string-24
- .class-64
- %pre.class-65(readonly="readonly" style='width:10px')
- :preserve
- %ul.class-66.class-67
- %li
- = link_to 'link', '#'
- .class-68 string-25
- .class-69 string-26
- %li
- = link_to 'link', '#'
- .class-70 string-27
- .class-71 string-28
-
- %section#id-13
- .class-72 string-29
- %ul.class-73.class-74
- %li
- = link_to 'link', '#'
- .class-75 string-30
- .class-76 string-31
- %li
- = link_to 'link', '#'
- = image_tag 'https://google.com/favicon.ico', class: 'klass1'
- .class-78 string-32
- %li
- = link_to 'link', '#'
- = image_tag 'https://google.com/favicon.ico', class: 'klass1'
- .class-80
- .class-81 string-33
- .class-82 string-34
- %li
- = link_to 'link', '#'
- = image_tag 'https://google.com/favicon.ico', class: 'klass1'
- .class-84
- .class-85 string-35
- .class-86 string-36
- %li
- = link_to 'link', '#'
- = image_tag 'https://google.com/favicon.ico', class: 'klass1'
- .class-88 string-37
- .class-89 string-38
- .class-90
- %pre.class-91(readonly="readonly" style='width:11px')
- :preserve
- %ul.class-92.class-93
- %li
- = link_to 'link', '#'
- .class-94 string-39
- .class-95 string-40
- %li
- = link_to 'link', '#'
- = image_tag class: 'klass1'
- .class-96 string-41
- %li
- = link_to 'link', '#'
- = image_tag class: 'klass1'
- .class-97
- .class-98 string-42
- .class-99 string-43
- %li
- = link_to 'link', '#'
- = image_tag class: 'klass1'
- .class-100
- .class-101 string-44
- .class-102 string-45
- %li
- = link_to 'link', '#'
- = image_tag class: 'klass1'
- .class-103 string-46
- .class-104 string-47
-
- %section#id-14
- .class-105 string-48
- %ul.class-106.class-107.class-108
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
-
- .class-109
- %pre.class-110(readonly="readonly" style='width:12px')
- :preserve
- %ul.class-111.class-112.class-113
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
-
- %section#id-15
- .class-114 string-49
- %ul.class-115.class-116.class-117
- %li
- = link_to 'link', '#', class: 'klass'
- = image_tag 'https://github.com/favicon.ico', class: 'klass'
- .class-119 string-50
- %li
- = link_to 'link', '#', class: 'klass'
- = image_tag 'https://github.com/favicon.ico', class: 'klass'
- .class-121 string-51
- %li
- = link_to 'link', '#', class: 'klass'
- = image_tag 'https://github.com/favicon.ico', class: 'klass'
- .class-123 string-52
- %li
- = link_to 'link', '#', class: 'klass'
- = image_tag 'https://github.com/favicon.ico', class: 'klass'
- .class-125 string-53
-
- .class-126
- %pre.class-127(readonly="readonly" style='width:13px')
- :preserve
- %ul.class-128.class-129.class-130
- %li
- = link_to 'link', '#'
- = image_tag clsss: 'klass'
- .class-131 string-54
- %li
- = link_to 'link', '#'
- = image_tag clsss: 'klass'
- .class-132 string-55
-
- %section#id-16
- .class-133 string-56
- %ul.class-134.class-135
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
- .class-136
- %pre.class-137(readonly="readonly" style='width:14px')
- :preserve
- %ul.class-138.class-139
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
-
- %section#id-17
- .class-140 string-57
- .class-141
- %ul.class-142
- %li
- = image_tag 'https://github.com/favicon.ico'
- %li
- = image_tag 'https://github.com/favicon.ico'
- %li
- = image_tag 'https://github.com/favicon.ico'
-
-
- %pre.class-146(readonly="readonly" style='width:15px')
- :preserve
- %ul.class-147
- %li
- = image_tag ''
- %li
- = image_tag ''
- %li
- = image_tag ''
-
- %section#id-18
- .class-148 string-58
- .class-149
- .class-150
- .class-151.class-152
- = image_tag 'https://github.com/favicon.ico'
- .class-154.class-155
- .class-156-title string-59
- Hello world
-
- %pre.class-157(readonly="readonly" style='width:16px')
- :preserve
- .class-158
- .class-159.class-160
- Hello world
- .class-161.class-162
- Hello world
-
- %p text-60
-
- %section#id-19
- .class-164 string-61
- .class-165
- .class-166
- .class-167
- = image_tag 'https://github.com/favicon.ico'
- .class-169
- = image_tag 'https://github.com/favicon.ico'
- .class-171
- = image_tag 'https://github.com/favicon.ico'
-
- .class-173
- .class-174-title string-62
- str
-
- %pre.class-175(readonly="readonly" style='width:17px')
- :preserve
- .class-176
- .class-177
- = image_tag ''
- .class-178
- = image_tag ''
- .class-179
- = image_tag ''
- .class-180
- content
- %p text-63
- %p text-64
-
-
- %section#id-20
- .class-182 string-65
- .class-183
- %ul.class-184.class-185
- %li.class-186.class-187
- %span.class-188 str
- %li.class-189
- = link_to 'link', '#', class: 'klass'
- .class-190
- %pre.class-191(readonly="readonly" style='width:18px')
- :preserve
- .class-192
- %ul.class-193.class-194
- %li.class-195.class-196
- %span.class-197 str
- %li.class-198
- = link_to 'link', '#', class: 'klass'
-
- %section#id-21
- .class-199 string-66
- .class-200
- %ul.class-201
- %li.class-202.class-203
- %span.class-204 str
- %li.class-205
- = link_to 'link', '#', class: 'klass'
- %li.class-206
- = link_to 'link', '#', class: 'klass'
- .class-207
- %pre.class-208(readonly="readonly" style='width:19px')
- :preserve
- .class-209
- %ul.class-210
- %li.class-211.class-212
- %span.class-213 str
- %li.class-214
- = link_to 'link', '#', class: 'klass'
- %li.class-215
- = link_to 'link', '#', class: 'klass'
-
- %section#id-22
- .class-216 string-67
- %ul.class-217
- %li.class-218
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- .class-219
- %pre.class-220(readonly="readonly" style='width:20px')
- :preserve
- %ul.class-221
- %li.class-222
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
-
- %p text-68
-
- %section#id-23
- .class-223 string-69
- %ul.class-224
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- .class-225
- %pre.class-226(readonly="readonly" style='width:21px')
- :preserve
- %ul.class-227
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
- %li
- = link_to 'link', '#'
-
- %section#id-24
- .class-228 string-70
- .class-229
- %a(href="#" class="button") Hello world
- %p text-71
- %pre.class-230(readonly="readonly" style='width:22px')
- :preserve
- = link_to 'link', '#', class: 'klass'
-
- %a(href="#" class="button min") Hello world
- %pre.class-231(readonly="readonly" style='width:23px')
- :preserve
- = link_to 'link', '#', class: 'klass'
-
- %section#id-25
- .class-232 string-72
- .class-233
- %a(href="#" class="klass") Hello world
- %p text-73
- %pre.class-234(readonly="readonly" style='width:24px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
-
- %a(href="#" class="klass") Hello world
- %pre.class-235(readonly="readonly" style='width:25px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
-
- %a(href="#" class="klass") Hello world
- %pre.class-236(readonly="readonly" style='width:26px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
-
- %section#id-26
- .class-237 string-74
- .class-238
- %a(href="#" class="klass") Hello world
- %p text-75
- %pre.class-239(readonly="readonly" style='width:27px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
- %a(href="#" class="klass") Hello world
- %pre.class-240(readonly="readonly" style='width:28px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
- %a(href="#" class="klass") Hello world
- %pre.class-241(readonly="readonly" style='width:29px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
-
- %section#id-27
- .class-242 string-76
- .class-243
- %a(href="#" class="klass") Hello world
- %p text-77
- %pre.class-244(readonly="readonly" style='width:30px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
- %a(href="#" class="klass") Hello world
- %pre.class-245(readonly="readonly" style='width:31px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
- %a(href="#" class="klass") Hello world
- %pre.class-246(readonly="readonly" style='width:32px')
- :preserve
- = link_to 'link', '#',
- class: 'klass'
-
- %section#id-28
- .class-247 string-78
- %a(href="#" class="klass")
- str
- %span.class-248
- str
- %b text-79
- str
- .class-249
- %pre.class-250(readonly="readonly" style='width:33px')
- :preserve
- = link_to 'link', '#'
- %span.class-251
- str
- %b text-80
- str
-
- %section#id-29
- .class-252 string-81
- %label.class-253{for: 'f1_c1'}
- %input{type: 'checkbox', id: 'f1_c1', checked: 'checked'}
- str
- %label.class-254{for: 'f1_c2'}
- %input{type: 'checkbox', id: 'f1_c2'}
- str
- .class-255
- %pre.class-256(readonly="readonly" style='width:34px')
- :preserve
- %label.class-257{for: 'f1_c1'}
- %input{type: 'checkbox', id: 'f1_c1', checked: 'checked'}
- str
- %label.class-258{for: 'f1_c2'}
- %input{type: 'checkbox', id: 'f1_c2'}
- str
-
- %label.class-259{for: 'f1_r1'}
- %input{type: 'radio', name: 'form1', id: 'f1_r1', checked: 'checked'}
- str
- %label.class-260{for: 'f1_r2'}
- %input{type: 'radio', name: 'form1', id: 'f1_r2'}
- str
- .class-261
- %pre.class-262(readonly="readonly" style='width:35px')
- :preserve
- %label.class-263{for: 'f1_r1'}
- %input{type: 'radio', name: 'form1', id: 'f1_r1', checked: 'checked'}
- str
- %label.class-264{for: 'f1_r2'}
- %input{type: 'radio', name: 'form1', id: 'f1_r2'}
- str
-
- %section#id-30
- .class-265 string-82
- %ul.class-266.class-267
- %li
- %label.class-268{for: 'f2_c1'}
- %input{type: 'checkbox', id: 'f2_c1', checked: 'checked'}
- str
- %li
- %label.class-269{for: 'f2_c2'}
- %input{type: 'checkbox', id: 'f2_c2'}
- str
- .class-270
- %pre.class-271(readonly="readonly" style='width:36px')
- :preserve
- %ul.class-272.class-273
- %li
- %label.class-274{for: 'f2_c1'}
- %input{type: 'checkbox', id: 'f2_c1', checked: 'checked'}
- str
- %li
- %label.class-275{for: 'f2_c2'}
- %input{type: 'checkbox', id: 'f2_c2'}
- str
-
- %ul.class-276.class-277
- %li
- %label.class-278{for: 'f2_r1'}
- %input{type: 'radio', name: 'form2', id: 'f2_r1', checked: 'checked'}
- str
- %li
- %label.class-279{for: 'f2_r2'}
- %input{type: 'radio', name: 'form2', id: 'f2_r2'}
- str
- .class-280
- %pre.class-281(readonly="readonly" style='width:37px')
- :preserve
- %ul.class-282.class-283
- %li
- %label.class-284{for: 'f2_r1'}
- %input{type: 'radio', name: 'form2', id: 'f2_r1', checked: 'checked'}
- str
- %li
- %label.class-285{for: 'f2_r2'}
- %input{type: 'radio', name: 'form2', id: 'f2_r2'}
- str
-
- %section#id-31
- .class-286 string-83
- .class-287
- %ul.class-288
- %li text-84
- %li text-85
- %pre.class-289(readonly="readonly" style='width:38px')
- :preserve
- %ul.class-290
- %li text-86
- %li text-87
-
- %ul.class-291.class-292
- %li text-88
- %li text-89
- %pre.class-293(readonly="readonly" style='width:39px')
- :preserve
- %ul.class-294.class-295
- %li text-90
- %li text-91
-
- %ul.class-296.class-297
- %li text-92
- %li text-93
- %pre.class-298(readonly="readonly" style='width:40px')
- :preserve
- %ul.class-299.class-300
- %li text-94
- %li text-95
-
- %ul.class-301.class-302
- %li text-96
- %li text-97
- %pre.class-303(readonly="readonly" style='width:41px')
- :preserve
- %ul.class-304.class-305
- %li text-98
- %li text-99
-
- %section#id-32
- .class-306 string-100
- .class-307
- = image_tag '#'
- = image_tag '#'
- %pre.class-312(readonly="readonly" style='width:42px')
- :preserve
- = image_tag '#'
- = image_tag '#'
-
- %section#id-33
- .class-315 string-101
- .class-316
- = image_tag '#'
- %span.class-317 str
- %pre.class-318(readonly="readonly" style='width:43px')
- :preserve
- = image_tag '#'
- %span.class-319 str
-
- %section#id-34
- .class-320 string-102
- .class-321
- %a(href="#" class="klass")
- %pre.class-322(readonly="readonly" style='width:44px')
- :preserve
- = link_to '', '#', class: 'klass'
-
- %section#id-35
- .class-323 string-103
- .class-324
- %a(href="#" class="klass")
- %pre.class-325(readonly="readonly" style='width:45px')
- :preserve
- = link_to '', '#', class: 'klass'
-
- %section#id-36
- .class-326 string-104
- .class-327
- .class-328
- %a(rel="prev" href="#")
- %a(rel="next" href="#")
- %pre.class-329(readonly="readonly" style='width:46px')
- :preserve
- .class-330
- = link_to '', '#', rel: 'klass'
- = link_to '', '#', rel: 'klass'
-
- %section#id-37
- .class-331 string-105
- .class-332
- .class-333
- .class-334
- %strong text-106
- %span text-107
- .class-335{ style: "width: 50%;" }
-
- %pre.class-336{ readonly: "readonly", style: "height: 120px" }
- :preserve
- .class-337
- .class-338
- %strong text-108
- %span text-109
- .class-339{ style: "width: 50%;" }
-
- .class-340.class-341
- .class-342
- %strong text-110
- %span text-111
- .class-343{ style: "width: 50%;" }
-
- %pre.class-344{ readonly: "readonly", style: "height: 120px" }
- :preserve
- .class-345.class-346
- .class-347
- %strong text-112
- %span text-113
- .class-348{ style: "width: 50%;" }
-
- %section#id-38
- .class-349 string-114
- .class-350
- = render '#'
- = render '#'
- %pre.class-351(readonly="readonly" style='width:47px')
- :preserve
- = render '#'
- = render '#'
-
- %p text-115
- %p text-116
-
- %section#id-39
- .class-353 string-117
- .class-354
- = link_to 'link', '#', class: 'klass1 klass2', :'data-foo_bar' => 'foo!!'
- .class-355
- .class-356 string-118
- %pre.class-357(readonly="readonly" style='width:48px')
- :preserve
- = link_to 'link', '#',
- class: 'klass1 klass2',
- :'data-foo_bar' => 'foo!!'
- .class-358 string-119
- %pre.class-359(readonly="readonly" style='width:49px')
- :preserve
- foo.bar('Hoge')
-
- %section#id-40
- .class-361 string-120
- .class-362
- = link_to 'link', '#', class: 'klass1 klass2 klass3'
- .class-363
- .class-364 string-121
- %pre.class-365(readonly="readonly" style='width:50px')
- :preserve
- = link_to 'link', '#',
- class: 'klass1 klass2 klass3'
-
- .class-366 string-122
- %pre.class-367(readonly="readonly" style='width:51px')
- :preserve
- #id-43.class-368.class-369
- .class-370
- .class-371 string-123
- %a.class-372{href: "#"}
- str
-
- %p text-124
- %p text-125
-
- .class-373 string-126
- %pre.class-374(readonly="readonly" style='width:52px')
- :preserve
- // hello
- $(window).bind('click', function(event) {
- });
-
- // hello
- $('#id-44').bind('click', function(event) {
- });
-
- // world
- $('#id-45').bind('click', function(event) {
- });
-
- %p text-127
-
- %section#id-46
- .class-378 string-128
- .class-379
- %ul.class-380
- %li.class-381
- str1
- %li.class-382
- str2
- %li.class-383
- str3
- :javascript
- $('.class-384').foo({bar: '.class-386'});
- :css
- .class-387 {
- min-height: 13px;
- }
- .class-388 {
- height: 1px;
- background: #000;
- padding: 1px;
- text-align: center;
- }
- .class-390 {
- background: #000;
- }
- .class-392 {
- background: #000;
- }
-
- .class-394
- %pre.class-395(readonly="readonly" style='width:53px')
- :preserve
- .class-396
- %ul.class-397
- %li.class-398 str1
- %li.class-399 str2
- %li.class-400 str3
- :javascript
- $('.class-401').bar({foo: '.class-403'});
-
- %ul.class-404.class-405
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
-
- .class-406
- %ul.class-407
- %li#id-52A.class-408 str1
- %li#id-53B.class-409 str2
- %li#id-54C.class-410 str3
-
- :javascript
- $('.class-411').click({foo: '.class-413 > li > a'});
-
- :css
- .class-414 {
- height: 1px;
- background: #000;
- padding: 1px;
- text-align: center;
- }
- .class-416 {
- background: #000;
- }
- .class-418 {
- background: #000;
- }
-
- .class-420
- %pre.class-421(readonly="readonly" style='width:54px')
- :preserve
- %ul.class-422.class-423
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
- %li= link_to 'link', '#'
-
- .class-424
- %ul.class-425
- %li#id-60A.class-426 str1
- %li#id-61B.class-427 str2
- %li#id-62C.class-428 str3
-
- :javascript
- $('.class-429').bind({links: '.klass'});
-
- %section#id-63
- .class-432 string-136
- .class-433
- .class-434 string-137
- %pre.class-435(readonly="readonly" style='width:55px')
- :preserve
- #id-64
- -# hello
-
- .class-436
- -# world
-
- %span.class-437
-
- #id-65
- -# hey
- .class-438 string-138
- %pre.class-439(readonly="readonly" style='width:56px')
- :preserve
- // hello
- $(document).bind('click', function(event) {
- });
-
- // world
- $(document).bind('click', function(event) {
- });
-
-#id-66XXX.class-442.class-443
- .class-444
- .class-445 string-139
-
- %a.class-446{href: "#"}
- str
-
-:javascript
- (function ($) {
- $(".foo").removeClass("bar");
- })(jQuery);
diff --git a/benchmark/etc/real_sample.rb b/benchmark/etc/real_sample.rb
deleted file mode 100644
index 5cefec7..0000000
--- a/benchmark/etc/real_sample.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-def render(*)
- '<div class="render"></div>'
-end
-
-def link_to(a, b, *c)
- "<a href='" << b << ">".freeze << a << '</div>'.freeze
-end
-
-def image_tag(*)
- '<img src="https://github.com/favicon.ico" />'
-end
diff --git a/benchmark/etc/static_analyzer.haml b/benchmark/etc/static_analyzer.haml
deleted file mode 100644
index 210a551..0000000
--- a/benchmark/etc/static_analyzer.haml
+++ /dev/null
@@ -1 +0,0 @@
-#foo.bar{ data: { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 } }
diff --git a/benchmark/etc/string_interpolation.haml b/benchmark/etc/string_interpolation.haml
deleted file mode 100644
index 6ccfe11..0000000
--- a/benchmark/etc/string_interpolation.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- id = 12347
-%a{ href: "https://example.com/users/#{id}" }= "id: #{id}"
diff --git a/benchmark/etc/tags.haml b/benchmark/etc/tags.haml
deleted file mode 100644
index 49c139d..0000000
--- a/benchmark/etc/tags.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-%span hello
-%div
- world
diff --git a/benchmark/etc/tags_loop.haml b/benchmark/etc/tags_loop.haml
deleted file mode 100644
index e5cf716..0000000
--- a/benchmark/etc/tags_loop.haml
+++ /dev/null
@@ -1,2 +0,0 @@
-- 100.times do
- %span hello
diff --git a/benchmark/ext/build_data.rb b/benchmark/ext/build_data.rb
deleted file mode 100755
index 5d47242..0000000
--- a/benchmark/ext/build_data.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bundler/setup'
-require 'hamlit'
-require 'faml'
-require 'benchmark/ips'
-require_relative '../utils/benchmark_ips_extension'
-
-h = { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 }
-
-Benchmark.ips do |x|
- quote = "'"
- faml_options = { data: h }
- x.report("Faml::AB.build") { Faml::AttributeBuilder.build(quote, true, nil, faml_options) }
- x.report("Hamlit.build_data") { Hamlit::AttributeBuilder.build_data(true, quote, h) }
- x.compare!
-end
diff --git a/benchmark/ext/build_id.rb b/benchmark/ext/build_id.rb
deleted file mode 100755
index 0551c74..0000000
--- a/benchmark/ext/build_id.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'bundler/setup'
-require 'hamlit'
-require 'faml'
-require 'benchmark/ips'
-require_relative '../utils/benchmark_ips_extension'
-
-Benchmark.ips do |x|
- x.report("Faml::AB.build") { Faml::AttributeBuilder.build("'", true, nil, {:id=>"book"}, id: %w[content active]) }
- x.report("Hamlit::AB.build_id") { Hamlit::AttributeBuilder.build_id(true, "book", %w[content active]) }
- x.compare!
-end
diff --git a/benchmark/graph/graph.key b/benchmark/graph/graph.key
deleted file mode 100644
index 8e73b78..0000000
Binary files a/benchmark/graph/graph.key and /dev/null differ
diff --git a/benchmark/graph/graph.png b/benchmark/graph/graph.png
deleted file mode 100644
index d6ca85b..0000000
Binary files a/benchmark/graph/graph.png and /dev/null differ
diff --git a/benchmark/id_attribute.haml b/benchmark/id_attribute.haml
deleted file mode 100644
index af6acf6..0000000
--- a/benchmark/id_attribute.haml
+++ /dev/null
@@ -1,3 +0,0 @@
-#book{ id: 'content active' }
-- id = %w[content active]
-#book{ id: id }
diff --git a/benchmark/plain.haml b/benchmark/plain.haml
deleted file mode 100644
index 4c7cdc3..0000000
--- a/benchmark/plain.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- hello = 'world'
-%span aaa#{hello}bbb
-%span
- aaa#{hello}bbb
diff --git a/benchmark/slim/run-benchmarks.rb b/benchmark/run-benchmarks.rb
similarity index 88%
rename from benchmark/slim/run-benchmarks.rb
rename to benchmark/run-benchmarks.rb
index 3f59cc1..b96ab82 100644
--- a/benchmark/slim/run-benchmarks.rb
+++ b/benchmark/run-benchmarks.rb
@@ -43,7 +43,6 @@ require 'tilt'
require 'erubi'
require 'erb'
require 'haml'
-require 'faml'
require 'hamlit'
class SlimBenchmarks
@@ -61,19 +60,23 @@ class SlimBenchmarks
def init_compiled_benches
context = Context.new
- haml_ugly = Haml::Engine.new(@haml_code, format: :html5, escape_html: true)
- haml_ugly.def_method(context, :run_haml_ugly)
+ if Gem::Version.new(Haml::VERSION) >= Gem::Version.new('6.0.0')
+ context.instance_eval %{
+ def run_haml; #{Haml::Engine.new.call @haml_code}; end
+ }
+ else
+ haml = Haml::Engine.new(@haml_code, format: :html5, escape_html: true)
+ haml.def_method(context, :run_haml)
+ end
context.instance_eval %{
def run_erubi; #{Erubi::Engine.new(@erb_code).src}; end
def run_slim_ugly; #{Slim::Engine.new.call @slim_code}; end
- def run_faml; #{Faml::Engine.new.call @haml_code}; end
def run_hamlit; #{Hamlit::Engine.new.call @haml_code}; end
}
bench("erubi v#{Erubi::VERSION}") { context.run_erubi } unless @only_haml
bench("slim v#{Slim::VERSION}") { context.run_slim_ugly } unless @only_haml
- bench("haml v#{Haml::VERSION}") { context.run_haml_ugly }
- bench("faml v#{Faml::VERSION}") { context.run_faml }
+ bench("haml v#{Haml::VERSION}") { context.run_haml }
bench("hamlit v#{Hamlit::VERSION}") { context.run_hamlit }
end
diff --git a/benchmark/script.haml b/benchmark/script.haml
deleted file mode 100644
index f318d7b..0000000
--- a/benchmark/script.haml
+++ /dev/null
@@ -1,4 +0,0 @@
-- dynamic = 'dynamic'
-= "#{ dynamic } script"
-= "#{ 'static'} script"
-= ['&', '"', "'", '<', '>']
diff --git a/benchmark/utils/benchmark_ips_extension.rb b/benchmark/utils/benchmark_ips_extension.rb
deleted file mode 100644
index a8fbe1e..0000000
--- a/benchmark/utils/benchmark_ips_extension.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-# Monkey patch to show milliseconds
-module Benchmark
- module IPS
- class Report
- module EntryExtension
- def body
- return super if Benchmark::IPS.options[:format] != :human
-
- left = "%s i/s (%1.3fms)" % [Helpers.scale(ips), (1000.0 / ips)]
- iters = Helpers.scale(@iterations)
-
- if @show_total_time
- left.ljust(20) + (" - %s in %10.6fs" % [iters, runtime])
- else
- left.ljust(20) + (" - %s" % iters)
- end
- end
- end
- Entry.prepend(EntryExtension)
- end
- end
-
- module CompareExtension
- def compare(*reports)
- return if reports.size < 2
-
- sorted = reports.sort_by(&:ips).reverse
- best = sorted.shift
- $stdout.puts "\nComparison:"
- $stdout.printf "%20s: %10.1f i/s (%1.3fms)\n", best.label, best.ips, (1000.0 / best.ips)
-
- sorted.each do |report|
- name = report.label.to_s
-
- x = (best.ips.to_f / report.ips.to_f)
- $stdout.printf "%20s: %10.1f i/s (%1.3fms) - %.2fx slower\n", name, report.ips, (1000.0 / report.ips), x
- end
-
- $stdout.puts
- end
- end
- extend CompareExtension
-end
diff --git a/benchmark/slim/view.erb b/benchmark/view.erb
similarity index 100%
rename from benchmark/slim/view.erb
rename to benchmark/view.erb
diff --git a/benchmark/slim/view.haml b/benchmark/view.haml
similarity index 100%
rename from benchmark/slim/view.haml
rename to benchmark/view.haml
diff --git a/benchmark/slim/view.slim b/benchmark/view.slim
similarity index 100%
rename from benchmark/slim/view.slim
rename to benchmark/view.slim
diff --git a/bin/bench b/bin/bench
index 93ca8b5..018ee42 100755
--- a/bin/bench
+++ b/bin/bench
@@ -2,7 +2,6 @@
require 'bundler/setup'
require 'hamlit'
-require 'faml'
require 'thor'
require 'benchmark/ips'
require_relative '../benchmark/utils/benchmark_ips_extension'
@@ -26,7 +25,6 @@ class Bench < Thor
Benchmark.ips do |x|
x.report("haml v#{Haml::VERSION}") { Haml::Engine.new(haml, escape_html: true, escape_attrs: true).precompiled }
- x.report("faml v#{Faml::VERSION}") { Faml::Engine.new.call(haml) }
x.report("hamlit v#{Hamlit::VERSION}") { Hamlit::Engine.new.call(haml) }
x.compare!
end
@@ -44,12 +42,10 @@ class Bench < Thor
end
Haml::Engine.new(haml, escape_html: true, escape_attrs: true).def_method(object, :haml)
- object.instance_eval "def faml; #{Faml::Engine.new.call(haml)}; end"
object.instance_eval "def hamlit; #{Hamlit::Engine.new.call(haml)}; end"
Benchmark.ips do |x|
x.report("haml v#{Haml::VERSION}") { object.haml }
- x.report("faml v#{Faml::VERSION}") { object.faml }
x.report("hamlit v#{Hamlit::VERSION}") { object.hamlit }
x.compare!
end
@@ -60,8 +56,6 @@ class Bench < Thor
haml = File.read(file)
puts "#{?= * 49}\n Haml Source: #{file}\n#{?= * 49}"
puts Haml::Engine.new(haml, escape_html: true, escape_attrs: true).precompiled
- puts "\n#{?= * 49}\n Faml Source: #{file}\n#{?= * 49}"
- puts Faml::Engine.new.call(haml)
puts "\n#{?= * 49}\n Hamlit Source: #{file}\n#{?= * 49}"
puts Hamlit::Engine.new.call(haml)
end
diff --git a/debian/changelog b/debian/changelog
index 716f28a..7788f5c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+ruby-hamlit (3.0.3-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+ * Drop patch 003-remove-coffee-script.patch, present upstream.
+
+ -- Debian Janitor <janitor@jelmer.uk> Sun, 26 Feb 2023 11:08:19 -0000
+
ruby-hamlit (2.15.1-3) unstable; urgency=medium
* Remove build dependency on ruby-coffee-script
diff --git a/debian/patches/001-remove-git-in-gemspec.patch b/debian/patches/001-remove-git-in-gemspec.patch
index 99007df..7191ca7 100644
--- a/debian/patches/001-remove-git-in-gemspec.patch
+++ b/debian/patches/001-remove-git-in-gemspec.patch
@@ -2,9 +2,11 @@ Description: Remove usage of git from gemspec
Author: Pirate Praveen <praveen@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/hamlit.gemspec
-+++ b/hamlit.gemspec
-@@ -14,7 +14,7 @@
+Index: ruby-hamlit.git/hamlit.gemspec
+===================================================================
+--- ruby-hamlit.git.orig/hamlit.gemspec
++++ ruby-hamlit.git/hamlit.gemspec
+@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
spec.homepage = 'https://github.com/k0kubun/hamlit'
spec.license = 'MIT'
diff --git a/debian/patches/002-remove-bundler.patch b/debian/patches/002-remove-bundler.patch
index db15dd9..6c280e4 100644
--- a/debian/patches/002-remove-bundler.patch
+++ b/debian/patches/002-remove-bundler.patch
@@ -2,8 +2,10 @@ Description: Remove usage of bundler from tests
Author: Pirate Praveen <praveen@debian.org>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---- a/test/test_helper.rb
-+++ b/test/test_helper.rb
+Index: ruby-hamlit.git/test/test_helper.rb
+===================================================================
+--- ruby-hamlit.git.orig/test/test_helper.rb
++++ ruby-hamlit.git/test/test_helper.rb
@@ -1,5 +1,5 @@
require 'unindent'
-require 'bundler/setup'
diff --git a/debian/patches/003-remove-coffee-script.patch b/debian/patches/003-remove-coffee-script.patch
deleted file mode 100644
index a99a594..0000000
--- a/debian/patches/003-remove-coffee-script.patch
+++ /dev/null
@@ -1,148 +0,0 @@
-From 939d3f711203412234dd9581f2b99bf95f23bfb6 Mon Sep 17 00:00:00 2001
-From: Takashi Kokubun <takashikkbn@gmail.com>
-Date: Thu, 18 Aug 2022 18:11:17 -0700
-Subject: [PATCH] Remove coffee from development dependency
-
-Close https://github.com/k0kubun/hamlit/issues/190
----
- hamlit.gemspec | 1 -
- test/hamlit/filters/coffee_test.rb | 62 ------------------------------
- test/hamlit/line_number_test.rb | 44 ---------------------
- 3 files changed, 107 deletions(-)
- delete mode 100644 test/hamlit/filters/coffee_test.rb
-
-diff --git a/hamlit.gemspec b/hamlit.gemspec
-index bce4e312..532109f0 100644
---- a/hamlit.gemspec
-+++ b/hamlit.gemspec
-@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
-
- spec.add_development_dependency 'benchmark_driver'
- spec.add_development_dependency 'bundler'
-- spec.add_development_dependency 'coffee-script'
- spec.add_development_dependency 'erubi'
- spec.add_development_dependency 'haml', '>= 5'
- spec.add_development_dependency 'less'
-diff --git a/test/hamlit/filters/coffee_test.rb b/test/hamlit/filters/coffee_test.rb
-deleted file mode 100644
-index d4dbb5c2..00000000
---- a/test/hamlit/filters/coffee_test.rb
-+++ /dev/null
-@@ -1,62 +0,0 @@
--describe Hamlit::Filters do
-- include RenderHelper
--
-- describe '#compile' do
-- it 'renders coffee filter' do
-- assert_render(<<-HTML.unindent, <<-HAML.unindent)
-- <script>
-- (function() {
-- var foo;
--
-- foo = function() {
-- return alert('hello');
-- };
--
-- }).call(this);
-- </script>
-- HTML
-- :coffee
-- foo = ->
-- alert('hello')
-- HAML
-- end
--
-- it 'renders coffeescript filter' do
-- assert_render(<<-HTML.unindent, <<-HAML.unindent)
-- <script>
-- (function() {
-- var foo;
--
-- foo = function() {
-- return alert('hello');
-- };
--
-- }).call(this);
-- </script>
-- HTML
-- :coffeescript
-- foo = ->
-- alert('hello')
-- HAML
-- end
--
-- it 'renders coffeescript filter' do
-- assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
-- <script>
-- (function() {
-- var foo;
--
-- foo = function() {
-- return alert("<&>");
-- };
--
-- }).call(this);
-- </script>
-- HTML
-- :coffee
-- foo = ->
-- alert("#{'<&>'}")
-- HAML
-- end
-- end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
--end
-diff --git a/test/hamlit/line_number_test.rb b/test/hamlit/line_number_test.rb
-index b6e8ed31..2805ca63 100644
---- a/test/hamlit/line_number_test.rb
-+++ b/test/hamlit/line_number_test.rb
-@@ -105,50 +105,6 @@
- end
-
- describe 'filters' do
-- describe 'coffee filter' do
-- it 'renders static filter' do
-- assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
-- <script>
-- (function() {
-- jQuery(function($) {
-- console.log('3');
-- return console.log('4');
-- });
--
-- }).call(this);
-- </script>
-- 5
-- HTML
-- :coffee
-- jQuery ($) ->
-- console.log('#{__LINE__}')
-- console.log('#{__LINE__}')
-- = __LINE__
-- HAML
-- end
--
-- it 'renders dynamic filter' do
-- assert_render(<<-HTML.unindent, <<-HAML.unindent)
-- <script>
-- (function() {
-- jQuery(function($) {
-- console.log('3');
-- return console.log('4');
-- });
--
-- }).call(this);
-- </script>
-- 5
-- HTML
-- :coffee
-- jQuery ($) ->
-- console.log('3')
-- console.log('4')
-- = __LINE__
-- HAML
-- end
-- end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
--
- describe 'css filter' do
- it 'renders static filter' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
diff --git a/debian/patches/series b/debian/patches/series
index f023beb..1a24192 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,2 @@
001-remove-git-in-gemspec.patch
002-remove-bundler.patch
-003-remove-coffee-script.patch
diff --git a/hamlit.gemspec b/hamlit.gemspec
index bce4e31..532109f 100644
--- a/hamlit.gemspec
+++ b/hamlit.gemspec
@@ -32,7 +32,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'benchmark_driver'
spec.add_development_dependency 'bundler'
- spec.add_development_dependency 'coffee-script'
spec.add_development_dependency 'erubi'
spec.add_development_dependency 'haml', '>= 5'
spec.add_development_dependency 'less'
diff --git a/lib/hamlit/attribute_builder.rb b/lib/hamlit/attribute_builder.rb
index 0893083..736379b 100644
--- a/lib/hamlit/attribute_builder.rb
+++ b/lib/hamlit/attribute_builder.rb
@@ -7,7 +7,7 @@ module Hamlit::AttributeBuilder
defer reversed ismap seamless muted required
autofocus novalidate formnovalidate open pubdate
itemscope allowfullscreen default inert sortable
- truespeed typemustmatch download].freeze
+ truespeed typemustmatch download playsinline].freeze
# Java extension is not implemented for JRuby yet.
# TruffleRuby does not implement `rb_ary_sort_bang`, etc.
diff --git a/lib/hamlit/cli.rb b/lib/hamlit/cli.rb
index 106c882..51fab82 100644
--- a/lib/hamlit/cli.rb
+++ b/lib/hamlit/cli.rb
@@ -106,6 +106,7 @@ module Hamlit
Hamlit::Engine.options.to_h.merge(
escape_attrs: options[:escape_attrs],
escape_html: options[:escape_html],
+ check_syntax: options[:check],
)
end
diff --git a/lib/hamlit/compiler.rb b/lib/hamlit/compiler.rb
index 4f2584f..7179d6f 100644
--- a/lib/hamlit/compiler.rb
+++ b/lib/hamlit/compiler.rb
@@ -16,7 +16,7 @@ module Hamlit
@comment_compiler = CommentCompiler.new
@doctype_compiler = DoctypeCompiler.new(options)
@filter_compiler = Filters.new(options)
- @script_compiler = ScriptCompiler.new(identity)
+ @script_compiler = ScriptCompiler.new(identity, options)
@silent_script_compiler = SilentScriptCompiler.new
@tag_compiler = TagCompiler.new(identity, options)
end
diff --git a/lib/hamlit/compiler/script_compiler.rb b/lib/hamlit/compiler/script_compiler.rb
index 18d4002..da04682 100644
--- a/lib/hamlit/compiler/script_compiler.rb
+++ b/lib/hamlit/compiler/script_compiler.rb
@@ -6,8 +6,9 @@ require 'hamlit/string_splitter'
module Hamlit
class Compiler
class ScriptCompiler
- def initialize(identity)
+ def initialize(identity, options)
@identity = identity
+ @disable_capture = options[:disable_capture]
end
def compile(node, &block)
@@ -79,7 +80,7 @@ module Hamlit
else
[:multi,
[:block, "#{var} = #{node.value[:text]}",
- [:multi, [:newline], yield(node)],
+ [:multi, [:newline], @disable_capture ? yield(node) : [:capture, Temple::Utils.unique_name, yield(node)]]
],
]
end
diff --git a/lib/hamlit/engine.rb b/lib/hamlit/engine.rb
index 886e33b..400fd9b 100644
--- a/lib/hamlit/engine.rb
+++ b/lib/hamlit/engine.rb
@@ -12,7 +12,7 @@ module Hamlit
class Engine < Temple::Engine
define_options(
:buffer_class,
- generator: Temple::Generators::ArrayBuffer,
+ generator: Temple::Generators::StringBuffer,
format: :html,
attr_quote: "'",
escape_html: true,
@@ -21,6 +21,8 @@ module Hamlit
hr img input isindex keygen link menuitem meta
param source track wbr),
filename: "",
+ check_syntax: false,
+ disable_capture: false,
)
use Parser
diff --git a/lib/hamlit/filters/tilt_base.rb b/lib/hamlit/filters/tilt_base.rb
index cb7e1d4..b10fd00 100644
--- a/lib/hamlit/filters/tilt_base.rb
+++ b/lib/hamlit/filters/tilt_base.rb
@@ -7,7 +7,11 @@ module Hamlit
def self.render(name, source, indent_width: 0)
text = ::Tilt["t.#{name}"].new { source }.render
return text if indent_width == 0
- text.gsub!(/^/, ' ' * indent_width)
+ if text.frozen?
+ text.gsub(/^/, ' ' * indent_width)
+ else
+ text.gsub!(/^/, ' ' * indent_width)
+ end
end
def explicit_require?(needed_registration)
diff --git a/lib/hamlit/parser.rb b/lib/hamlit/parser.rb
index 6f5643c..6073e7c 100644
--- a/lib/hamlit/parser.rb
+++ b/lib/hamlit/parser.rb
@@ -20,6 +20,7 @@ module Hamlit
autoclose
escape_html
escape_attrs
+ check_syntax
].freeze
def initialize(options = {})
@@ -35,6 +36,7 @@ module Hamlit
end
HamlParser.new(HamlOptions.new(@options)).call(template)
rescue ::Hamlit::HamlError => e
+ raise e if @options[:check_syntax]
error_with_lineno(e)
end
diff --git a/lib/hamlit/rails_template.rb b/lib/hamlit/rails_template.rb
index 2d1a384..da6fb6f 100644
--- a/lib/hamlit/rails_template.rb
+++ b/lib/hamlit/rails_template.rb
@@ -15,6 +15,7 @@ module Hamlit
use_html_safe: true,
streaming: true,
buffer_class: 'ActionView::OutputBuffer',
+ disable_capture: true,
}
end
@@ -34,8 +35,10 @@ module Hamlit
end
if ActionView::Base.try(:annotate_rendered_view_with_filenames) && template.format == :html
- options[:preamble] = "<!-- BEGIN #{template.short_identifier} -->\n"
- options[:postamble] = "<!-- END #{template.short_identifier} -->\n"
+ options = options.merge(
+ preamble: "<!-- BEGIN #{template.short_identifier} -->\n",
+ postamble: "<!-- END #{template.short_identifier} -->\n",
+ )
end
Engine.new(options).call(source)
diff --git a/lib/hamlit/version.rb b/lib/hamlit/version.rb
index 8543b94..0d0a5a9 100644
--- a/lib/hamlit/version.rb
+++ b/lib/hamlit/version.rb
@@ -1,4 +1,4 @@
# frozen_string_literal: true
module Hamlit
- VERSION = '2.15.1'
+ VERSION = '3.0.3'
end
diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb
index 83d80e9..c591f9c 100644
--- a/test/haml/engine_test.rb
+++ b/test/haml/engine_test.rb
@@ -1402,13 +1402,13 @@ HAML
assert_nil(scope.send(:haml_buffer))
end
- def test_render_proc_should_raise_haml_syntax_error_not_ruby_syntax_error
+ def test_render_proc_should_raise_haml_syntax_error_not_ruby_syntax_error; skip # Haml::Engine test
assert_raises(Haml::SyntaxError) do
Haml::Engine.new("%p{:foo => !}").render_proc(Object.new, :foo).call
end
end
- def test_render_should_raise_haml_syntax_error_not_ruby_syntax_error
+ def test_render_should_raise_haml_syntax_error_not_ruby_syntax_error; skip # Haml::Engine test
assert_raises(Haml::SyntaxError) do
Haml::Engine.new("%p{:foo => !}").render
end
@@ -1475,7 +1475,7 @@ HAML
assert_haml_ugly('%a{:b => "a #@foo b"}', :scope => scope)
end
- def test_interpolates_global_vars_in_attribute_values
+ def test_interpolates_global_vars_in_attribute_values; skip # Haml::Engine test
# make sure the value isn't just interpolated in during template compilation
engine = Haml::Engine.new('%a{:b => "a #$global_var_for_testing b"}')
$global_var_for_testing = 'bar'
@@ -2085,7 +2085,7 @@ HTML
HAML
end
- def assert_converts_template_properly
+ def assert_converts_template_properly; skip # Haml::Engine test
engine = Haml::Engine.new(<<HAML.encode("iso-8859-1"), :encoding => "macRoman")
%p bâr
%p föö
diff --git a/test/haml/haml-spec/ugly_test.rb b/test/haml/haml-spec/ugly_test.rb
index 6eccfe8..3e52c01 100644
--- a/test/haml/haml-spec/ugly_test.rb
+++ b/test/haml/haml-spec/ugly_test.rb
@@ -11,7 +11,11 @@ class UglyTest < MiniTest::Test
HAMLIT_DEFAULT_OPTIONS = { escape_html: true }.freeze
def self.haml_result(haml, options, locals)
- Haml::Engine.new(haml, HAML_DEFAULT_OPTIONS.merge(options)).render(Object.new, locals)
+ if Gem::Version.new(Haml::VERSION) >= Gem::Version.new('6.0.0')
+ Haml::Template.new(HAML_DEFAULT_OPTIONS.merge(options)) { haml }.render(Object.new, locals)
+ else
+ Haml::Engine.new(haml, HAML_DEFAULT_OPTIONS.merge(options)).render(Object.new, locals)
+ end
end
def self.hamlit_result(haml, options, locals)
diff --git a/test/haml/helper_test.rb b/test/haml/helper_test.rb
index 5c9e412..4abbf83 100644
--- a/test/haml/helper_test.rb
+++ b/test/haml/helper_test.rb
@@ -70,7 +70,7 @@ HAML
assert_equal("<>&\n", render(haml, :action_view))
end
- def test_flatten
+ def test_flatten; skip # Haml::Helpers test
assert_equal("FooBar", Haml::Helpers.flatten("FooBar"))
assert_equal("FooBar", Haml::Helpers.flatten("Foo\rBar"))
@@ -529,7 +529,7 @@ HAML
render("= preserve do\n %pre\n Foo\n Bar\n Foo\n Bar"))
end
- def test_init_haml_helpers
+ def test_init_haml_helpers; skip # Haml::Helpers test
context = Object.new
class << context
include Haml::Helpers
@@ -609,11 +609,11 @@ HAML
HAML
end
- def test_html_escape
+ def test_html_escape; skip # Haml::Helpers test
assert_equal ""><&", Haml::Helpers.html_escape('"><&')
end
- def test_html_escape_should_work_on_frozen_strings
+ def test_html_escape_should_work_on_frozen_strings; skip # Haml::Helpers test
begin
assert Haml::Helpers.html_escape('foo'.freeze)
rescue => e
@@ -621,13 +621,13 @@ HAML
end
end
- def test_html_escape_encoding
+ def test_html_escape_encoding; skip # Haml::Helpers test
old_stderr, $stderr = $stderr, StringIO.new
string = "\"><&\u00e9" # if you're curious, u00e9 is "LATIN SMALL LETTER E WITH ACUTE"
assert_equal ""><&\u00e9", Haml::Helpers.html_escape(string)
assert $stderr.string == "", "html_escape shouldn't generate warnings with UTF-8 strings: #{$stderr.string}"
- ensure
- $stderr = old_stderr
+ #ensure
+ # $stderr = old_stderr
end
def test_html_escape_non_string; skip
@@ -635,11 +635,11 @@ HAML
assert_equal('4.58', Haml::Helpers.html_escape_without_haml_xss(4.58))
end
- def test_escape_once
+ def test_escape_once; skip # Haml::Helpers test
assert_equal ""><&", Haml::Helpers.escape_once('"><&')
end
- def test_escape_once_leaves_entity_references
+ def test_escape_once_leaves_entity_references; skip # Haml::Helpers test
assert_equal ""><& ", Haml::Helpers.escape_once('"><& ')
end
@@ -648,13 +648,13 @@ HAML
assert_equal ""><&  ", Haml::Helpers.escape_once('"><&  ') #hexadecimal
end
- def test_escape_once_encoding
+ def test_escape_once_encoding; skip # Haml::Helpers test
old_stderr, $stderr = $stderr, StringIO.new
string = "\"><&\u00e9 "
assert_equal ""><&\u00e9 ", Haml::Helpers.escape_once(string)
assert $stderr.string == "", "html_escape shouldn't generate warnings with UTF-8 strings: #{$stderr.string}"
- ensure
- $stderr = old_stderr
+ #ensure
+ # $stderr = old_stderr
end
def test_html_attrs_xhtml; skip
@@ -687,7 +687,7 @@ HAML
render("%html{html_attrs('es-AR')}", :format => :html5))
end
- def test_escape_once_should_work_on_frozen_strings
+ def test_escape_once_should_work_on_frozen_strings; skip # Haml::Helpers test
begin
Haml::Helpers.escape_once('foo'.freeze)
rescue => e
diff --git a/test/haml/template_test.rb b/test/haml/template_test.rb
index 50b0a97..15756a3 100644
--- a/test/haml/template_test.rb
+++ b/test/haml/template_test.rb
@@ -4,14 +4,6 @@ require 'haml/mocks/article'
require 'action_pack/version'
require 'hamlit/rails_template'
-module Haml::Filters::Test
- include Haml::Filters::Base
-
- def render(text)
- "TESTING HAHAHAHA!"
- end
-end
-
module Hamlit::RailsHelpers
def test_partial(name, locals = {})
Hamlit::Template.new { File.read(File.join(TemplateTest::TEMPLATE_PATH, "_#{name}.haml")) }.render(self, locals)
@@ -98,8 +90,7 @@ class TemplateTest < Haml::TestCase
end
def assert_renders_correctly(name, &render_method)
- old_options = Haml::Template.options.dup
- Haml::Template.options[:escape_html] = false
+ Haml::Template.options[:escape_html], old_escape_html = false, Haml::Template.options[:escape_html]
render_method ||= proc { |n| @base.render(template: n) }
silence_warnings do
@@ -115,7 +106,7 @@ class TemplateTest < Haml::TestCase
raise e
end
ensure
- Haml::Template.options = old_options
+ Haml::Template.options[:escape_html] = old_escape_html
end
def test_empty_render_should_remain_empty
@@ -315,7 +306,7 @@ HAML
assert(render("Foo", :action_view).html_safe?)
end
- def test_xss_html_escaping_with_non_strings
+ def test_xss_html_escaping_with_non_strings; skip # no such helper
assert_haml_ugly("= html_escape(4)")
end
diff --git a/test/hamlit/engine/script_test.rb b/test/hamlit/engine/script_test.rb
index eda58a0..50b796d 100644
--- a/test/hamlit/engine/script_test.rb
+++ b/test/hamlit/engine/script_test.rb
@@ -58,7 +58,7 @@ describe Hamlit::Engine do
end
it 'renders block script' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
+ assert_render(<<-HTML.unindent, <<-HAML.unindent, disable_capture: true)
0
1
2
@@ -71,7 +71,7 @@ describe Hamlit::Engine do
end
it 'renders tag internal block script' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
+ assert_render(<<-HTML.unindent, <<-HAML.unindent, disable_capture: true)
<span>
0
1</span>
@@ -133,10 +133,12 @@ describe Hamlit::Engine do
end
it 'renders comment-only nested script' do
- assert_render('1', <<-HAML.unindent)
- = 1.times do # comment
- - # comment only
- HAML
+ [false, true].each do |disable_capture|
+ assert_render('1', <<-HAML.unindent, disable_capture: false)
+ = 1.times do # comment
+ - # comment only
+ HAML
+ end
end
it 'renders inline script with comment' do
diff --git a/test/hamlit/engine/whitespace_test.rb b/test/hamlit/engine/whitespace_test.rb
index 20ebd00..cbc0bf2 100644
--- a/test/hamlit/engine/whitespace_test.rb
+++ b/test/hamlit/engine/whitespace_test.rb
@@ -41,7 +41,7 @@ describe Hamlit::Engine do
end
it 'removes whitespaces inside block script' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
+ assert_render(<<-HTML.unindent, <<-HAML.unindent, disable_capture: true)
<span>foofoo2<span>bar</span></span>
HTML
%span<
@@ -62,7 +62,7 @@ describe Hamlit::Engine do
end
it 'removes whitespace inside script recursively' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
+ assert_render(<<-HTML.unindent, <<-HAML.unindent, disable_capture: true)
<div class='foo'>bar1bar1bar1bar12</div>
HTML
.foo<
@@ -104,7 +104,7 @@ describe Hamlit::Engine do
end
it 'does not nuke inside script' do
- assert_render(%Q|<div><span>\nhello\n</span>1</div>|, <<-HAML.unindent)
+ assert_render(%Q|<div><span>\nhello\n</span>1</div>|, <<-HAML.unindent, disable_capture: true)
%div><
= 1.times do
%span>
diff --git a/test/hamlit/filters/coffee_test.rb b/test/hamlit/filters/coffee_test.rb
deleted file mode 100644
index d4dbb5c..0000000
--- a/test/hamlit/filters/coffee_test.rb
+++ /dev/null
@@ -1,62 +0,0 @@
-describe Hamlit::Filters do
- include RenderHelper
-
- describe '#compile' do
- it 'renders coffee filter' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
- <script>
- (function() {
- var foo;
-
- foo = function() {
- return alert('hello');
- };
-
- }).call(this);
- </script>
- HTML
- :coffee
- foo = ->
- alert('hello')
- HAML
- end
-
- it 'renders coffeescript filter' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
- <script>
- (function() {
- var foo;
-
- foo = function() {
- return alert('hello');
- };
-
- }).call(this);
- </script>
- HTML
- :coffeescript
- foo = ->
- alert('hello')
- HAML
- end
-
- it 'renders coffeescript filter' do
- assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
- <script>
- (function() {
- var foo;
-
- foo = function() {
- return alert("<&>");
- };
-
- }).call(this);
- </script>
- HTML
- :coffee
- foo = ->
- alert("#{'<&>'}")
- HAML
- end
- end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
-end
diff --git a/test/hamlit/line_number_test.rb b/test/hamlit/line_number_test.rb
index 6c737b0..2805ca6 100644
--- a/test/hamlit/line_number_test.rb
+++ b/test/hamlit/line_number_test.rb
@@ -25,7 +25,7 @@ describe Hamlit::Engine do
end
it 'renders dynamic script with children' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
+ assert_render(<<-HTML.unindent, <<-HAML.unindent, disable_capture: true)
1
3
3
@@ -105,50 +105,6 @@ describe Hamlit::Engine do
end
describe 'filters' do
- describe 'coffee filter' do
- it 'renders static filter' do
- assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
- <script>
- (function() {
- jQuery(function($) {
- console.log('3');
- return console.log('4');
- });
-
- }).call(this);
- </script>
- 5
- HTML
- :coffee
- jQuery ($) ->
- console.log('#{__LINE__}')
- console.log('#{__LINE__}')
- = __LINE__
- HAML
- end
-
- it 'renders dynamic filter' do
- assert_render(<<-HTML.unindent, <<-HAML.unindent)
- <script>
- (function() {
- jQuery(function($) {
- console.log('3');
- return console.log('4');
- });
-
- }).call(this);
- </script>
- 5
- HTML
- :coffee
- jQuery ($) ->
- console.log('3')
- console.log('4')
- = __LINE__
- HAML
- end
- end unless /java/ === RUBY_PLATFORM # execjs is not working with Travis JRuby environment
-
describe 'css filter' do
it 'renders static filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
diff --git a/test/hamlit/template_test.rb b/test/hamlit/template_test.rb
index fc7a715..2c4dba5 100644
--- a/test/hamlit/template_test.rb
+++ b/test/hamlit/template_test.rb
@@ -42,4 +42,22 @@ describe Hamlit::Template do
assert_equal %Q|<script>\n|, result
end
end
+
+ describe 'disable_capture' do
+ it 'captures a block content' do
+ object = Object.new
+ def object.render(&block)
+ block.call
+ end
+ result = compile_template(:haml, <<-'HAML'.unindent, escape_html: false, disable_capture: false).render(object, {})
+ %h1 out
+ = render do
+ %h2 in
+ HAML
+ assert_equal <<-'HTML'.unindent, result
+ <h1>out</h1>
+ <h2>in</h2>
+ HTML
+ end
+ end
end
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 6c058fc..c311e3e 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -37,7 +37,11 @@ module RenderHelper
options = options.dup
locals = options.delete(:locals) || {}
haml_options = { escape_html: true, escape_attrs: true }
- Haml::Engine.new(haml, haml_options.merge(options)).render(Object.new, locals)
+ if Gem::Version.new(Haml::VERSION) >= Gem::Version.new('6.0.0')
+ Haml::Template.new(haml_options.merge(options)) { haml }.render(Object.new, locals)
+ else
+ Haml::Engine.new(haml, haml_options.merge(options)).render(Object.new, locals)
+ end
end
def render_hamlit(haml, options = {})
@@ -74,7 +78,11 @@ class Haml::TestCase < BASE_TEST_CLASS
hamlit_base = { escape_html: true }
scope = options.delete(:scope) || Object.new
locals = options.delete(:locals) || {}
- haml_result = Haml::Engine.new(text, haml_base.merge(options)).render(scope, locals)
+ if Gem::Version.new(Haml::VERSION) >= Gem::Version.new('6.0.0')
+ haml_result = Haml::Template.new(haml_base.merge(options)) { text }.render(scope, locals)
+ else
+ haml_result = Haml::Engine.new(text, haml_base.merge(options)).render(scope, locals)
+ end
hamlit_result = Hamlit::Template.new(hamlit_base.merge(options)) { text }.render(scope, locals)
assert_equal haml_result, hamlit_result
end
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/rubygems-integration/3.1.0/specifications/hamlit-3.0.3.gemspec
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/rubygems-integration/3.1.0/specifications/hamlit-2.15.1.gemspec
No differences were encountered between the control files of package ruby-hamlit
No differences were encountered between the control files of package ruby-hamlit-dbgsym