html2haml 2.1.0 → 2.3.0

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
- SHA1:
3
- metadata.gz: 4ea4fc47f04129ec7319391ff8d7b37540b63916
4
- data.tar.gz: 41d533c8b9145b86c6a826544a03defb22188ad1
2
+ SHA256:
3
+ metadata.gz: 2dcfae96b25443e16ee6148e085a6e544ef7ed31a71ab6842e91adf7a1c8b8dd
4
+ data.tar.gz: bb855c6b054a108c847ede14bd5bf17a723908ef8ac74b5c2daf9ab1fe231313
5
5
  SHA512:
6
- metadata.gz: 14ff09f53248de46f29ebe2c570c82478b4f6b384bf055a84130ce6a409eb3c6fcf8e18ee833d4167cb33c4d2feb5f9ea2141b3eba022ca278647a822dd5fadf
7
- data.tar.gz: 817b603e6331163c738fb4076a67aa7d85d1adf4fbe2fa525a75a69a025813c6dc2862aff0c8d25b1cd8be88dc77e13482fdefcb04c449e84cabb50eacd107ed
6
+ metadata.gz: 94d0f1ed89b8321a9d3eaa6bf899d18b8cb840980b6c63aec9c72b9ed211f40e435f05080fe5497061bb34eae69804ab60c47395bb68b3db70405cb53d5798f3
7
+ data.tar.gz: 23477a707ca4f07c5f25fc71dcd2572c08622fb2b7a539fc29e561244a98050d67f839e10f07a57234eaaf41de22b8585a68b526b92b02633c7a5908ac8dc462
@@ -0,0 +1,38 @@
1
+ name: test
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-18.04
8
+ strategy:
9
+ fail-fast: false
10
+
11
+ matrix:
12
+ ruby-version:
13
+ - '1.9'
14
+ - '2.0'
15
+ - '2.1'
16
+ - '2.2'
17
+ - '2.3'
18
+ - '2.4'
19
+ - '2.5'
20
+ - '2.6'
21
+ - '2.7'
22
+ - '3.0'
23
+ - '3.1'
24
+ - ruby-head
25
+ - jruby
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+
30
+ - uses: ruby/setup-ruby@v1
31
+ with:
32
+ ruby-version: ${{ matrix.ruby-version }}
33
+ bundler-cache: true
34
+ continue-on-error: ${{ matrix.ruby-version == 'ruby-head' }}
35
+
36
+ - run: |
37
+ bundle exec rake
38
+ continue-on-error: ${{ (matrix.ruby-version == 'ruby-head') || (matrix.ruby-version == 'jruby') }}
data/Changelog.markdown CHANGED
@@ -1,5 +1,15 @@
1
1
  # HTML2Haml Changelog
2
2
 
3
+ ## 2.3.0
4
+
5
+ * Haml 6+ support.
6
+
7
+ * Fixed a bug that embedded ruby code was not parsed with the current version of ruby.
8
+
9
+ ## 2.2.0
10
+
11
+ * Haml 5 support.
12
+
3
13
  ## 2.1.0
4
14
 
5
15
  * Reduce specificity of Haml 4.0 version dependency.
data/Gemfile CHANGED
@@ -3,3 +3,13 @@ source 'https://rubygems.org'
3
3
  gemspec
4
4
 
5
5
  gem 'nokogiri', RUBY_VERSION < '2.1' ? '~> 1.6.0' : '>= 1.7'
6
+
7
+ if RUBY_VERSION < '2.1'
8
+ gem 'ruby_parser', '< 3.14'
9
+ elsif RUBY_VERSION < '2.3'
10
+ gem 'ruby_parser', '< 3.18'
11
+ else
12
+ gem 'ruby_parser', '>= 3.18'
13
+ end
14
+
15
+ gem 'sexp_processor', RUBY_VERSION < '2.1' ? '< 4.14.0' : '> 4.14.0'
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Html2haml
2
2
 
