Sha256: b09c850ac7c0934ff12bd665ae611408d98e16b53e1663a8e94c40ece0e419a4
Contents?: true
Size: 695 Bytes
Versions: 6
Compression:
Stored size: 695 Bytes
Contents
require 'fileutils' module Calibre def epub!(args = nil, body = nil) out = _format(@_args[0]) src = @_args[1] @cover = @_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 end
Version data entries
6 entries across 6 versions & 1 rubygems