mdless 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mdless/converter.rb +8 -7
- 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: 7ad40bdc7ff7382f5205104ee7ef2983f1f04a97f9723723265e0efe1abf9ad9
|
4
|
+
data.tar.gz: b39655a8c2bcf3d619ab4dae8fe596bc40a160e22cfeef22d6677296e47f8c89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c3bef39bca518259bd974527b6bd2f834a32db954bc4d6c91fdf2e0e312e705807aa78bd74c3d11f95eb96a510de8c72c493cab704829bea7df2bf38bfd0932f
|
7
|
+
data.tar.gz: 5f28c0eaccca18314dd0c6645e720c27221c81d68ad5500239c830f27ff0737da0e19c2ee75460058de5afe68fdd6361c778849a2da2b40d649a5d2878cea14e
|
data/lib/mdless/converter.rb
CHANGED
@@ -231,7 +231,8 @@ module CLIMarkdown
|
|
231
231
|
end
|
232
232
|
input.gsub!(/\r?\n/,"\n")
|
233
233
|
if @options[:list]
|
234
|
-
list_headers(input)
|
234
|
+
puts list_headers(input)
|
235
|
+
Process.exit 0
|
235
236
|
else
|
236
237
|
convert_markdown(input)
|
237
238
|
end
|
@@ -246,7 +247,8 @@ module CLIMarkdown
|
|
246
247
|
end
|
247
248
|
input.gsub!(/\r?\n/,"\n")
|
248
249
|
if @options[:list]
|
249
|
-
list_headers(input)
|
250
|
+
puts list_headers(input)
|
251
|
+
Process.exit 0
|
250
252
|
else
|
251
253
|
convert_markdown(input)
|
252
254
|
end
|
@@ -288,7 +290,7 @@ module CLIMarkdown
|
|
288
290
|
def get_headers(input)
|
289
291
|
unless @headers && @headers.length > 0
|
290
292
|
@headers = []
|
291
|
-
headers = input.scan(/^((?!#!)(\#{1,6})\s*([^#]+?)(?: #+)?\s*|(
|
293
|
+
headers = input.scan(/^((?!#!)(\#{1,6})\s*([^#]+?)(?: #+)?\s*|(\S.+)\n([=-]+))$/i)
|
292
294
|
|
293
295
|
headers.each {|h|
|
294
296
|
hlevel = 6
|
@@ -351,11 +353,10 @@ module CLIMarkdown
|
|
351
353
|
else
|
352
354
|
' '
|
353
355
|
end
|
354
|
-
|
355
|
-
headers_out.push(%Q{#{line_no}#{c(%i[x black])}#{".."*level}#{c(%i[x yellow])}#{subdoc}#{title.strip}#{xc}}.strip)
|
356
|
+
headers_out.push ('%3d: %s' % [idx + 1, c(%i[x black])+"."*level+c(%i[x yellow])+subdoc+title.strip+xc])
|
356
357
|
end
|
357
358
|
|
358
|
-
|
359
|
+
return headers_out.join("\n")
|
359
360
|
end
|
360
361
|
|
361
362
|
def highest_header(input)
|
@@ -1028,7 +1029,7 @@ module CLIMarkdown
|
|
1028
1029
|
end
|
1029
1030
|
|
1030
1031
|
def printout
|
1031
|
-
out = @output.
|
1032
|
+
out = @output.rstrip.split(/\n/).map {|p|
|
1032
1033
|
p.wrap(@cols)
|
1033
1034
|
}.join("\n")
|
1034
1035
|
|
data/lib/mdless/version.rb
CHANGED