3
- [![Build Status](https://travis-ci.org/haml/html2haml.svg?branch=master)](https://travis-ci.org/haml/html2haml)
3
+ [![Build Status](https://github.com/haml/html2haml/workflows/test/badge.svg)](https://github.com/haml/html2haml/actions)
4
4
  [![Code Climate](https://codeclimate.com/github/haml/html2haml.svg)](https://codeclimate.com/github/haml/html2haml)
5
5
  [![Gem Version](https://badge.fury.io/rb/html2haml.svg)](https://rubygems.org/gems/html2haml)
6
6
 
@@ -57,8 +57,8 @@ See `html2haml --help`:
57
57
  Description: Transforms an HTML file into corresponding Haml code.
58
58
 
59
59
  Options:
60
- -e, --erb Parse ERb tags.
61
- --no-erb Don't parse ERb tags.
60
+ -e, --erb Parse ERB tags.
61
+ --no-erb Don't parse ERB tags.
62
62
  --html-attributes Use HTML style attributes instead of Ruby hash style.
63
63
  --ruby19-attributes Use Ruby 1.9-style attributes when possible.
64
64
  -E ex[:in] Specify the default external and internal character encodings.
data/html2haml.gemspec CHANGED
@@ -2,8 +2,8 @@
2
2
  require File.expand_path('../lib/html2haml/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
- gem.authors = ["Norman Clarke", "Stefan Natchev"]
6
- gem.email = ["norman@njclarke.com", "stefan.natchev@gmail.com"]
5
+ gem.authors = ["Akira Matsuda", "Stefan Natchev"]
6
+ gem.email = ["ronnie@dio.jp", "stefan.natchev@gmail.com"]
7
7
  gem.description = %q{Converts HTML into Haml}
8
8
  gem.summary = %q{Converts HTML into Haml}
9
9
  gem.homepage = "http://haml.info"
@@ -21,8 +21,8 @@ Gem::Specification.new do |gem|
21
21
  gem.add_dependency 'nokogiri', '>= 1.6.0'
22
22
  gem.add_dependency 'erubis', '~> 2.7.0'
23
23
  gem.add_dependency 'ruby_parser', '~> 3.5'
24
- gem.add_dependency 'haml', '~> 4.0'
24
+ gem.add_dependency 'haml', '>= 4.0'
25
25
  gem.add_development_dependency 'simplecov', '~> 0.7.1'
26
- gem.add_development_dependency 'minitest', '~> 4.4.0'
26
+ gem.add_development_dependency 'minitest', '>= 4.4.0'
27
27
  gem.add_development_dependency 'rake'
28
28
  end
@@ -203,11 +203,11 @@ Description: Transforms an HTML file into corresponding Haml code.
203
203
  Options:
204
204
  END
205
205
 
206
- opts.on('-e', '--erb', 'Parse ERb tags.') do
206
+ opts.on('-e', '--erb', 'Parse ERB tags.') do
207
207
  @module_opts[:erb] = true
208
208
  end
209
209
 
210
- opts.on('--no-erb', "Don't parse ERb tags.") do
210
+ opts.on('--no-erb', "Don't parse ERB tags.") do
211
211
  @options[:no_erb] = true
212
212
  end
213
213
 
@@ -98,7 +98,7 @@ module Html2haml
98
98
  # @param code [String] Ruby code to check
99
99
  # @return [Boolean]
100
100
  def valid_ruby?(code)
101
- RubyParser.new.parse(code)
101
+ RubyParser.for_current_ruby.parse(code)
102
102
  rescue Racc::ParseError, RubyParser::SyntaxError
103
103
  false
104
104
  end
@@ -439,18 +439,17 @@ module Html2haml
439
439
 
440
440
  def attribute_value_can_be_bare_ruby?(value)
441
441
  begin
442
- ruby = RubyParser.new.parse(value)
442
+ ruby = RubyParser.for_current_ruby.parse(value)
443
443
  rescue Racc::ParseError, RubyParser::SyntaxError
444
444
  return false
445
445
  end
446
446
 
447
447
  return false if ruby.nil?
448
- return true if ruby.sexp_type == :str #regular string
449
- return true if ruby.sexp_type == :dstr #string with interpolation
450
- return true if ruby.sexp_type == :lit #symbol
451
- return true if ruby.sexp_type == :call && ruby.mass == 1 #local var or method with no params
452
448
 
453
- false
449
+ (ruby.sexp_type == :str) || #regular string
450
+ (ruby.sexp_type == :dstr) || #string with interpolation
451
+ (ruby.sexp_type == :lit) || #symbol
452
+ (ruby.sexp_type == :call && ruby.mass == 1) #local var or method with no params
454
453
  end
455
454
 
456
455
 
@@ -1,3 +1,3 @@
1
1
  module Html2haml
2
- VERSION = "2.1.0"
2
+ VERSION = "2.3.0"
3
3
  end
data/test/erb_test.rb CHANGED
@@ -531,7 +531,7 @@ ERB
531
531
  end
532
532
 
533
533
  #https://github.com/haml/html2haml/issues/43
534
- def test_escaped_ruby_call_when_preceeded_by_text
534
+ def test_escaped_ruby_call_when_preceded_by_text
535
535
  assert_equal(<<HAML.rstrip, render_erb(<<ERB))
536
536
  random text
537
537
  = form_tag(url: sessions_path) do
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html2haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
- - Norman Clarke
7
+ - Akira Matsuda
8
8
  - Stefan Natchev
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-25 00:00:00.000000000 Z
12
+ date: 2022-10-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -57,14 +57,14 @@ dependencies:
57
57
  name: haml
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '4.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '4.0'
70
70
  - !ruby/object:Gem::Dependency
@@ -85,14 +85,14 @@ dependencies:
85
85
  name: minitest
86
86
  requirement: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - ">="
89
89
  - !ruby/object:Gem::Version
90
90
  version: 4.4.0
91
91
  type: :development
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
- - - "~>"
95
+ - - ">="
96
96
  - !ruby/object:Gem::Version
97
97
  version: 4.4.0
98
98
  - !ruby/object:Gem::Dependency
@@ -111,15 +111,15 @@ dependencies:
111
111
  version: '0'
112
112
  description: Converts HTML into Haml
113
113
  email:
114
- - norman@njclarke.com
114
+ - ronnie@dio.jp
115
115
  - stefan.natchev@gmail.com
116
116
  executables:
117
117
  - html2haml
118
118
  extensions: []
119
119
  extra_rdoc_files: []
120
120
  files:
121
+ - ".github/workflows/main.yml"
121
122
  - ".gitignore"
122
- - ".travis.yml"
123
123
  - ".yardopts"
124
124
  - Changelog.markdown
125
125
  - Gemfile
@@ -142,7 +142,7 @@ homepage: http://haml.info
142
142
  licenses:
143
143
  - MIT
144
144
  metadata: {}
145
- post_install_message:
145
+ post_install_message:
146
146
  rdoc_options: []
147
147
  require_paths:
148
148
  - lib
@@ -157,9 +157,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubyforge_project:
161
- rubygems_version: 2.6.9
162
- signing_key:
160
+ rubygems_version: 3.4.0.dev
161
+ signing_key:
163
162
  specification_version: 4
164
163
  summary: Converts HTML into Haml
165
164
  test_files:
data/.travis.yml DELETED
@@ -1,27 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- before_install: gem update bundler --no-document
5
-
6
- rvm:
7
- - 2.4.0
8
- - 2.3.3
9
- - 2.2.6
10
- - 2.1.10
11
- - 2.0.0
12
- - 1.9.3
13
- - rbx-2
14
- - jruby-9.1.7.0
15
-
16
- gemfile:
17
- - Gemfile
18
-
19
- branches:
20
- only:
21
- - master
22
-
23
- script: "bundle exec rake test"
24
-
25
- matrix:
26
- allow_failures:
27
- - rvm: rbx-2