mdless 2.1.27 → 2.1.28

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: e2ff8e5c411b2dca9194b32e684495ee5a43376da035e427365c7c8c305abc3d
4
- data.tar.gz: 7de7a979e5aeeb61cb92d3e0dfd1166aec6ac63f446422592a3a005cd6ec8755
3
+ metadata.gz: 7be9ab30b8078d94b965d0f45094cd1b8e737210daaf1baa5030b54fac95c66a
4
+ data.tar.gz: aec7cf2e130cfd6d66b9482d417c1cb479e80c8e76c919f3b393524f68dc768d
5
5
  SHA512:
6
- metadata.gz: 0b458218411a7a4952652aa807c2b98cb2ea298b3f3051b4743acf1afb670c914b690e7ce97e5185cb0a86c83bdf2b3c552d7b2d8075454324ce39fef9629f9c
7
- data.tar.gz: d44ebccb7cb2230713c7250e0dcc904961b0f7b9f0fd2f146cbaa24ca7580a748e4282dd23c8e367f6d1bb5176c4c0efa08457cc7bde02481b66c5db722bdde9
6
+ metadata.gz: 66ebe7c5ee11c2266ecfb214058b71225c5842b81cf200e5c76854da9f0c3bdbd83fe34241a7dc7198b818203fb557cc0c4b4b642a95eb59e1190f7ae15d633d
7
+ data.tar.gz: 870ced12acb6fbbd687ea2159a7a88ac983e0fc058db27c367b6be626b778407a71a5b78c35e3775bbb08f6edc668821f02cf8826da46acef98df4ceb1abe41a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  2.1.26
2
2
 
3
+ 2.1.28
4
+ : Default to 0 width, which makes the width the column width of the terminal
5
+ : Don't save a --width setting to config, require that to be manually updated if desired
6
+
3
7
  2.1.27
4
8
  : Error handling when YAML can't be processed
5
9
 
@@ -114,11 +114,18 @@ module CLIMarkdown
114
114
  exit
115
115
  end
116
116
 
117
- default(:width, TTY::Screen.cols)
118
- opts.on('-w', '--width=COLUMNS', 'Column width to format for (default: terminal width)') do |columns|
119
- MDLess.options[:width] = columns.to_i
117
+ default(:width, 0)
118
+ opts.on('-w', '--width=COLUMNS', 'Column width to format for (default: 0 -> terminal width)') do |columns|
119
+ columns = columns.to_i
120
120
  cols = TTY::Screen.cols
121
- MDLess.options[:width] = cols if MDLess.options[:width] > cols
121
+ MDLess.cols = columns > 2 ? columns - 2 : cols
122
+
123
+ MDLess.options[:width] = columns > cols ? cols - 2 : columns - 2
124
+ end
125
+
126
+ MDLess.cols = MDLess.options[:width]
127
+ if MDLess.cols == 0
128
+ MDLess.cols = TTY::Screen.cols - 2
122
129
  end
123
130
 
124
131
  default(:autolink, true)
@@ -195,26 +202,26 @@ module CLIMarkdown
195
202
  end
196
203
 
197
204
  MDLess.options[:taskpaper] = if MDLess.options[:taskpaper]
198
- case MDLess.options[:taskpaper].to_s
199
- when /^[ty1]/
200
- true
201
- when /^a/
202
- :auto
203
- else
204
- false
205
- end
206
- else
207
- false
208
- end
205
+ case MDLess.options[:taskpaper].to_s
206
+ when /^[ty1]/
207
+ true
208
+ when /^a/
209
+ :auto
210
+ else
211
+ false
212
+ end
213
+ else
214
+ false
215
+ end
209
216
  opts.on('--taskpaper=OPTION', 'Highlight TaskPaper format (true|false|auto)') do |tp|
210
217
  MDLess.options[:taskpaper] = case tp
211
- when /^[ty1]/
212
- true
213
- when /^a/
214
- :auto
215
- else
216
- false
217
- end
218
+ when /^[ty1]/
219
+ true
220
+ when /^a/
221
+ :auto
222
+ else
223
+ false
224
+ end
218
225
  end
219
226
 
220
227
  default(:transclude, true)
@@ -223,7 +230,8 @@ module CLIMarkdown
223
230
  end
224
231
 
225
232
  default(:update_config, false)
226
- opts.on('--update-config', '--update_config', 'Update the configuration file with new keys and current command line options') do
233
+ opts.on('--update-config', '--update_config',
234
+ 'Update the configuration file with new keys and current command line options') do
227
235
  MDLess.options[:update_config] = true
228
236
  end
229
237
 
@@ -264,15 +272,13 @@ module CLIMarkdown
264
272
  opts.delete(:section)
265
273
  opts.delete(:update_config)
266
274
  opts.delete(:update_theme)
267
- opts.delete(:width)
275
+ opts[:width] = 0
268
276
  opts = opts.keys.map(&:to_s).sort.map { |k| [k.to_sym, opts[k.to_sym]] }.to_h
269
277
  f.puts YAML.dump(opts)
270
278
  warn "Config file saved to #{config}"
271
279
  end
272
280
  end
273
281
 
274
- MDLess.cols = MDLess.options[:width] - 2
275
-
276
282
  @output = ''
277
283
  @headers = []
278
284
  @setheaders = []
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CLIMarkdown
4
- VERSION = '2.1.27'
4
+ VERSION = '2.1.28'
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.27
4
+ version: 2.1.28
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra