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 +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/mdless/converter.rb +32 -26
- data/lib/mdless/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7be9ab30b8078d94b965d0f45094cd1b8e737210daaf1baa5030b54fac95c66a
|
4
|
+
data.tar.gz: aec7cf2e130cfd6d66b9482d417c1cb479e80c8e76c919f3b393524f68dc768d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66ebe7c5ee11c2266ecfb214058b71225c5842b81cf200e5c76854da9f0c3bdbd83fe34241a7dc7198b818203fb557cc0c4b4b642a95eb59e1190f7ae15d633d
|
7
|
+
data.tar.gz: 870ced12acb6fbbd687ea2159a7a88ac983e0fc058db27c367b6be626b778407a71a5b78c35e3775bbb08f6edc668821f02cf8826da46acef98df4ceb1abe41a
|
data/CHANGELOG.md
CHANGED
data/lib/mdless/converter.rb
CHANGED
@@ -114,11 +114,18 @@ module CLIMarkdown
|
|
114
114
|
exit
|
115
115
|
end
|
116
116
|
|
117
|
-
default(:width,
|
118
|
-
opts.on('-w', '--width=COLUMNS', 'Column width to format for (default: terminal width)') do |columns|
|
119
|
-
|
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.
|
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
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
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
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
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',
|
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
|
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 = []
|
data/lib/mdless/version.rb
CHANGED