softcover を使ってみた
今回は softcover を使い方でも説明しますかね。
日本語の資料がなかったので、簡単ですが、使ってみましょう。
softcover とは?
SoftcoverはMarkdownフォーマット使ってHTML/ePub/Mobi/PDFなど各種フォーマットへ変換してくれるソフトウェアです。Webでのプレビュー機能もあって、どんどん文章が書けてしまうはずです。
英語ドキュメント http://manual.softcover.io/book
ってことで実際に使ってみますか!!!
Rubyの環境は以下のとおりです。
$ ruby -v ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0] $ gem --version 2.2.2
$ gem install softcover
これだけでsoftcoverコマンドが使えるようになります。
$ softcover new example_book $ cd example_book $ ls Book.txt chapters epub images media README.md config html latex_styles
最初にPDFを作りましょうか。
今使えるのを確認するためにsoftcover checkを使います。
$ softcover check Checking Softcover dependencies... Checking for LaTeX... Found Checking for GhostScript... Found Checking for ImageMagick... Found Checking for Node.js... Missing Checking for PhantomJS... Found Checking for Inkscape... Missing Checking for Calibre... Missing Checking for KindleGen... Missing Checking for Java... Found Checking for zip... Found Checking for EpubCheck... Missing
PDFは作れそうです。
$ softcover build:pdf Building PDF... (省略) $ open ebooks/example_book.pdf
次にEpubを作りましょうか。
$ softcover check Checking Softcover dependencies... Checking for LaTeX... Found Checking for GhostScript... Found Checking for ImageMagick... Found Checking for Node.js... Missing Checking for PhantomJS... Found Checking for Inkscape... Missing Checking for Calibre... Missing Checking for KindleGen... Missing Checking for Java... Found Checking for zip... Found Checking for EpubCheck... Missing
EpubCheck... Missing だからダメじゃん\(^o^)/
あと、ドキュメントにも必要なのはPhantomJSとInkscapeが必要って書かれてる。
There are no dependencies for building EPUB books unless the source contains mathematics, so if you want you can remove the math from the generated book and build the EPUB immediately. Otherwise, you’ll need to install PhantomJS and Inkscape. Building the EPUB is easy once any necessary dependencies are installed:
ってことで、EpubCheckとImageMagickをインストールします。
$ wget https://github.com/IDPF/epubcheck/releases/download/v3.0/epubcheck-3.0.zip $ unzip epubcheck-3.0.zip $ sudo mv epubcheck-3.0 /usr/local/bin/
[Mac版]
https://inkscape.org/ja/download/mac-os/
[XQuartz]も必要らしい
http://xquartz.macosforge.org/landing/
2つ入れて、softcover checkを行う。
$ softcover check Checking Softcover dependencies... Checking for LaTeX... Found Checking for GhostScript... Found Checking for ImageMagick... Found Checking for Node.js... Missing Checking for PhantomJS... Found Checking for Inkscape... Found Checking for Calibre... Missing Checking for KindleGen... Missing Checking for Java... Found Checking for zip... Found Checking for EpubCheck... Found
準備は整った(`・ω・´)ゞ
$ softcover build:epub Building EPUB... (省略) $ open ebooks/example_book.epub
PDFとEpub版が作成できました!!!
良かった良かった。