hamlit 2.9.3-java → 2.9.4-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: 3e1e0c271eecd840955b48024730974c85264eb16b328f3ccc222a47fe2b7d03
4
- data.tar.gz: 718a2b49969520a6f88d45738f5b9fb7dde784d0006bf55486ce1c945c9f7161
3
+ metadata.gz: 9c44c5a360e172c2bcc8383952fd5c8b03fb287c818b0b0d5394862f0b55b659
4
+ data.tar.gz: 95d39c6eb8060801ddeb0f8ae61ada9d3755b4ac0750725c468d70ddf29aa5c4
5
5
  SHA512:
6
- metadata.gz: e05ccb9a490cde81d65ea4e87f5b0cfc951b63f25c9d7fd3e73ea2878e1e72ccfe7811f501c0bcc4a08b2a5b1727d18d9ce4ecfd823f859e20586670d70dc878
7
- data.tar.gz: 120f5a4b739f309bdb905c5d9a84722bca70fe0ab619321e0a1c2c0b24c1385a927dfb4629f44b4c199d90af1258fc0c7f891985081a7a7e0b1d607475fc3538
6
+ metadata.gz: a530cade0a6cf8110c4f4f213094ee4712559744cd5eeb8c0c5a81daf5c696bc3f147f91cfc07260304ce4b2c00203cb59fa0fdb1fd7d7bd2a4130a9e06f39cd
7
+ data.tar.gz: f5b1f560f7bffec014ff5e2217ec5a5502743c09352f362c3de551ae390baf775a342e9395a892dcac7bda969acda68230fcb6f64aac46c107e9ab860dbeaf1d
data/.travis.yml CHANGED
@@ -17,7 +17,9 @@ matrix:
17
17
  env: TASK=test
18
18
  - rvm: ruby-head
19
19
  env: TASK=test
20
- - rvm: jruby-9.1.9.0
20
+ - rvm: jruby-9.2.8.0
21
+ env: TASK=test
22
+ - rvm: truffleruby
21
23
  env: TASK=test
22
24
  - rvm: 2.6.0
23
25
  env: TASK=bench TEMPLATE=benchmark/boolean_attribute.haml,benchmark/class_attribute.haml,benchmark/id_attribute.haml,benchmark/data_attribute.haml,benchmark/common_attribute.haml
