LoginSignup
2
2

More than 5 years have passed since last update.

PHP: The "Right" Wayの日本語版PDF/EPUBを作成してみた

Last updated at Posted at 2014-03-30

ストレートフォワードにできるかと思ったら意外と苦難の道のりだった記録。

https://github.com/m-takagi/php-the-right-way
にある日本語版のレポジトリをcloneする。

を参考にコマンドを実行していくが、実はこの通りにやってもうまくいかないので以下の手順で。

Jekyll のインストール(インストール済みの場合は不要)

Xcode 5.1 and Command Line Developer Tools 5.1ではうまくbuildできなかったので rbenvを使った(rbenv の細かい使い方は省略)

jekyll.sh
rbenv local 2.1.0
gem install jekyll

手順

jekyllのサーバを起動しておく

jekyll.sh
jekyll build
jekyll server &

別のターミナルセッションでpandocを使ってEPUB/PDFを生成

epub.sh
$ pandoc -s -S --toc -c styles/all.css http://localhost:4000 -o php-the-right-way.epub
pandoc: Could not find image `http://localhost:4000/http://i.creativecommons.org/l/by-nc-sa/3.0/88x31.png', skipping...
pandoc: Could not find image `http://localhost:4000/https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png', skipping...
pdf.sh
 PATH=/usr/texbin:$PATH pandoc -s -S --toc -c styles/all.css http://localhost:4000 -o php-the-right-way-single-html.pdf  -V documentclass=ltjarticle --latex-engine=lualatex

今後の課題

  • 生成物をCC-By-SAでGitHubに公開する
  • EPUBを作るときにちょっとだけWarningがでるけど一応本文には影響なさそうなのでまだ直してない。
  • CI化しちゃったほうがメンテが楽かも

Special Thanks

PDFの作成方法はこちらを参考にさせていただきました。
http://qiita.com/sky_y/items/80bcd0f353ef5b8980ee

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2