#!/usr/bin/env ruby # PublishR -- Fast publishing for ebooks, paper and the web # Copyright (C) 2012 Michael Franzl # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) require 'publishr' if ARGV[0].nil? puts '' puts 'PublishR -- Fast publishing for ebooks and paper' puts 'Copyright (C) 2012 Michael Franzl' puts '' puts 'This program harnesses the publishing powers of Kramdown and Webgen and adds excellent ebook compilation algorithms to the mix.' puts '' puts "USAGE: publishr [name] [path_to_source_dir] [format] [path_to_converters]" puts '' puts " [name] is an unique string that identifies your project. Rendered files will be named after this." puts " [path_to_source_dir] directory must minimally contain: [cover.jpg, covertext.txt, frontmatter.txt, toc.txt, metadata.yml]. An skeleton directory containing examples is shipped with this library in lib/document_skeleton." puts " [format] must be {kindle, pdf, web}" puts " [path_to_converters] directory must contain the proprietary binary `kindlegen` (Google for it on Amazon) and the Free Software binary `jpg2ps`. They cannot be shipped with this program due to legal reasons." puts '' puts 'EXAMPLE: publishr kindle my/files/mybook epub path/to/converters' puts '' puts 'This library is still in it\'s Beta phase. I know that the documentation is not complete and you might run into errors. Please contact office@michaelfranzl.com if you need support.' puts '' puts 'This program is free software: you can redistribute it and/or modify' puts 'it under the terms of the GNU Affero General Public License as' puts 'published by the Free Software Foundation, either version 3 of the' puts 'License, or (at your option) any later version.' puts '' puts '' Process.exit end project = Publishr::Project.new(ARGV[0], File.join(Dir.pwd,ARGV[1]), File.join(Dir.pwd,ARGV[3])) case ARGV[2] when 'kindle' then project.make_kindle when 'pdf' then project.make_pdf when 'web' then project.make_web end #project.make_images_local("abc ![alt](http://www.sott.net/image/image/s1/33868/medium/sott_6percent_sm.jpg) \n ;lkjsdflk \n xxx ![alt](http://billgastro.com/images/header-en.png)")