data/CHANGELOG.md CHANGED
@@ -4,18 +4,30 @@ 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.9.4](https://github.com/k0kubun/hamlit/compare/v2.9.3...v2.9.4) - 2019-09-08
8
+
9
+ ### Added
10
+
11
+ - Experimental support of truffleruby [#145](https://github.com/k0kubun/hamlit/issues/145).
12
+
7
13
  ## [2.9.3](https://github.com/k0kubun/hamlit/compare/v2.9.2...v2.9.3) - 2019-04-09
8
14
 
15
+ ### Fixed
16
+
9
17
  - Fix deprecation warning on Rails 6 [#138](https://github.com/k0kubun/hamlit/issues/138).
10
18
  *Thanks to @r7kamura*
11
19
 
12
20
  ## [2.9.2](https://github.com/k0kubun/hamlit/compare/v2.9.1...v2.9.2) - 2018-11-30
13
21
 
22
+ ### Fixed
23
+
14
24
  - Fix possible `autoload` failure of dependency [#131](https://github.com/k0kubun/hamlit/issues/131).
15
25
  *Thanks to @wimrijnders*
16
26
 
17
27
  ## [2.9.1](https://github.com/k0kubun/hamlit/compare/v2.9.0...v2.9.1) - 2018-11-01
18
28
 
29
+ ### Added
30
+
19
31
  - Start supporting JRuby [#100](https://github.com/k0kubun/hamlit/issues/100).
20
32
 
21
33
  ## [2.9.0](https://github.com/k0kubun/hamlit/compare/v2.8.10...v2.9.0) - 2018-10-16
data/Gemfile CHANGED
@@ -19,10 +19,12 @@ if /java/ === RUBY_PLATFORM # JRuby
19
19
  gem 'pandoc-ruby'
20
20
  else
21
21
  gem 'pry-byebug'
22
- gem 'redcarpet', github: 'vmg/redcarpet' # To resolve circular require warning
22
+ gem 'redcarpet'
23
23
 
24
- if RUBY_PLATFORM !~ /mswin|mingw/
25
- gem 'faml'
24
+ if RUBY_PLATFORM !~ /mswin|mingw/ && RUBY_ENGINE != 'truffleruby'
25
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.7.0') # Travis cannot compile ruby.h with C++
26
+ gem 'faml'
27
+ end
26
28
  gem 'stackprof'
27
29
  end
28
30
  end
data/REFERENCE.md CHANGED
@@ -99,6 +99,9 @@ Hamlit does not remove non-boolean attributes and render `<a foo=''></a>`
99
99
  (`foo` is not removed). This design allows us to reduce string concatenation and
100
100
  is the only difference between Faml and Hamlit.
101
101
 
102
+ You may be also interested in
103
+ [hamlit/hamlit-boolean\_attributes](https://github.com/hamlit/hamlit-boolean_attributes).
104
+
102
105
  ## 5 Types of Attributes
103
106
 
104
107
  Haml has 3 types of attributes: id, class and others.
@@ -181,7 +184,10 @@ defer reversed ismap seamless muted required autofocus novalidate formnovalidate
181
184
  itemscope allowfullscreen default inert sortable truespeed typemustmatch
182
185
  ```
183
186
 
184
- "data-\*" is also regarded as boolean.
187
+ If you want to customize the list of boolean attributes, you can use
188
+ [hamlit/hamlit-boolean\_attributes](https://github.com/hamlit/hamlit-boolean_attributes).
189
+
190
+ "aria-\*" and "data-\*" are also regarded as boolean.
185
191
 
186
192
  ### other attributes
187
193
  No hyphenation and boolean support. `false` is rendered as "false" (like Rails helpers).
data/ext/hamlit/hamlit.c CHANGED
@@ -1,5 +1,6 @@
1
1
  #include <ruby.h>
2
2
  #include <ruby/encoding.h>
3
+ #ifndef TRUFFLERUBY
3
4
  #include "hescape.h"
4
5
  #include "string.h"
5
6
 
@@ -551,3 +552,4 @@ Init_hamlit(void)
551
552
  rb_const_set(mAttributeBuilder, id_space, rb_obj_freeze(rb_str_new_cstr(" ")));
552
553
  rb_const_set(mAttributeBuilder, id_underscore, rb_obj_freeze(rb_str_new_cstr("_")));
553
554
  }
555
+ #endif
data/hamlit.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'less'
38
38
  spec.add_development_dependency 'minitest-reporters', '~> 1.1'
39
39
  spec.add_development_dependency 'rails', '>= 4.0.0'
40
- spec.add_development_dependency 'rake', '~> 10.0'
40
+ spec.add_development_dependency 'rake'
41
41
  spec.add_development_dependency 'rake-compiler'
42
42
  spec.add_development_dependency 'sass'
43
43
  spec.add_development_dependency 'slim'
@@ -9,7 +9,9 @@ module Hamlit::AttributeBuilder
9
9
  itemscope allowfullscreen default inert sortable
10
10
  truespeed typemustmatch download].freeze
11
11
 
12
- if /java/ === RUBY_PLATFORM # JRuby
12
+ # Java extension is not implemented for JRuby yet.
13
+ # TruffleRuby does not implement `rb_ary_sort_bang`, etc.
14
+ if /java/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
13
15
  class << self
14
16
  def build(escape_attrs, quote, format, object_ref, *hashes)
15
17
  hashes << Hamlit::ObjectRef.parse(object_ref) if object_ref
@@ -14,7 +14,9 @@ module Hamlit
14
14
 
15
15
  def compile(node)
16
16
  hashes = []
17
- return runtime_compile(node) if node.value[:object_ref] != :nil
17
+ if node.value[:object_ref] != :nil || !Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
18
+ return runtime_compile(node)
19
+ end
18
20
  node.value[:attributes_hashes].each do |attribute_str|
19
21
  hash = AttributeParser.parse(attribute_str)
20
22
  return runtime_compile(node) unless hash
@@ -11,6 +11,10 @@ module Hamlit
11
11
  end
12
12
 
13
13
  def compile(node, &block)
14
+ unless Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
15
+ return dynamic_compile(node, &block)
16
+ end
17
+
14
18
  no_children = node.children.empty?
15
19
  case
16
20
  when no_children && node.value[:escape_interpolation]
@@ -28,8 +28,10 @@ module Hamlit
28
28
  nil
29
29
  when node.value[:parse]
30
30
  return compile_interpolated_plain(node) if node.value[:escape_interpolation]
31
- return delegate_optimization(node) if RubyExpression.string_literal?(node.value[:value])
32
- return delegate_optimization(node) if Temple::StaticAnalyzer.static?(node.value[:value])
31
+ if Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
32
+ return delegate_optimization(node) if RubyExpression.string_literal?(node.value[:value])
33
+ return delegate_optimization(node) if Temple::StaticAnalyzer.static?(node.value[:value])
34
+ end
33
35
 
34
36
  var = @identity.generate
35
37
  [:multi,
@@ -53,6 +55,10 @@ module Hamlit
53
55
 
54
56
  # We should handle interpolation here to escape only interpolated values.
55
57
  def compile_interpolated_plain(node)
58
+ unless Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
59
+ return [:multi, [:escape, node.value[:escape_interpolation], [:dynamic, "%Q[#{node.value[:value]}]"]], [:newline]]
60
+ end
61
+
56
62
  temple = [:multi]
57
63
  StringSplitter.compile(node.value[:value]).each do |type, value|
58
64
  case type
data/lib/hamlit/engine.rb CHANGED
@@ -25,8 +25,10 @@ module Hamlit
25
25
  use Parser
26
26
  use Compiler
27
27
  use HTML
28
- use StringSplitter
29
- filter :StaticAnalyzer
28
+ if Ripper.respond_to?(:lex) # No Ripper.lex in truffleruby
29
+ use StringSplitter
30
+ filter :StaticAnalyzer
31
+ end
30
32
  use Escapable
31
33
  use ForceEscapable
32
34
  filter :ControlFlow
@@ -5,6 +5,9 @@ module Hamlit
5
5
  class Filters
6
6
  class Plain < Base
7
7
  def compile(node)
8
+ unless Ripper.respond_to?(:lex)
9
+ raise NotImplementedError.new('This platform does not have Ripper.lex required for :plain filter')
10
+ end
8
11
  text = node.value[:text]
9
12
  text = text.rstrip unless ::Hamlit::HamlUtil.contains_interpolation?(text) # for compatibility
10
13
  [:multi, *compile_plain(text)]
Binary file
data/lib/hamlit/utils.rb CHANGED
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
3
  module Utils
4
- if /java/ === RUBY_PLATFORM # JRuby
4
+ # Java extension is not implemented for JRuby yet.
5
+ # TruffleRuby does not implement `rb_ary_sort_bang`, etc.
6
+ if /java/ === RUBY_PLATFORM || RUBY_ENGINE == 'truffleruby'
5
7
  require 'cgi/escape'
6
8
 
7
9
  def self.escape_html(html)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hamlit
3
- VERSION = '2.9.3'
3
+ VERSION = '2.9.4'
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.9.3
4
+ version: 2.9.4
5
5
  platform: java
6
6
  authors:
7
7
  - Takashi Kokubun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-04-09 00:00:00.000000000 Z
11
+ date: 2019-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -153,17 +153,17 @@ dependencies:
153
153
  - !ruby/object:Gem::Dependency
154
154
  requirement: !ruby/object:Gem::Requirement
155
155
  requirements:
156
- - - "~>"
156
+ - - ">="
157
157
  - !ruby/object:Gem::Version
158
- version: '10.0'
158
+ version: '0'
159
159
  name: rake
160
160
  prerelease: false
161
161
  type: :development
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
- - - "~>"
164
+ - - ">="
165
165
  - !ruby/object:Gem::Version
166
- version: '10.0'
166
+ version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
168
  requirement: !ruby/object:Gem::Requirement
169
169
  requirements:
@@ -310,6 +310,7 @@ files:
310
310
  - lib/hamlit/filters/text_base.rb
311
311
  - lib/hamlit/filters/tilt_base.rb
312
312
  - lib/hamlit/force_escapable.rb
313
+ - lib/hamlit/hamlit.su
313
314
  - lib/hamlit/helpers.rb
314
315
  - lib/hamlit/html.rb
315
316
  - lib/hamlit/identity.rb
@@ -353,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
353
354
  version: '0'
354
355
  requirements: []
355
356
  rubyforge_project:
356
- rubygems_version: 2.7.6
357
+ rubygems_version: 2.7.9
357
358
  signing_key:
358
359
  specification_version: 4
359
360
  summary: High Performance Haml Implementation