syntax_tree-haml 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7631572676709bc4c79a2030b99cdd8e084ce038c52c291c27ded3270f799829
4
- data.tar.gz: 1ab41e2943d58dd6d6cf242fe4a45e3b257a4963a5cca091241cc154f4c3e73e
3
+ metadata.gz: b81fe1099e22a95015983cabc44340820430e2b1273d89b8042cd5c0799e9eec
4
+ data.tar.gz: 81dac915a833b4a8a4fd82e5f14dc1b98b6db5d94733701c57b18cc9d86cd983
5
5
  SHA512:
6
- metadata.gz: c0acf761755fb73bb9e9bd113cc5d26328ce4f61f1d2f1a67930b2fb62954de0dcdf88696b6a874a8424dce7d2c2e85baa614f704347ee308652276dd5d8d7c4
7
- data.tar.gz: e5ef7dcc2a98160a5cd90fc7e4de44cef58aacd086ec1cf9f0fabfad20c9be83829a3a0c7fabb7311f392dba40ea49bcfc2a26fbb7eada822f2c8e8fe1660a92
6
+ metadata.gz: fd3c147a0e384a3b95196ed051420f8d873c960bc28af8df964b9fa0e5550adcf1072c1f76b4b39675ccdbdc8099fd7fb02ec1e5c6062a028ee4f0317afca19e
7
+ data.tar.gz: 764aa4c5a07616dd5a6a43f8dde3efa0b61490573ff414b5c271a2ee25b417def1b8586b7ce7bfaa4d51871bb8bd66356e826fc0131b9cabadf0b31e441a5183
@@ -4,6 +4,13 @@ on:
4
4
  - pull_request_target
5
5
  jobs:
6
6
  ci:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby:
11
+ - '2.7'
12
+ - '3.0'
13
+ - '3.1'
7
14
  name: CI
8
15
  runs-on: ubuntu-latest
9
16
  env:
@@ -13,7 +20,7 @@ jobs:
13
20
  - uses: ruby/setup-ruby@v1
14
21
  with:
15
22
  bundler-cache: true
16
- ruby-version: '3.1'
23
+ ruby-version: ${{ matrix.ruby }}
17
24
  - name: Test
18
25
  run: bundle exec rake test
19
26
  automerge:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.2.0] - 2022-05-13
10
+
11
+ ### Added
12
+
13
+ - An optional `maxwidth` second argument to `SyntaxTree::Haml.format`.
14
+
15
+ ## [1.1.0] - 2022-04-22
16
+
17
+ ### Added
18
+
19
+ - Support for Ruby 2.7 added back.
20
+
21
+ ## [1.0.1] - 2022-03-31
22
+
23
+ ### Changed
24
+
25
+ - Fix up usage of the `SyntaxTree.register_handler` method.
26
+
9
27
  ## [1.0.0] - 2022-03-31
10
28
 
11
29
  ### Changed
@@ -18,6 +36,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
18
36
 
19
37
  - 🎉 Initial release! 🎉
20
38
 
21
- [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.0.0...HEAD
39
+ [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.2.0...HEAD
40
+ [1.2.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.1.0...v1.2.0
41
+ [1.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.0.1...v1.1.0
42
+ [1.0.1]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.0.0...v1.0.1
22
43
  [1.0.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v0.1.0...v1.0.0
23
44
  [0.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/c1264c...v0.1.0
data/Gemfile.lock CHANGED
@@ -1,9 +1,10 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree-haml (1.0.0)
4
+ syntax_tree-haml (1.2.0)
5
5
  haml (>= 5.2)
6
- syntax_tree (>= 2.0)
6
+ prettier_print
7
+ syntax_tree (>= 2.0.1)
7
8
 
8
9
  GEM
9
10
  remote: https://rubygems.org/
@@ -13,6 +14,7 @@ GEM
13
14
  temple (>= 0.8.0)
14
15
  tilt
15
16
  minitest (5.15.0)
17
+ prettier_print (0.1.0)
16
18
  rake (13.0.6)
17
19
  simplecov (0.21.2)
18
20
  docile (~> 1.1)
@@ -20,11 +22,15 @@ GEM
20
22
  simplecov_json_formatter (~> 0.1)
21
23
  simplecov-html (0.12.3)
22
24
  simplecov_json_formatter (0.1.4)
23
- syntax_tree (2.0.0)
25
+ syntax_tree (2.5.0)
26
+ prettier_print
24
27
  temple (0.8.2)
25
28
  tilt (2.0.10)
26
29
 
27
30
  PLATFORMS
31
+ ruby
32
+ x86_64-darwin-19
33
+ x86_64-darwin-20
28
34
  x86_64-darwin-21
29
35
  x86_64-linux
30
36
 
@@ -48,9 +48,14 @@ module SyntaxTree
48
48
  def continuation?(child)
49
49
  return false if child.type != :silent_script
50
50
 
51
- [node.value[:keyword], child.value[:keyword]] in
52
- ["case", "in" | "when" | "else"] |
53
- ["if" | "unless", "elsif" | "else"]
51
+ case [node.value[:keyword], child.value[:keyword]]
52
+ in ["case", "in" | "when" | "else"]
53
+ true
54
+ in ["if" | "unless", "elsif" | "else"]
55
+ true
56
+ else
57
+ false
58
+ end
54
59
  end
55
60
  end
56
61
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SyntaxTree
4
4
  module Haml
5
- VERSION = "1.0.0"
5
+ VERSION = "1.2.0"
6
6
  end
7
7
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "haml"
4
+ require "prettier_print"
4
5
  require "syntax_tree"
5
6
 
6
7
  require "syntax_tree/haml/comment"
@@ -47,12 +48,8 @@ module SyntaxTree
47
48
  ::Haml::Parser.new({}).call(source)
48
49
  end
49
50
 
50
- def self.format(source)
51
- formatter = PP.new([])
52
- parse(source).format(formatter)
53
-
54
- formatter.flush
55
- formatter.output.join
51
+ def self.format(source, maxwidth = 80)
52
+ PrettierPrint.format(+"", maxwidth) { |q| parse(source).format(q) }
56
53
  end
57
54
 
58
55
  def self.read(filepath)
@@ -76,7 +73,6 @@ module SyntaxTree
76
73
  end
77
74
  end
78
75
 
79
- # If we're in the context of the CLI, then register our module as a handler
80
- # for the .haml file type.
81
- CLI.register_handler(".haml", Haml) if const_defined?(:CLI)
76
+ # Register our module as a handler for the .haml file type.
77
+ register_handler(".haml", Haml)
82
78
  end
@@ -25,7 +25,8 @@ Gem::Specification.new do |spec|
25
25
  spec.require_paths = %w[lib]
26
26
 
27
27
  spec.add_dependency "haml", ">= 5.2"
28
- spec.add_dependency "syntax_tree", ">= 2.0"
28
+ spec.add_dependency "prettier_print"
29
+ spec.add_dependency "syntax_tree", ">= 2.0.1"
29
30
 
30
31
  spec.add_development_dependency "bundler"
31
32
  spec.add_development_dependency "minitest"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree-haml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-31 00:00:00.000000000 Z
11
+ date: 2022-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -24,20 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '5.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: prettier_print
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: syntax_tree
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: '2.0'
47
+ version: 2.0.1
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: '2.0'
54
+ version: 2.0.1
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: bundler
43
57
  requirement: !ruby/object:Gem::Requirement