slimi 0.3.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +1 -1
- data/lib/slimi/errors.rb +1 -1
- data/lib/slimi/parser.rb +5 -5
- data/lib/slimi/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 05cfa3a429ac2da0e1241e65e69a40f9171079cddb9451a6d7186726a5cb498c
|
4
|
+
data.tar.gz: 68826c3fe78dc87bfd704cc38a9222da1adeed36a8c0d0e903bb4f3077ed698d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c729933bc060a21df2e55db525d28a8e519526995ec5b7fb3defd17ecb11c71fc7e6ec664c162396f6a8be9175549dd842c7c5f9be76c68afadadc9e3e442be
|
7
|
+
data.tar.gz: 60b3b1ad54a01bcbc2154e83b11efe3ac1b3fb5723773f04aabff9d1957dec60cb8afd431630b78dc8e13fa86d109d86a78c66005bafb10c23e0965368d9bd80
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,17 @@
|
|
2
2
|
|
3
3
|
## Unreleased
|
4
4
|
|
5
|
+
## 0.4.0 - 2021-12-25
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
- Support :file option on parser for showing correct file path on syntax error.
|
10
|
+
|
11
|
+
### Fixed
|
12
|
+
|
13
|
+
- Fix NameError on unknown line indicator.
|
14
|
+
- Fix bug that default parser options are not used.
|
15
|
+
|
5
16
|
## 0.3.0 - 2021-12-24
|
6
17
|
|
7
18
|
### Added
|
data/Gemfile.lock
CHANGED
data/lib/slimi/errors.rb
CHANGED
data/lib/slimi/parser.rb
CHANGED
@@ -6,6 +6,7 @@ require 'temple'
|
|
6
6
|
module Slimi
|
7
7
|
class Parser < ::Temple::Parser
|
8
8
|
define_options(
|
9
|
+
:file,
|
9
10
|
attr_list_delims: {
|
10
11
|
'(' => ')',
|
11
12
|
'[' => ']',
|
@@ -22,8 +23,9 @@ module Slimi
|
|
22
23
|
}
|
23
24
|
)
|
24
25
|
|
25
|
-
def initialize(
|
26
|
+
def initialize(_options = {})
|
26
27
|
super
|
28
|
+
@file_path = options[:file] || '(__TEMPLATE__)'
|
27
29
|
factory = Factory.new(
|
28
30
|
attribute_delimiters: options[:attr_list_delims] || {},
|
29
31
|
default_tag: options[:default_tag] || 'div',
|
@@ -69,7 +71,7 @@ module Slimi
|
|
69
71
|
parse_embedded_template ||
|
70
72
|
parse_doctype ||
|
71
73
|
parse_tag ||
|
72
|
-
|
74
|
+
syntax_error!(Errors::UnknownLineIndicatorError)
|
73
75
|
end
|
74
76
|
|
75
77
|
# Parse blank line.
|
@@ -198,8 +200,6 @@ module Slimi
|
|
198
200
|
marker = @scanner[1]
|
199
201
|
attribute_value = @scanner[2]
|
200
202
|
attribute_names = @attribute_shortcuts[marker]
|
201
|
-
raise 'Illegal shortcut' unless attribute_names
|
202
|
-
|
203
203
|
attribute_names.map do |attribute_name|
|
204
204
|
result << [:html, :attr, attribute_name.to_s, [:static, attribute_value]]
|
205
205
|
end
|
@@ -556,7 +556,7 @@ module Slimi
|
|
556
556
|
range = Range.new(index: @scanner.charpos, source: @scanner.string)
|
557
557
|
raise syntax_error_class.new(
|
558
558
|
column: range.column,
|
559
|
-
file_path:
|
559
|
+
file_path: @file_path,
|
560
560
|
line: range.line,
|
561
561
|
line_number: range.line_number
|
562
562
|
)
|
data/lib/slimi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: slimi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryo Nakamura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-12-
|
11
|
+
date: 2021-12-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: temple
|