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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69032d72b1695bfe2afc7a11dbb965e4abf252a7c42caab252e972bcb45c13f8
4
- data.tar.gz: af3822a5d2375300d4b07f0114c30c933eb215c88bfcee1bd6cc4938d769d76e
3
+ metadata.gz: 05cfa3a429ac2da0e1241e65e69a40f9171079cddb9451a6d7186726a5cb498c
4
+ data.tar.gz: 68826c3fe78dc87bfd704cc38a9222da1adeed36a8c0d0e903bb4f3077ed698d
5
5
  SHA512:
6
- metadata.gz: b59318e78f3c7c83e67334326992babdc60d3d299ed8973778f7c3c463b1eaaaacbefafe20ee8f7072eff13db72c3a88c5a0cae7f4ecd18629bc9e8a35645599
7
- data.tar.gz: 173fdc474e985a89ead0c473d25bcb2bb4deb586679d17bee18d5384b29e21900e79e03567ed302bce9ac37b81dc4ad29ed3b837eeeac5027d7db57ed3879c4b
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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- slimi (0.3.0)
4
+ slimi (0.4.0)
5
5
  temple
6
6
 
7
7
  GEM
data/lib/slimi/errors.rb CHANGED
@@ -57,7 +57,7 @@ module Slimi
57
57
  class UnexpectedTextAfterClosedTagError < SlimSyntaxError
58
58
  end
59
59
 
60
- class UnknownLineIndicator < SlimSyntaxError
60
+ class UnknownLineIndicatorError < SlimSyntaxError
61
61
  end
62
62
  end
63
63
  end
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(options = {})
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
- raise(Errors::UnknownLineIndicatorError)
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: '(__TEMPLATE__)',
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Slimi
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
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.3.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-23 00:00:00.000000000 Z
11
+ date: 2021-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: temple