mdless 2.1.25 → 2.1.27

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: 7e20c93485c7b39a9b31627f779b9d36c1671cbc13649b079edbe6a4b97a6cd5
4
- data.tar.gz: f0c098c1b89fc82d532dd446152e5f8c24a4ff5e8c9ea1cfa0db5cdb7c749419
3
+ metadata.gz: e2ff8e5c411b2dca9194b32e684495ee5a43376da035e427365c7c8c305abc3d
4
+ data.tar.gz: 7de7a979e5aeeb61cb92d3e0dfd1166aec6ac63f446422592a3a005cd6ec8755
5
5
  SHA512:
6
- metadata.gz: e7769b7398ce44574926efe08e97ac52e1f0cd5e0d39ed47a10b34da6e596fd37d7b88a498bed4c8ce88a70019c09d7ccc5ec9c255de04147921ad3fea1b36c1
7
- data.tar.gz: ee7eabac8aacf7e268ac5708cdf97ade953d0dd1df50c1b83ca9dc20dd25a4a41c29068514b6ed3682d374e1c8b6ece6a2b6c484681b85213cc590d4293e2a5b
6
+ metadata.gz: 0b458218411a7a4952652aa807c2b98cb2ea298b3f3051b4743acf1afb670c914b690e7ce97e5185cb0a86c83bdf2b3c552d7b2d8075454324ce39fef9629f9c
7
+ data.tar.gz: d44ebccb7cb2230713c7250e0dcc904961b0f7b9f0fd2f146cbaa24ca7580a748e4282dd23c8e367f6d1bb5176c4c0efa08457cc7bde02481b66c5db722bdde9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ 2.1.26
2
+
3
+ 2.1.27
4
+ : Error handling when YAML can't be processed
5
+
1
6
  2.1.25
2
7
  : YAML loading issues caused by safe_load
3
8
 
@@ -751,8 +751,17 @@ module Redcarpet
751
751
  in_yaml = true
752
752
  input.sub!(/(?i-m)^---[ \t]*\n(?<content>(?:[\s\S]*?))\n[-.]{3}[ \t]*\n/m) do
753
753
  m = Regexp.last_match
754
- MDLess.log.info('Processing YAML Header')
755
- MDLess.meta = YAML.load(m['content']).map { |k, v| "#{k.downcase}" => v }
754
+ MDLess.log.info('Processing YAML header')
755
+ begin
756
+ MDLess.meta = YAML.load(m['content']).map { |k, v| "#{k.downcase}" => v }
757
+ rescue Psych::DisallowedClass => e
758
+ @log.error('Error reading YAML header')
759
+ @log.error(e)
760
+ MDLess.meta = {}
761
+ rescue StandardError => e
762
+ @log.error("StandardError: #{e}")
763
+ end
764
+
756
765
  lines = m[0].split(/\n/)
757
766
  longest = lines.longest_element.length
758
767
  longest = longest < MDLess.cols ? longest + 1 : MDLess.cols
@@ -780,10 +789,12 @@ module Redcarpet
780
789
 
781
790
  lines.map do |line|
782
791
  line.sub!(/^(.*?:)[ \t]+(\S)/, '\1 \2')
783
- parts = line.match(/[ \t]*(.*?): +(.*?)$/)
784
- key = parts[1].gsub(/[^a-z0-9\-_]/i, '')
785
- value = parts[2].strip
786
- MDLess.meta[key] = value
792
+ parts = line.match(/^[ \t]*(\S.*?):[ \t]+(\S.*?)$/)
793
+ if parts
794
+ key = parts[1].gsub(/[^a-z0-9\-_]/i, '')
795
+ value = parts[2].strip
796
+ MDLess.meta[key] = value
797
+ end
787
798
  line = "#{color('metadata marker')}%#{color('metadata color')}#{line}"
788
799
  line += "\u00A0" * (longest - line.uncolor.strip.length) if (longest - line.uncolor.strip.length).positive?
789
800
  line + xc
@@ -264,6 +264,7 @@ module CLIMarkdown
264
264
  opts.delete(:section)
265
265
  opts.delete(:update_config)
266
266
  opts.delete(:update_theme)
267
+ opts.delete(:width)
267
268
  opts = opts.keys.map(&:to_s).sort.map { |k| [k.to_sym, opts[k.to_sym]] }.to_h
268
269
  f.puts YAML.dump(opts)
269
270
  warn "Config file saved to #{config}"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.1.25'
4
+ VERSION = '2.1.27'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdless
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.25
4
+ version: 2.1.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra