mdless 1.0.8 → 1.0.14

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: 80c514e484cba1a3688a1bd9f12255b6e8ac6807ff21bb1880af2147257dc05a
4
- data.tar.gz: dd9f135de513cc0b3b28a499d1dd043d48bdb177c48f69bd1133fc56c9b185fb
3
+ metadata.gz: 23d22dc02d5520d977e864a119259663274fe8ecab3a30c96ac8248694809b3e
4
+ data.tar.gz: b99eaf3421cf4690351da9cc800c574883fab5aa40d4eb12e0ca847baece171c
5
5
  SHA512:
6
- metadata.gz: de96d5743f91a562b0f758baf5a80de41040506f33b0363303d1e12ed3e84c43a5b0c932f422823360fa470c73747cffccad318770363558142eabd3662f1d6a
7
- data.tar.gz: f52073c74448d6613c46fc7bb314024d5205d337957bcc2cf2541b49b6cf2c47338c64b19a81a8babb9fecaaaccd3c1f90a8c37e695b23ec4b456679cf889c2f
6
+ metadata.gz: 9842b3ff12ab38605472d36682608bebc36ec622961d33a9f889b6c5ad71e2891193a2161d4fea65da5d4e4baa897d16391acc79cd176d0ab57a10d99434b2f1
7
+ data.tar.gz: 93d12dd0625b16c842267090cdb80dbada9676913c170732ae8368007204706723cd810da786bd4f6692bcea39be8da5d92bbe81f2f133081a80f3dcb9f0dd5d
@@ -154,6 +154,7 @@ module CLIMarkdown
154
154
  $stderr.puts "No input"
155
155
  Process.exit 1
156
156
  end
157
+
157
158
  end
158
159
 
159
160
  def color(key)
@@ -209,6 +210,7 @@ module CLIMarkdown
209
210
  ]
210
211
  }
211
212
  end
213
+
212
214
  @headers
213
215
  end
214
216
 
@@ -285,6 +287,7 @@ module CLIMarkdown
285
287
  end
286
288
 
287
289
  def cleanup_tables(input)
290
+
288
291
  in_table = false
289
292
  header_row = false
290
293
  all_content = []
@@ -311,6 +314,7 @@ module CLIMarkdown
311
314
  end
312
315
 
313
316
  table = this_table.join("\n").strip
317
+
314
318
  begin
315
319
  formatted = MDTableCleanup.new(table)
316
320
  res = formatted.to_md
@@ -335,6 +339,7 @@ module CLIMarkdown
335
339
 
336
340
  def clean_markers(input)
337
341
  input.gsub!(/^(\e\[[\d;]+m)?[%~] ?/,'\1')
342
+ input.gsub!(/(\e\[[\d;]+m)?@@@(\e\[[\d;]+m)?$/,'')
338
343
  input
339
344
  end
340
345
 
@@ -450,7 +455,7 @@ module CLIMarkdown
450
455
  new_code_line,
451
456
  xc
452
457
  ].join
453
- end.join("\n") + "\n"
458
+ end.join("\n")
454
459
  end
455
460
 
456
461
  [
@@ -477,6 +482,7 @@ module CLIMarkdown
477
482
 
478
483
  def convert_markdown(input)
479
484
  @headers = get_headers(input)
485
+ input += "\n\n@@@"
480
486
  # yaml/MMD headers
481
487
  in_yaml = false
482
488
  if input.split("\n")[0] =~ /(?i-m)^---[ \t]*?(\n|$)/
@@ -797,8 +803,8 @@ module CLIMarkdown
797
803
 
798
804
  # Headlines
799
805
  @headers.each {|h|
800
- input.sub!(/^#{h[2]}/) do |m|
801
- pad = ""
806
+ input.sub!(/^#{Regexp.escape(h[2])}/m) do |m|
807
+ pad = ''
802
808
  ansi = ''
803
809
  case h[0].length
804
810
  when 1
@@ -932,9 +938,13 @@ module CLIMarkdown
932
938
  end
933
939
  end
934
940
 
935
- read_io.close
936
- write_io.write(text)
937
- write_io.close
941
+ begin
942
+ read_io.close
943
+ write_io.write(text)
944
+ write_io.close
945
+ rescue SystemCallError => e
946
+ exit 1
947
+ end
938
948
 
939
949
  _, status = Process.waitpid2(pid)
940
950
  status.success?
@@ -967,9 +977,15 @@ module CLIMarkdown
967
977
  end
968
978
 
969
979
  def which_pager
970
- pagers = [ENV['GIT_PAGER'], ENV['PAGER'],
971
- `git config --get-all core.pager || true`.split.first,
972
- 'bat', 'less', 'more', 'cat', 'pager']
980
+ pagers = [ENV['GIT_PAGER'], ENV['PAGER']]
981
+
982
+ if exec_available('git')
983
+ git_pager = `git config --get-all core.pager || true`.split.first
984
+ git_pager && pagers.push(git_pager)
985
+ end
986
+
987
+ pagers.concat(['bat', 'less', 'more', 'cat', 'pager'])
988
+
973
989
  pagers.select! do |f|
974
990
  if f
975
991
  if f.strip =~ /[ |]/
@@ -80,7 +80,8 @@ module CLIMarkdown
80
80
  'border' => 'd black',
81
81
  'header' => 'yellow',
82
82
  'divider' => 'b black',
83
- 'color' => 'white'
83
+ 'color' => 'white',
84
+ 'bg' => 'on_black'
84
85
  },
85
86
  'html' => {
86
87
  'brackets' => 'd yellow on_black',
@@ -1,3 +1,3 @@
1
1
  module CLIMarkdown
2
- VERSION = '1.0.8'
2
+ VERSION = '1.0.14'
3
3
  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: 1.0.8
4
+ version: 1.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-21 00:00:00.000000000 Z
11
+ date: 2020-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '13'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '13'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rdoc
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -103,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.0.6
106
+ rubygems_version: 3.0.3
107
107
  signing_key:
108
108
  specification_version: 4
109
109
  summary: A pager like less, but for Markdown files