ttyhue 0.1.0 → 0.1.1

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: cb7345390820acfae134f75dc1981a94237f2f928923e69b811b054beefbdeca
4
- data.tar.gz: e538fbdd297be620d19b00734fa45e32997d6a41908536135b040e1816ab2abe
3
+ metadata.gz: af65d1fb8b291975e59954185bbd291590458314bcffb6cd5290e0605c716ec7
4
+ data.tar.gz: 6c4c537ad260ee7d0821711a9a5da4ad2387382b3de01f832f49d5655cef68ff
5
5
  SHA512:
6
- metadata.gz: 172e42263db78b3eaa8ed2560a2f175868d3ef15022f95de19912302398086cd21cc62d3bb305cdfbfbfa2846d3111d62887cfaee88125c41f4bba533fcf180c
7
- data.tar.gz: a7cf357df077c92732886b0909e7741283688592c9830c6ecb3f0331ec18d03eb11a1e6343edd779ffaa4eeea9f585dc4d7dbf050888fcd3eb773d973434db29
6
+ metadata.gz: 0df6935bb6733b64d9b66e3a35a722d511d47320e5c1caed3097577a159609ae2a5ba1156217341ec003973949e11fbe42fcbed9b942968ab506fd332d580108
7
+ data.tar.gz: 07e43c8ca1251f03da5431bff3deca4e28742fff350b0c46b92166b0cd300f357b6699cb609ab1e28fd0f1910cdc523e626f05f734d06a7fac9eca4943a926ce
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.1] - 2022-10-05
4
+
5
+ - Fixed parser bug, where row of color tags as well as unclosed tags were not handled gracefully
6
+
3
7
  ## [0.1.0] - 2022-10-04
4
8
 
5
9
  - Initial release
@@ -6,8 +6,6 @@ module TTYHue
6
6
  /{(?<closing>\/?)(?<bg>b?)(?<name>#{TermColor.defs.map(&:tag_name).join("|")})}/
7
7
  end
8
8
 
9
- attr_reader :color_name, :bg
10
-
11
9
  def bg
12
10
  @match_data[:bg] != ""
13
11
  end
data/lib/ttyhue/parser.rb CHANGED
@@ -7,7 +7,8 @@ module TTYHue
7
7
 
8
8
  TOKENS = {
9
9
  tag: /{[^{}]+}/,
10
- content: /[^{]+/
10
+ content: /[^{]+/,
11
+ unclosed_tag: /{[^{]*/
11
12
  }
12
13
 
13
14
  class ParseError < StandardError; end
@@ -23,7 +24,10 @@ module TTYHue
23
24
  scanner = StringScanner.new(@string)
24
25
  until scanner.eos?
25
26
  next if handle_content!(scanner.scan(TOKENS[:content]))
26
- next if handle_tag!(scanner.scan(TOKENS[:tag]))
27
+ while str = scanner.scan(TOKENS[:tag])
28
+ handle_tag!(str)
29
+ end
30
+ next if handle_content!(scanner.scan(TOKENS[:unclosed_tag]))
27
31
  end
28
32
  flattened_result
29
33
  end
@@ -1,3 +1,3 @@
1
1
  module TTYHue
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ttyhue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dominik Sito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-04 00:00:00.000000000 Z
11
+ date: 2022-10-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest