mdless 1.0.16 → 1.0.17
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 +13 -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: 9ac64b734fe42bba2b3b4ad71b9d660f8bb0b3e4dfed50b022386784c5fd7d49
|
4
|
+
data.tar.gz: 74d77256b4d9dba3e6aab1ff39f253b70ce8c0268f0ce7275f5622bce94d5ac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9d3358e267c7f3fa453bbe8fbcb73c6ab506b4d8bd2e275239ca407e7913a08cffdf4a04ad2d8c7a9c4152a08036cd47039aafa0b00beec85bffd6273b47d45b
|
7
|
+
data.tar.gz: f88b17617997dae9ffa4b7aec4bed55d02085af6625a45b331843a91fecad364619c6798f692b12c274c6a67831fa41835f39e3f4d66241e7a16615e4971775e
|
data/lib/mdless/converter.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'fileutils'
|
2
2
|
require 'yaml'
|
3
|
+
require 'fileutils'
|
3
4
|
|
4
5
|
module CLIMarkdown
|
5
6
|
class Converter
|
@@ -853,14 +854,19 @@ module CLIMarkdown
|
|
853
854
|
if img_path =~ /^http/ && @options[:remote_images]
|
854
855
|
|
855
856
|
if exec_available('chafa')
|
856
|
-
|
857
|
-
|
858
|
-
tmp_img = File.join(dir, File.basename(img_path))
|
859
|
-
img = `chafa "#{tmp_img}"`
|
860
|
-
pre = match[2].size > 0 ? " #{c(%i[d blue])}[#{match[2].strip}]\n" : ''
|
861
|
-
post = tail.size > 0 ? "\n #{c(%i[b blue])}-- #{tail} --" : ''
|
862
|
-
result = pre + img + post
|
857
|
+
if File.directory?('.mdless_tmp')
|
858
|
+
FileUtils.rm_r '.mdless_tmp', force: true
|
863
859
|
end
|
860
|
+
Dir.mkdir('.mdless_tmp')
|
861
|
+
Dir.chdir('.mdless_tmp')
|
862
|
+
`curl -SsO #{img_path} 2> /dev/null`
|
863
|
+
tmp_img = File.basename(img_path)
|
864
|
+
img = `chafa "#{tmp_img}"`
|
865
|
+
pre = match[2].size > 0 ? " #{c(%i[d blue])}[#{match[2].strip}]\n" : ''
|
866
|
+
post = tail.size > 0 ? "\n #{c(%i[b blue])}-- #{tail} --" : ''
|
867
|
+
result = pre + img + post
|
868
|
+
Dir.chdir('..')
|
869
|
+
FileUtils.rm_r '.mdless_tmp', force: true
|
864
870
|
else
|
865
871
|
if exec_available('imgcat')
|
866
872
|
begin
|
data/lib/mdless/version.rb
CHANGED