mdless 1.0.16 → 1.0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32198570a885b3c03e6ec0e35c7d19f70f89330b9f3174270835a06f0efaec51
4
- data.tar.gz: add6fadf749c0415363c6853c10f7de58a1a41a658ad1b12f1c4a692db425cb1
3
+ metadata.gz: 9ac64b734fe42bba2b3b4ad71b9d660f8bb0b3e4dfed50b022386784c5fd7d49
4
+ data.tar.gz: 74d77256b4d9dba3e6aab1ff39f253b70ce8c0268f0ce7275f5622bce94d5ac9
5
5
  SHA512:
6
- metadata.gz: ab05974fb41187a1ba7b4fc95358ec65299a6c3496372bb7067e793bba209b66ec3a21daf0a78e133d63b26f6e93ee913420c968f3e746dcd147e4ea808f2a70
7
- data.tar.gz: 2e1954c54a87c356b2a42bb847ea6c738df729da0bce1feefc13e9fb6c22b1a858bc53bedb63375e90e44e7d15e2d44de8770db7d92e19ae9d1630e4d782d2f2
6
+ metadata.gz: 9d3358e267c7f3fa453bbe8fbcb73c6ab506b4d8bd2e275239ca407e7913a08cffdf4a04ad2d8c7a9c4152a08036cd47039aafa0b00beec85bffd6273b47d45b
7
+ data.tar.gz: f88b17617997dae9ffa4b7aec4bed55d02085af6625a45b331843a91fecad364619c6798f692b12c274c6a67831fa41835f39e3f4d66241e7a16615e4971775e
@@ -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
- Dir.mktmpdir do |dir|
857
- `curl -Sso #{img_path} 2> /dev/null`
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
@@ -1,3 +1,3 @@
1
1
  module CLIMarkdown
2
- VERSION = '1.0.16'
2
+ VERSION = '1.0.17'
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.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra