syntax_tree-haml 0.1.0 → 1.0.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
2
  SHA256:
3
- metadata.gz: 711c40f06bdb83c4889511758c3aa91f3aa7899a938ecdd88fd25d3a8ad5e0b1
4
- data.tar.gz: 95638948d5c9ffde2ed072daa08de0ac144ed6dc9b700d66f823b5013de53dcd
3
+ metadata.gz: 7631572676709bc4c79a2030b99cdd8e084ce038c52c291c27ded3270f799829
4
+ data.tar.gz: 1ab41e2943d58dd6d6cf242fe4a45e3b257a4963a5cca091241cc154f4c3e73e
5
5
  SHA512:
6
- metadata.gz: 40dc20bf9f0953b73458aa88aa6a32fd3ff8b032d5c3045c17304e2203bad3c88f9f45b1bec7f58bf8a5e86bf87890832f12ab8ba7724242210016e0f779dee7
7
- data.tar.gz: db0b0b019ed7ea98d8283be82cb5f84e84cb40fd537ab592cca582cd5ce0b7119009faaec437d858c81143bfa84de34da4f9c2e0a6bc1c372f140059f0c7730a
6
+ metadata.gz: c0acf761755fb73bb9e9bd113cc5d26328ce4f61f1d2f1a67930b2fb62954de0dcdf88696b6a874a8424dce7d2c2e85baa614f704347ee308652276dd5d8d7c4
7
+ data.tar.gz: e5ef7dcc2a98160a5cd90fc7e4de44cef58aacd086ec1cf9f0fabfad20c9be83829a3a0c7fabb7311f392dba40ea49bcfc2a26fbb7eada822f2c8e8fe1660a92
data/.gitignore CHANGED
@@ -1,2 +1,3 @@
1
1
  coverage
2
2
  test.haml
3
+ pkg
data/CHANGELOG.md ADDED
@@ -0,0 +1,23 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [Unreleased]
8
+
9
+ ## [1.0.0] - 2022-03-31
10
+
11
+ ### Changed
12
+
13
+ - Hook into Syntax Tree 2.0.0 to provide CLI support.
14
+
15
+ ## [0.1.0] - 2022-03-31
16
+
17
+ ### Added
18
+
19
+ - 🎉 Initial release! 🎉
20
+
21
+ [unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v1.0.0...HEAD
22
+ [1.0.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/v0.1.0...v1.0.0
23
+ [0.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-haml/compare/c1264c...v0.1.0
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- syntax_tree-haml (0.1.0)
4
+ syntax_tree-haml (1.0.0)
5
5
  haml (>= 5.2)
6
- syntax_tree
6
+ syntax_tree (>= 2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -20,7 +20,7 @@ GEM
20
20
  simplecov_json_formatter (~> 0.1)
21
21
  simplecov-html (0.12.3)
22
22
  simplecov_json_formatter (0.1.4)
23
- syntax_tree (1.2.0)
23
+ syntax_tree (2.0.0)
24
24
  temple (0.8.2)
25
25
  tilt (2.0.10)
26
26
 
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022-present Kevin Newton
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -35,21 +35,21 @@ puts SyntaxTree::Haml.format(source) # format the AST
35
35
  From the CLI:
36
36
 
37
37
  ```sh
38
- $ stree ast template.haml
38
+ $ stree ast --plugins=haml template.haml
39
39
  (root children=[(tag name="span" value="Hello, world!")])
40
40
  ```
41
41
 
42
42
  or
43
43
 
44
44
  ```sh
45
- $ stree format template.haml
45
+ $ stree format --plugins=haml template.haml
46
46
  %span Hello, world!
47
47
  ```
48
48
 
49
49
  or
50
50
 
51
51
  ```sh
52
- $ stree write template.haml
52
+ $ stree write --plugins=haml template.haml
53
53
  template.haml 1ms
54
54
  ```
55
55
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#html-comments-
6
6
  class Comment
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#doctype-
6
6
  class Doctype
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#filters
6
6
  class Filter
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#haml-comments--
6
6
  class HamlComment
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#plain-text
6
6
  class Plain
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  class Root
6
6
  attr_reader :node
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#inserting_ruby
6
6
  class Script
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  # https://haml.info/docs/yardoc/file.REFERENCE.html#running-ruby--
6
6
  class SilentScript
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
5
  class Tag
6
6
  LiteralHashValue = Struct.new(:value)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class SyntaxTree < Ripper
3
+ module SyntaxTree
4
4
  module Haml
5
- VERSION = "0.1.0"
5
+ VERSION = "1.0.0"
6
6
  end
7
7
  end
@@ -41,7 +41,7 @@ class Haml::Parser::ParseNode
41
41
  end
42
42
  end
43
43
 
44
- class SyntaxTree < Ripper
44
+ module SyntaxTree
45
45
  module Haml
46
46
  def self.parse(source)
47
47
  ::Haml::Parser.new({}).call(source)
@@ -55,6 +55,10 @@ class SyntaxTree < Ripper
55
55
  formatter.output.join
56
56
  end
57
57
 
58
+ def self.read(filepath)
59
+ File.read(filepath)
60
+ end
61
+
58
62
  def self.with_children(node, q)
59
63
  if node.children.empty?
60
64
  q.group { yield }
@@ -71,4 +75,8 @@ class SyntaxTree < Ripper
71
75
  end
72
76
  end
73
77
  end
78
+
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)
74
82
  end
@@ -25,7 +25,7 @@ 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"
28
+ spec.add_dependency "syntax_tree", ">= 2.0"
29
29
 
30
30
  spec.add_development_dependency "bundler"
31
31
  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: 0.1.0
4
+ version: 1.0.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-30 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '2.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -104,9 +104,11 @@ files:
104
104
  - ".github/dependabot.yml"
105
105
  - ".github/workflows/main.yml"
106
106
  - ".gitignore"
107
+ - CHANGELOG.md
107
108
  - CODE_OF_CONDUCT.md
108
109
  - Gemfile
109
110
  - Gemfile.lock
111
+ - LICENSE
110
112
  - README.md
111
113
  - Rakefile
112
114
  - bin/format