marked-conductor 1.0.33 → 1.0.37

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: 3a27e45e5fc64335fa1278d3fd33aff4fd691bbae6edac649689f42d9d8425a2
4
- data.tar.gz: e5b70aaa3cf17036e20caa856e4629aa55023ba3dae53be8dbdff3fcd2bef955
3
+ metadata.gz: ecb00aeb3e1cbd137378b4b4f236ebf7c9b0a1a24a9e9bff5c5788eacb327730
4
+ data.tar.gz: 6bd4a657d14378e9e65acf704162dc3f79163f87e48840fe93d6e7047eb14455
5
5
  SHA512:
6
- metadata.gz: 31c5b37a272d7f2caf66016d5696308a7c1a0a666ed80e5900274c26ab0ba5fc485ad4f09f3380459255cec68e07ac86124fb9ae2e61662a018297a9edbad0c0
7
- data.tar.gz: e87f4cd7548948a33098717f657dfcab0ec14a7411615754b7dc0af00a511f0155e9c404d2a7bd3a892296300120d73bae513b2b503ebafd41b35c1aa5d1bd74
6
+ metadata.gz: d7b041001f2ae096a66d9efa3aa359d20e2f8b1ea0bb35a11e455c6e171b3746d97c678bfb1272b7d1d0328045a552023eeef85a131538524c936213d83a7163
7
+ data.tar.gz: 99c1e9653fd7feffdae8def8ee3b37a79cb3a4e6fc9d2c221cbe41c8ecd9ca39a5971bfc15d140dec867e172da6ed1477d82777530856c53578de9e94a559f12
data/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ ### 1.0.37
2
+
3
+ 2024-08-23 11:04
4
+
5
+ #### FIXED
6
+
7
+ - Attempt to fix installation on Ruby 2.6
8
+
9
+ ### 1.0.36
10
+
11
+ 2024-08-23 11:03
12
+
13
+ #### FIXED
14
+
15
+ - Attempt to fix installation on Ruby 2.6
16
+
17
+ ### 1.0.35
18
+
19
+ 2024-08-22 10:14
20
+
21
+ #### IMPROVED
22
+
23
+ - Code cleanup
24
+ - Cleaner UTF-8 string encoding
25
+
26
+ ### 1.0.34
27
+
28
+ 2024-08-22 10:13
29
+
30
+ #### IMPROVED
31
+
32
+ - Code cleanup
33
+ - Cleaner UTF-8 string encoding
34
+
1
35
  ### 1.0.33
2
36
 
3
37
  2024-08-22 06:35
data/Gemfile CHANGED
@@ -4,8 +4,3 @@ source "https://rubygems.org"
4
4
 
5
5
  # Specify your gem's dependencies in marked-conductor.gemspec
6
6
  gemspec
7
-
8
- gem "rake", "~> 13.0"
9
-
10
- gem "rubocop", "~> 1.21"
11
- gem "rspec", "~> 3.13"
@@ -67,7 +67,7 @@ module Conductor
67
67
  end
68
68
 
69
69
  if use_stdin
70
- `echo #{Shellwords.escape(stdin.force_encoding("utf-8"))} | #{Env} #{path} #{args}`
70
+ `echo #{Shellwords.escape(stdin.utf8)} | #{Env} #{path} #{args}`
71
71
  else
72
72
  `#{Env} #{path} #{args}`
73
73
  end
@@ -42,7 +42,7 @@ class ::String
42
42
  ## @return [Symbol] metadata type
43
43
  ##
44
44
  def meta_type
45
- lines = clean_encode.split(/\n/)
45
+ lines = utf8.split(/\n/)
46
46
  case lines[0]
47
47
  when /^--- *$/
48
48
  :yaml
@@ -65,7 +65,7 @@ class ::String
65
65
 
66
66
  case meta_type
67
67
  when :yaml
68
- lines = clean_encode.split(/\n/)
68
+ lines = utf8.split(/\n/)
69
69
  lines.shift
70
70
  lines.each_with_index do |line, idx|
71
71
  next unless line =~ /^(\.\.\.|---) *$/
@@ -74,7 +74,7 @@ class ::String
74
74
  break
75
75
  end
76
76
  when :mmd
