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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b88b1ff3db3c2237990a2b89a55b786899ce121c267eb2abf4e324bcf7767b1c
4
- data.tar.gz: 0bcb27b8f902d1b16f416279d6ecc0593a9af3316f391a2820759f671dd337b4
3
+ metadata.gz: 7ad40bdc7ff7382f5205104ee7ef2983f1f04a97f9723723265e0efe1abf9ad9
4
+ data.tar.gz: b39655a8c2bcf3d619ab4dae8fe596bc40a160e22cfeef22d6677296e47f8c89
5
5
  SHA512:
6
- metadata.gz: 318b0750b896ae2f728b72d50d1191046c18678e73a6ff739d3d2458b8e781d10260e7d489821e7d61dc6d1f514d6bb3b7dc230deef9f173ea6edac5536093fb
7
- data.tar.gz: cb73b01a600283e2808c8d03c48d685c85575788d6ca5a5a3244f0e99aa2ceab9e956187faf09f16ba9481d9872385fc279aaea0a1da7d143de6ef263ca720a1
6
+ metadata.gz: c3bef39bca518259bd974527b6bd2f834a32db954bc4d6c91fdf2e0e312e705807aa78bd74c3d11f95eb96a510de8c72c493cab704829bea7df2bf38bfd0932f
7
+ data.tar.gz: 5f28c0eaccca18314dd0c6645e720c27221c81d68ad5500239c830f27ff0737da0e19c2ee75460058de5afe68fdd6361c778849a2da2b40d649a5d2878cea14e
@@ -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*|(.*?)\n([=-]+))$/i)
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
- line_no = '%2d: ' % (idx + 1)
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
- @output += headers_out.join("\n")
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.strip.split(/\n/).map {|p|
1032
+ out = @output.rstrip.split(/\n/).map {|p|
1032
1033
  p.wrap(@cols)
1033
1034
  }.join("\n")
1034
1035
 
@@ -1,3 +1,3 @@
1
1
  module CLIMarkdown
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'
3
3
  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: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra