Sha256: 7ad9e4bed673089510737a724b0253d984eab58fed6d6a2e4f2262709ffc6dd0
Contents?: true
Size: 631 Bytes
Versions: 8
Compression:
Stored size: 631 Bytes
Contents
require 'fileutils' 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
Version data entries
8 entries across 8 versions & 1 rubygems