77
- lines = clean_encode.split(/\n/)
77
+ lines = utf8.split(/\n/)
78
78
  lines.each_with_index do |line, idx|
79
79
  next if line =~ /^ *[ \w]+: +\S+/
80
80
 
@@ -82,7 +82,7 @@ class ::String
82
82
  break
83
83
  end
84
84
  when :pandoc
85
- lines = clean_encode.split(/\n/)
85
+ lines = utf8.split(/\n/)
86
86
  lines.each_with_index do |line, idx|
87
87
  next if line =~ /^% +\S/
88
88
 
@@ -101,7 +101,7 @@ class ::String
101
101
  ##
102
102
  def first_h1
103
103
  first = nil
104
- clean_encode.split(/\n/).each_with_index do |line, idx|
104
+ utf8.split(/\n/).each_with_index do |line, idx|
105
105
  if line =~ /^(# *[^#]|={2,} *$)/
106
106
  first = idx
107
107
  break
@@ -118,7 +118,7 @@ class ::String
118
118
  def first_h2
119
119
  first = nil
120
120
  meta_end = meta_insert_point
121
- clean_encode.split(/\n/).each_with_index do |line, idx|
121
+ utf8.split(/\n/).each_with_index do |line, idx|
122
122
  next if idx <= meta_end
123
123
 
124
124
  if line =~ /^(## *[^#]|-{2,} *$)/
@@ -177,7 +177,7 @@ class ::String
177
177
  ## @return [String] content with TOC tag added
178
178
  ##
179
179
  def insert_toc(max = nil, after = :h1)
180
- lines = clean_encode.split(/\n/)
180
+ lines = utf8.split(/\n/)
181
181
  max = max.to_i&.positive? ? " max#{max}" : ""
182
182
  line = case after.to_sym
183
183
  when :h2
@@ -238,7 +238,7 @@ class ::String
238
238
  if File.exist?(path)
239
239
  content = IO.read(path)
240
240
  yui = YuiCompressor::Yui.new
241
- content = yui.compress(content.clean_encode)
241
+ content = yui.compress(content.utf8)
242
242
  inject_after_meta(content.wrap_style)
243
243
  else
244
244
  warn "File not found (#{path})"
@@ -254,7 +254,7 @@ class ::String
254
254
  ## @return [String] string with content injected
255
255
  ##
256
256
  def inject_after_meta(content)
257
- lines = clean_encode.split(/\n/)
257
+ lines = utf8.split(/\n/)
258
258
  insert_point = meta_insert_point
259
259
  insert_at = insert_point.positive? ? insert_point + 1 : 0
260
260
  lines.insert(insert_at, "#{content}\n\n")
@@ -294,10 +294,10 @@ class ::String
294
294
  inject_after_meta(out)
295
295
  when :h1
296
296
  h1 = first_h1.nil? ? 0 : first_h1 + 1
297
- clean_encode.split(/\n/).insert(h1, out).join("\n")
297
+ utf8.split(/\n/).insert(h1, out).join("\n")
298
298
  when :h2
299
299
  h2 = first_h2.nil? ? 0 : first_h2 + 1
300
- clean_encode.split(/\n/).insert(h2, out).join("\n")
300
+ utf8.split(/\n/).insert(h2, out).join("\n")
301
301
  else
302
302
  "#{self}\n#{out}"
303
303
  end
@@ -393,7 +393,7 @@ class ::String
393
393
  yaml = YAML.load(m[0])
394
394
  title = yaml["title"]
395
395
  when :mmd
396
- clean_encode.split(/\n/).each do |line|
396
+ utf8.split(/\n/).each do |line|
397
397
  if line =~ /^ *title: *(\S.*?)$/i
398
398
  title = Regexp.last_match(1)
399
399
  break
@@ -401,7 +401,7 @@ class ::String
401
401
  end
402
402
  when :pandoc
403
403
  title = nil
404
- clean_encode.split(/\n/).each do |line|
404
+ utf8.split(/\n/).each do |line|
405
405
  if line =~ /^% +(.*?)$/
406
406
  title = Regexp.last_match(1)
407
407
  break
@@ -419,7 +419,7 @@ class ::String
419
419
  end
420
420
 
421
421
  def insert_title(shift: 0)
422
- content = dup.clean_encode
422
+ content = dup.utf8
423
423
  title = read_title
424
424
  content.increase_headers!(shift) if shift.positive?
425
425
  lines = content.split(/\n/)
@@ -441,7 +441,7 @@ class ::String
441
441
  end
442
442
 
443
443
  def ensure_mmd_meta_newline
444
- clean_encode.split(/\n/).insert(meta_insert_point, "\n\n").join("\n")
444
+ utf8.split(/\n/).insert(meta_insert_point, "\n\n").join("\n")
445
445
  end
446
446
 
447
447
  def add_yaml(key, value)
@@ -466,7 +466,7 @@ class ::String
466
466
  if match(/(\A|\n) *#{key}: *\S+/i)
467
467
  sub(/^ *#{key}:.*?\n/i, "#{key}: #{value}\n")
468
468
  else
469
- lines = clean_encode.split(/\n/)
469
+ lines = utf8.split(/\n/)
470
470
  lines.insert(meta_insert_point, "#{key}: #{value}")
471
471
  "#{lines.join("\n")}\n"
472
472
  end
@@ -484,7 +484,7 @@ class ::String
484
484
  if comment?(key)
485
485
  sub(/ *#{key}: .*?$/, "#{key}: #{value}")
486
486
  else
487
- lines = clean_encode.split(/\n/)
487
+ lines = utf8.split(/\n/)
488
488
  lines.insert(meta_insert_point + 1, "\n<!--\n#{key}: #{value}\n-->")
489
489
  lines.join("\n")
490
490
  end
@@ -506,10 +506,10 @@ class ::String
506
506
  when :yaml
507
507
  sub(/^---.*?(---|\.\.\.)/m, "")
508
508
  when :mmd
509
- lines = clean_encode.split(/\n/)
509
+ lines = utf8.split(/\n/)
510
510
  lines[meta_insert_point..].join("\n")
511
511
  when :pandoc
512
- lines = clean_encode.split(/\n/)
512
+ lines = utf8.split(/\n/)
513
513
  lines[meta_insert_point..].join("\n")
514
514
  else
515
515
  gsub(/(\n|^)<!--\n[\w\d\s]+: ([\w\d\s]+)\n-->\n/m, '')
@@ -574,7 +574,7 @@ class ::String
574
574
  ##
575
575
  def ensure_h1
576
576
  headers = to_enum(:scan, /(\#{1,6})([^#].*?)$/m).map { Regexp.last_match }
577
- return self if headers.select { |h| h[1].size == 1 }.count.positive?
577
+ return self unless headers.select { |h| h[1].size == 1 }.empty?
578
578
 
579
579
  lowest_header = headers.min_by { |h| h[1].size }
580
580
  return self if lowest_header.nil?
@@ -72,7 +72,7 @@ module Conductor
72
72
  end
73
73
 
74
74
  if use_stdin
75
- `echo #{Shellwords.escape(stdin.force_encoding("utf-8"))} | #{Env} #{@path} #{@args}`
75
+ `echo #{Shellwords.escape(stdin.utf8)} | #{Env} #{@path} #{@args}`
76
76
  else
77
77
  `#{Env} #{@path} #{@args}`
78
78
  end
@@ -200,6 +200,24 @@ class ::String
200
200
  gsub(/\$(\d+)/, '\\\\\1').gsub(/(^["']|["']$)/, "")
201
201
  end
202
202
 
203
+ ##
204
+ ## Discard invalid characters and output a UTF-8 String
205
+ ##
206
+ ## @return [String] UTF-8 encoded string
207
+ ##
208
+ def utf8
209
+ encode('utf-16', invalid: :replace).encode('utf-8')
210
+ end
211
+
212
+ ##
213
+ ## Destructive version of #utf8
214
+ ##
215
+ ## @return [String] UTF-8 encoded string, in place
216
+ ##
217
+ def utf8!
218
+ replace scrub
219
+ end
220
+
203
221
  ##
204
222
  ## Get a clean UTF-8 string by forcing an ISO encoding and then re-encoding
205
223
  ##
@@ -208,4 +226,13 @@ class ::String
208
226
  def clean_encode
209
227
  force_encoding("ISO-8859-1").encode("utf-8", replace: nil)
210
228
  end
229
+
230
+ ##
231
+ ## Destructive version of #clean_encode
232
+ ##
233
+ ## @return [String] UTF-8 string, in place
234
+ ##
235
+ def clean_encode!
236
+ replace clean_encode
237
+ end
211
238
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conductor
4
- VERSION = '1.0.33'
4
+ VERSION = '1.0.37'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marked-conductor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.33
4
+ version: 1.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-22 00:00:00.000000000 Z
11
+ date: 2024-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -156,6 +156,20 @@ dependencies:
156
156
  - - ">="
157
157
  - !ruby/object:Gem::Version
158
158
  version: 0.9.26
159
+ - !ruby/object:Gem::Dependency
160
+ name: rubocop
161
+ requirement: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - "~>"
164
+ - !ruby/object:Gem::Version
165
+ version: '1.21'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ requirements:
170
+ - - "~>"
171
+ - !ruby/object:Gem::Version
172
+ version: '1.21'
159
173
  - !ruby/object:Gem::Dependency
160
174
  name: chronic
161
175
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +212,6 @@ files:
198
212
  - CHANGELOG.md
199
213
  - CODE_OF_CONDUCT.md
200
214
  - Gemfile
201
- - Gemfile.lock
202
215
  - LICENSE.txt
203
216
  - README.md
204
217
  - README.rdoc
@@ -219,7 +232,6 @@ files:
219
232
  - lib/conductor/string.rb
220
233
  - lib/conductor/version.rb
221
234
  - lib/conductor/yui_compressor.rb
222
- - marked-conductor.gemspec
223
235
  - src/_README.md
224
236
  - test.sh
225
237
  homepage: https://github.com/ttscoff/marked-conductor
@@ -229,7 +241,7 @@ metadata:
229
241
  homepage_uri: https://github.com/ttscoff/marked-conductor
230
242
  source_code_uri: https://github.com/ttscoff/marked-conductor
231
243
  changelog_uri: https://github.com/ttscoff/marked-conductor/CHANGELOG.md
232
- post_install_message:
244
+ post_install_message:
233
245
  rdoc_options: []
234
246
  require_paths:
235
247
  - lib
@@ -244,8 +256,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
256
  - !ruby/object:Gem::Version
245
257
  version: '0'
246
258
  requirements: []
247
- rubygems_version: 3.2.15
248
- signing_key:
259
+ rubygems_version: 3.0.3.1
260
+ signing_key:
249
261
  specification_version: 4
250
262
  summary: A custom processor manager for Marked 2 (Mac)
251
263
  test_files: []
data/Gemfile.lock DELETED
@@ -1,103 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- marked-conductor (1.0.33)
5
- chronic (~> 0.10.2)
6
- tty-which (~> 0.5.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- ansi (1.5.0)
12
- ast (2.4.2)
13
- awesome_print (1.9.2)
14
- chronic (0.10.2)
15
- coderay (1.1.3)
16
- diff-lcs (1.5.1)
17
- docile (1.4.0)
18
- gem-release (2.2.2)
19
- json (2.7.2)
20
- language_server-protocol (3.17.0.3)
21
- method_source (1.1.0)
22
- multi_json (1.15.0)
23
- parallel (1.24.0)
24
- parse_gemspec (1.0.0)
25
- parse_gemspec-cli (1.0.0)
26
- multi_json
27
- parse_gemspec
28
- thor
29
- parser (3.3.1.0)
30
- ast (~> 2.4.1)
31
- racc
32
- pry (0.14.2)
33
- coderay (~> 1.1)
34
- method_source (~> 1.0)
35
- racc (1.7.3)
36
- rainbow (3.1.1)
37
- rake (13.2.1)
38
- regexp_parser (2.9.0)
39
- rexml (3.2.6)
40
- rspec (3.13.0)
41
- rspec-core (~> 3.13.0)
42
- rspec-expectations (~> 3.13.0)
43
- rspec-mocks (~> 3.13.0)
44
- rspec-core (3.13.0)
45
- rspec-support (~> 3.13.0)
46
- rspec-expectations (3.13.1)
47
- diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.13.0)
49
- rspec-mocks (3.13.1)
50
- diff-lcs (>= 1.2.0, < 2.0)
51
- rspec-support (~> 3.13.0)
52
- rspec-support (3.13.1)
53
- rubocop (1.62.1)
54
- json (~> 2.3)
55
- language_server-protocol (>= 3.17.0)
56
- parallel (~> 1.10)
57
- parser (>= 3.3.0.2)
58
- rainbow (>= 2.2.2, < 4.0)
59
- regexp_parser (>= 1.8, < 3.0)
60
- rexml (>= 3.2.5, < 4.0)
61
- rubocop-ast (>= 1.31.1, < 2.0)
62
- ruby-progressbar (~> 1.7)
63
- unicode-display_width (>= 2.4.0, < 3.0)
64
- rubocop-ast (1.31.2)
65
- parser (>= 3.3.0.4)
66
- ruby-progressbar (1.13.0)
67
- simplecov (0.22.0)
68
- docile (~> 1.1)
69
- simplecov-html (~> 0.11)
70
- simplecov_json_formatter (~> 0.1)
71
- simplecov-console (0.9.1)
72
- ansi
73
- simplecov
74
- terminal-table
75
- simplecov-html (0.12.3)
76
- simplecov_json_formatter (0.1.4)
77
- terminal-table (3.0.2)
78
- unicode-display_width (>= 1.1.1, < 3)
79
- thor (1.3.1)
80
- tty-which (0.5.0)
81
- unicode-display_width (2.5.0)
82
- yard (0.9.36)
83
-
84
- PLATFORMS
85
- arm64-darwin-20
86
- x86_64-darwin-20
87
-
88
- DEPENDENCIES
89
- awesome_print (~> 1.9.2)
90
- bundler (~> 2.0)
91
- gem-release (~> 2.2)
92
- marked-conductor!
93
- parse_gemspec-cli (~> 1.0)
94
- pry (~> 0.14.2)
95
- rake (~> 13.0)
96
- rspec (~> 3.13)
97
- rubocop (~> 1.21)
98
- simplecov (~> 0.21)
99
- simplecov-console (~> 0.9)
100
- yard (~> 0.9, >= 0.9.26)
101
-
102
- BUNDLED WITH
103
- 2.2.29
@@ -1,49 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "lib/conductor/version"
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "marked-conductor"
7
- spec.version = Conductor::VERSION
8
- spec.authors = ["Brett Terpstra"]
9
- spec.email = ["me@brettterpstra.com"]
10
-
11
- spec.summary = "A custom processor manager for Marked 2 (Mac)"
12
- spec.description = "Conductor allows easy configuration of multiple scripts" \
13
- "which are run as custom pre/processors for Marked based on conditional statements."
14
- spec.homepage = "https://github.com/ttscoff/marked-conductor"
15
- spec.license = "MIT"
16
- spec.required_ruby_version = ">= 2.6.0"
17
-
18
- spec.metadata["homepage_uri"] = spec.homepage
19
- spec.metadata["source_code_uri"] = "https://github.com/ttscoff/marked-conductor"
20
- spec.metadata["changelog_uri"] = "https://github.com/ttscoff/marked-conductor/CHANGELOG.md"
21
-
22
- # Specify which files should be added to the gem when it is released.
23
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
24
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
- `git ls-files -z`.split("\x0").reject do |f|
26
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
27
- end
28
- end
29
- spec.bindir = "bin"
30
- spec.executables = spec.files.grep(%r{\Abin/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
-
33
- spec.add_development_dependency "awesome_print", "~> 1.9.2"
34
- spec.add_development_dependency "bundler", "~> 2.0"
35
- spec.add_development_dependency "gem-release", "~> 2.2"
36
- spec.add_development_dependency "parse_gemspec-cli", "~> 1.0"
37
- spec.add_development_dependency "pry", "~> 0.14.2"
38
- spec.add_development_dependency "rake", "~> 13.0"
39
- spec.add_development_dependency "rspec", "~> 3.0"
40
- spec.add_development_dependency "simplecov", "~> 0.21"
41
- spec.add_development_dependency "simplecov-console", "~> 0.9"
42
- spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.26"
43
-
44
- # Uncomment to register a new dependency of your gem
45
- spec.add_dependency "chronic", "~> 0.10.2"
46
- spec.add_dependency "tty-which", "~> 0.5.0"
47
- # For more information and examples about making a new gem, checkout our
48
- # guide at: https://bundler.io/guides/creating_gem.html
49
- end