Sha256: 3cf7da25daf6c6b8aaa6ecb621bb7a783d7251361b3d8bd572e0e7b4d90995a4
Contents?: true
Size: 640 Bytes
Versions: 10
Compression:
Stored size: 640 Bytes
Contents
require 'fileutils' def epub!(args = nil, body = nil) out = api.format(api.args[0]) src = api.args[1] @cover = api.args[2] if ::File.directory?(src) files = ::Dir["#{src}/*"].grep /\.html$/ files = files.sort # why is this necessary now? cmd = "cat #{files.join(' ')} >TEMP.html" system(cmd) else raise "Not supported yet" end cmd = "ebook-convert " cmd << "TEMP.html #{out}.epub " cmd << "--cover #@cover " if @cover system(cmd) system("links -dump TEMP.html >/tmp/links.out") str = `wc -w /tmp/links.out` nw = str.split[0] puts "Approx words: #{nw}" # ::FileUtils.rm("TEMP.html") end
Version data entries
10 entries across 10 versions & 1 rubygems