mdless 2.1.28 → 2.1.29

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: 7be9ab30b8078d94b965d0f45094cd1b8e737210daaf1baa5030b54fac95c66a
4
- data.tar.gz: aec7cf2e130cfd6d66b9482d417c1cb479e80c8e76c919f3b393524f68dc768d
3
+ metadata.gz: 1e5c2be4377b1bad77f8c7f3e0ab932a16ca9339332c91e3bc5f0b7db8c71df2
4
+ data.tar.gz: f540f256c1117dab4a9ef0e758f940d3f79a848abe2f15f5b2866e5f2e052656
5
5
  SHA512:
6
- metadata.gz: 66ebe7c5ee11c2266ecfb214058b71225c5842b81cf200e5c76854da9f0c3bdbd83fe34241a7dc7198b818203fb557cc0c4b4b642a95eb59e1190f7ae15d633d
7
- data.tar.gz: 870ced12acb6fbbd687ea2159a7a88ac983e0fc058db27c367b6be626b778407a71a5b78c35e3775bbb08f6edc668821f02cf8826da46acef98df4ceb1abe41a
6
+ metadata.gz: b52a6501909c93927e508419298a767aeb759c661b45c877feb33b72caa9f512146ab5fc67a41530666328e5e37ebc53bf25979b0340ee50666433e85f2df920
7
+ data.tar.gz: da7f8a1949c56474461847ca9b66fccc1dea888552976b2e00b3dea12a250ba3c28cc70bf2496a1293171c4c17300779f68c228ff24ddf9068ff08046492db6e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  2.1.26
2
2
 
3
+ 2.1.29
4
+ : More code cleanup, help output improvements
5
+ : Line breaks in help output
6
+ : This release should fix an error on Ruby 2.7 in string.rb
7
+
3
8
  2.1.28
4
9
  : Default to 0 width, which makes the width the column width of the terminal
5
10
  : Don't save a --width setting to config, require that to be manually updated if desired
data/bin/mdless CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env ruby -W1
1
+ #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require 'mdless'
@@ -45,7 +45,8 @@ module CLIMarkdown
45
45
  default(:local_images, false)
46
46
  default(:remote_images, false)
47
47
  opts.on('-i', '--images=TYPE',
48
- 'Include [local|remote (both)|none] images in output (requires chafa or imgcat, default none).') do |type|
48
+ 'Include [local|remote (both)|none] images in output'\
49
+ ' (requires chafa or imgcat, default none).') do |type|
49
50
  if exec_available('imgcat') || exec_available('chafa')
50
51
  case type
51
52
  when /^(r|b|a)/i
@@ -62,7 +63,8 @@ module CLIMarkdown
62
63
  end
63
64
  end
64
65
 
65
- opts.on('-I', '--all-images', 'Include local and remote images in output (requires imgcat or chafa)') do
66
+ opts.on('-I', '--all-images', 'Include local and remote images in output'\
67
+ ' (requires imgcat or chafa)') do
66
68
  if exec_available('imgcat') || exec_available('chafa') # && ENV['TERM_PROGRAM'] == 'iTerm.app'
67
69
  MDLess.options[:local_images] = true
68
70
  MDLess.options[:remote_images] = true
@@ -124,9 +126,7 @@ module CLIMarkdown
124
126
  end
125
127
 
126
128
  MDLess.cols = MDLess.options[:width]
127
- if MDLess.cols == 0
128
- MDLess.cols = TTY::Screen.cols - 2
129
- end
129
+ MDLess.cols = TTY::Screen.cols - 2 if MDLess.cols.zero?
130
130
 
131
131
  default(:autolink, true)
132
132
  opts.on('--[no-]autolink', 'Convert bare URLs and emails to <links>') do |p|
@@ -145,8 +145,9 @@ module CLIMarkdown
145
145
  Process.exit 0
146
146
  end
147
147
 
148
- opts.on('--edit-theme', ["Open the default or specified theme file in #{ENV['EDITOR'] || 'default editor'}. ",
149
- "If theme doesn't exist, a new theme file will be populated and opened."].join) do
148
+ opts.on('--edit-theme', 'Open the default/specified theme in ' \
149
+ "#{File.basename(ENV['EDITOR']) || 'default editor'}, "\
150
+ 'populating a new theme if needed. Use after --theme in the command.') do
150
151
  raise 'No $EDITOR defined' unless ENV['EDITOR']
151
152
 
152
153
  theme = MDLess.options[:theme] =~ /default/ ? 'mdless' : MDLess.options[:theme]
@@ -157,7 +158,7 @@ module CLIMarkdown
157
158
  end
158
159
 
159
160
  default(:inline_footnotes, false)
160
- opts.on('--[no-]inline_footnotes',
161
+ opts.on('--[no-]inline-footnotes',
161
162
  'Display footnotes immediately after the paragraph that references them') do |p|
162
163
  MDLess.options[:inline_footnotes] = p
163
164
  end
@@ -174,8 +175,8 @@ module CLIMarkdown
174
175
 
175
176
  default(:links, :inline)
176
177
  opts.on('--links=FORMAT',
177
- 'Link style ([inline, reference, paragraph], default inline,
178
- "paragraph" will position reference links after each paragraph)') do |fmt|
178
+ 'Link style ([*inline, reference, paragraph],'\
179
+ ' "paragraph" will position reference links after each paragraph)') do |fmt|
179
180
  MDLess.options[:links] = case fmt
180
181
  when /^:?r/i
181
182
  :reference
data/lib/mdless/string.rb CHANGED
@@ -67,7 +67,7 @@ class ::String
67
67
  input.sub!(/(?i-m)^---[ \t]*\n(?<content>[\s\S]*?)\n[-.]{3}[ \t]*\n/m) do
68
68
  m = Regexp.last_match
69
69
  MDLess.log.info('Processing YAML Header')
70
- MDLess.meta = YAML.load(m['content']).map { |k, v| "#{k.downcase}" => v }
70
+ YAML.load(m['content']).map { |k, v| MDLess.meta[k.downcase] = v }
71
71
  lines = m['content'].split(/\n/)
72
72
  longest = lines.inject { |memo, word| memo.length > word.length ? memo : word }.length
73
73
  longest = longest < @cols ? longest + 1 : @cols
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.1.28'
4
+ VERSION = '2.1.29'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mdless
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.28
4
+ version: 2.1.29
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-05 00:00:00.000000000 Z
11
+ date: 2023-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redcarpet
@@ -158,7 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
- rubygems_version: 3.2.16
161
+ rubygems_version: 3.4.0.dev
162
162
  signing_key:
163
163
  specification_version: 4
164
164
  summary: A pager like less, but for Markdown files