mdless 1.0.9 → 1.0.15
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 +20 -8
- data/lib/mdless/theme.rb +2 -1
- data/lib/mdless/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 721c2ba19c8a2e2fe201254c4d988855d208d8c9e339a435897d5ed08696cc33
|
4
|
+
data.tar.gz: 0ffd801640a457d78ad076b05ddf44b2e735d8ca57928b94916db5c48f718663
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0380d39b79517ec7f1c278728b598c7780e5ccec1b1dd0fda74fd063430e20e18551a4d08bf6cc0d9091c68bb4ace60dac62ab5c78804dc10cca62cce81ab1b4'
|
7
|
+
data.tar.gz: 19e1df9c6bb6a7cf4289463f52e74bdad480b5d41a8f387145ca99b935068149d8cc53a8815f0fa1c0cffeee2ef280bfbe5a3c72062b5568ff375a71901d53ce
|
data/lib/mdless/converter.rb
CHANGED
@@ -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")
|
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
|
@@ -905,7 +911,7 @@ module CLIMarkdown
|
|
905
911
|
if File.exists?(File.expand_path(cli))
|
906
912
|
File.executable?(File.expand_path(cli))
|
907
913
|
else
|
908
|
-
system "which #{cli}", :out => File::NULL
|
914
|
+
system "which #{cli}", :out => File::NULL, :err => File::NULL
|
909
915
|
end
|
910
916
|
end
|
911
917
|
|
@@ -971,15 +977,21 @@ module CLIMarkdown
|
|
971
977
|
end
|
972
978
|
|
973
979
|
def which_pager
|
974
|
-
pagers = [ENV['GIT_PAGER'], ENV['PAGER']
|
975
|
-
|
976
|
-
|
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
|
+
|
977
989
|
pagers.select! do |f|
|
978
990
|
if f
|
979
991
|
if f.strip =~ /[ |]/
|
980
992
|
f
|
981
993
|
else
|
982
|
-
system "which #{f}", :out => File::NULL
|
994
|
+
system "which #{f}", :out => File::NULL, :err => File::NULL
|
983
995
|
end
|
984
996
|
else
|
985
997
|
false
|
data/lib/mdless/theme.rb
CHANGED
data/lib/mdless/version.rb
CHANGED
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.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-11-19 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: '
|
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: '
|
26
|
+
version: '13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rdoc
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,7 +80,7 @@ homepage: http://brettterpstra.com/project/mdless/
|
|
80
80
|
licenses:
|
81
81
|
- MIT
|
82
82
|
metadata: {}
|
83
|
-
post_install_message:
|
83
|
+
post_install_message:
|
84
84
|
rdoc_options:
|
85
85
|
- "--title"
|
86
86
|
- mdless
|
@@ -103,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
103
|
- !ruby/object:Gem::Version
|
104
104
|
version: '0'
|
105
105
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
-
signing_key:
|
106
|
+
rubygems_version: 3.1.4
|
107
|
+
signing_key:
|
108
108
|
specification_version: 4
|
109
109
|
summary: A pager like less, but for Markdown files
|
110
110
|
test_files: []
|