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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +23 -0
- data/Gemfile.lock +3 -3
- data/LICENSE +21 -0
- data/README.md +3 -3
- data/lib/syntax_tree/haml/comment.rb +1 -1
- data/lib/syntax_tree/haml/doctype.rb +1 -1
- data/lib/syntax_tree/haml/filter.rb +1 -1
- data/lib/syntax_tree/haml/haml_comment.rb +1 -1
- data/lib/syntax_tree/haml/plain.rb +1 -1
- data/lib/syntax_tree/haml/root.rb +1 -1
- data/lib/syntax_tree/haml/script.rb +1 -1
- data/lib/syntax_tree/haml/silent_script.rb +1 -1
- data/lib/syntax_tree/haml/tag.rb +1 -1
- data/lib/syntax_tree/haml/version.rb +2 -2
- data/lib/syntax_tree/haml.rb +9 -1
- data/syntax_tree-haml.gemspec +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7631572676709bc4c79a2030b99cdd8e084ce038c52c291c27ded3270f799829
|
4
|
+
data.tar.gz: 1ab41e2943d58dd6d6cf242fe4a45e3b257a4963a5cca091241cc154f4c3e73e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0acf761755fb73bb9e9bd113cc5d26328ce4f61f1d2f1a67930b2fb62954de0dcdf88696b6a874a8424dce7d2c2e85baa614f704347ee308652276dd5d8d7c4
|
7
|
+
data.tar.gz: e5ef7dcc2a98160a5cd90fc7e4de44cef58aacd086ec1cf9f0fabfad20c9be83829a3a0c7fabb7311f392dba40ea49bcfc2a26fbb7eada822f2c8e8fe1660a92
|
data/.gitignore
CHANGED
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 (
|
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 (
|
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
|
|
data/lib/syntax_tree/haml/tag.rb
CHANGED
data/lib/syntax_tree/haml.rb
CHANGED
@@ -41,7 +41,7 @@ class Haml::Parser::ParseNode
|
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
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
|
data/syntax_tree-haml.gemspec
CHANGED
@@ -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:
|
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-
|
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
|