mdless 2.1.28 → 2.1.30

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: 7be9ab30b8078d94b965d0f45094cd1b8e737210daaf1baa5030b54fac95c66a
4
- data.tar.gz: aec7cf2e130cfd6d66b9482d417c1cb479e80c8e76c919f3b393524f68dc768d
3
+ metadata.gz: 29023fcb96091ac56b2c9d6b444006aa2df135bf40b785a0a7146fdbadfb1108
4
+ data.tar.gz: 2f64d0e7a96d3065e4d689b8f9841a354d6c9e9a88cef1a3cec9a5b73afcd85f
5
5
  SHA512:
6
- metadata.gz: 66ebe7c5ee11c2266ecfb214058b71225c5842b81cf200e5c76854da9f0c3bdbd83fe34241a7dc7198b818203fb557cc0c4b4b642a95eb59e1190f7ae15d633d
7
- data.tar.gz: 870ced12acb6fbbd687ea2159a7a88ac983e0fc058db27c367b6be626b778407a71a5b78c35e3775bbb08f6edc668821f02cf8826da46acef98df4ceb1abe41a
6
+ metadata.gz: 442f19f7fb3c7c773df2e1995d84bcbd9e27e5d172cfd8e681d76b1e1a4ac0b672162961872fefb7f08ee7b22a636a4c6e9cae75e6688df59ea50b1d89a15a92
7
+ data.tar.gz: c202bb1a4053b616efb5df0a3ceb5eb43304a98d2179c107e2b870adee41002923080728e6563fd8fe88330838ab1840652e2d7e45d412ca3eadfe0ea2fc7911
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  2.1.26
2
2
 
3
+ 2.1.30
4
+ : Error when $EDITOR is not defined
5
+
6
+ 2.1.29
7
+ : More code cleanup, help output improvements
8
+ : Line breaks in help output
9
+ : This release should fix an error on Ruby 2.7 in string.rb
10
+
3
11
  2.1.28
4
12
  : Default to 0 width, which makes the width the column width of the terminal
5
13
  : 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,16 +126,14 @@ 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|
133
133
  MDLess.options[:autolink] = p
134
134
  end
135
135
 
136
- opts.on('--config', "Open the config file in #{ENV['EDITOR'] || 'default editor'}") do
136
+ opts.on('--config', "Open the config file in default editor") do
137
137
  raise 'No $EDITOR defined' unless ENV['EDITOR']
138
138
 
139
139
  `#{ENV['EDITOR']} '#{File.expand_path('~/.config/mdless/config.yml')}'`
@@ -145,8 +145,8 @@ 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 default editor, '\
149
+ 'populating a new theme if needed. Use after --theme in the command.') do
150
150
  raise 'No $EDITOR defined' unless ENV['EDITOR']
151
151
 
152
152
  theme = MDLess.options[:theme] =~ /default/ ? 'mdless' : MDLess.options[:theme]
@@ -157,7 +157,7 @@ module CLIMarkdown
157
157
  end
158
158
 
159
159
  default(:inline_footnotes, false)
160
- opts.on('--[no-]inline_footnotes',
160
+ opts.on('--[no-]inline-footnotes',
161
161
  'Display footnotes immediately after the paragraph that references them') do |p|
162
162
  MDLess.options[:inline_footnotes] = p
163
163
  end
@@ -174,8 +174,8 @@ module CLIMarkdown
174
174
 
175
175
  default(:links, :inline)
176
176
  opts.on('--links=FORMAT',
177
- 'Link style ([inline, reference, paragraph], default inline,
178
- "paragraph" will position reference links after each paragraph)') do |fmt|
177
+ 'Link style ([*inline, reference, paragraph],'\
178
+ ' "paragraph" will position reference links after each paragraph)') do |fmt|
179
179
  MDLess.options[:links] = case fmt
180
180
  when /^:?r/i
181
181
  :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.30'
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.30
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