- 環境 : Windows10 64bit
使うもの
Asciidoctor
Asciidoctorは 高速な テキストプロセッサで AsciiDoc をHTML5, DocBook 5(4.5)や他のフォーマットに変換するツールチェインを配布しています. AsciidoctorはRubyで書かれており, RubyGemとしてパッケージされ, RubyGems.org で配布されています.
asciidoctor/README-jp.adoc at master · asciidoctor/asciidoctor
Asciidoctor PDF
Asciidoctor PDF is currently alpha software. While the converter handles most AsciiDoc content, there’s still work needed to fill in gaps where conversion is incomplete, incorrect or not implemented.
How to Convert AsciiDoc to PDF with Asciidoctor | Asciidoctor
asciidoctor-pdf-cjk
和英が混在しているときのPDFの崩れを修正してくれるらしい。
chloerei/asciidoctor-pdf-cjk
WindowsでAsciidocからPDFを作成する(Asciidoctor PDF v1.5.0 alpha 13) - Qiita
Rubygemをインストールする
$ ruby -v
ruby 2.5.1p57 (2018-03-29 revision 63029) [x64-mingw32]
$ gem -v
2.7.6
Asciidoctor と Asciidoctor PDF をインストールする
$ gem install asciidoctor
Successfully installed asciidoctor-1.5.7.1
Parsing documentation for asciidoctor-1.5.7.1
Installing ri documentation for asciidoctor-1.5.7.1
Done installing documentation for asciidoctor after 4 seconds
1 gem installed
$ gem install --pre asciidoctor-pdf
invalid options: -ri
(invalid options are ignored)
Successfully installed ttfunk-1.5.1
Successfully installed pdf-core-0.7.0
Successfully installed prawn-2.2.2
Successfully installed prawn-table-0.2.2
Successfully installed Ascii85-1.0.3
Successfully installed ruby-rc4-0.1.5
Successfully installed hashery-2.1.2
Successfully installed afm-0.2.2
Successfully installed pdf-reader-2.1.0
Successfully installed prawn-templates-0.1.1
Successfully installed public_suffix-3.0.3
Successfully installed addressable-2.5.2
Successfully installed css_parser-1.6.0
Successfully installed prawn-svg-0.27.1
Successfully installed prawn-icon-1.3.0
Successfully installed safe_yaml-1.0.4
Successfully installed thread_safe-0.3.6
Successfully installed polyglot-0.3.5
Successfully installed treetop-1.5.3
Successfully installed asciidoctor-pdf-1.5.0.alpha.16
Parsing documentation for ttfunk-1.5.1
Installing ri documentation for ttfunk-1.5.1
Parsing documentation for pdf-core-0.7.0
Installing ri documentation for pdf-core-0.7.0
Parsing documentation for prawn-2.2.2
Installing ri documentation for prawn-2.2.2
<省略>
Parsing documentation for asciidoctor-pdf-1.5.0.alpha.16
Installing ri documentation for asciidoctor-pdf-1.5.0.alpha.16
Done installing documentation for ttfunk, pdf-core, prawn, prawn-table, Ascii85, ruby-rc4, hashery, afm, pdf-reader, prawn-templates, public_suffix, addressable, css_parser, prawn-svg, prawn-icon, safe_yaml, thread_safe, polyglot, treetop, asciidoctor-pdf after 17 seconds
20 gems installed
$ gem install asciidoctor-pdf-cjk
Successfully installed asciidoctor-pdf-cjk-0.1.3
Parsing documentation for asciidoctor-pdf-cjk-0.1.3
Installing ri documentation for asciidoctor-pdf-cjk-0.1.3
Done installing documentation for asciidoctor-pdf-cjk after 0 seconds
1 gem installed
AsciiDocのファイルをPDFにする
$ cd {AsciiDocのファイルがある場所}
$ asciidoctor-pdf -r asciidoctor-pdf-cjk {AsciiDoc}.asciidoc
同じ場所に拡張子が .pdf になったPDFファイルができる。