macOS で Re:VIEW Template を使い PDF を出力する
TechBooster さんが公開されている Re:VIEW Template を使うと Re:VIEW 形式のファイルを PDF へ変換することが出来ます。
Docker コンテナとしても配布されているので、簡単に試せます。 macOS + Docker コンテナの利用方法をメモしておきます。 素晴らしいソフトウェアを公開してくださった TechBooster さんに感謝です!
検証環境¶
対象 | バージョン |
---|---|
macOS | Sequoia 15.4.1 |
Re:VIEW | 5.8 (5.9) |
デフォルトのコンテンツを Docker コンテナでビルドする¶
TechBooster さんの GitHub ページ にはデフォルトのコンテンツが用意されているので、それをそのまま手順に従ってビルドしてみます。 まず、Docker を利用する為に colima で仮想マシンを作成します。
colima start --cpu 2 --memory 4 --disk 10
TechBooster さんの GitHub ページ から Clone します。 現時点では Re:VIEW 5.8 をベースにしているようです。
git clone https://github.com/TechBooster/ReVIEW-Template.git
デフォルトで用意されているコンテンツをビルドしてみます。 Docker コンテナを実行するシェルスクリプトが用意されているので、これを実行するだけです。
cd ReVIEW-Template/
./build-in-docker.sh
実行ログ
% ./build-in-docker.sh
+ bundle install
Don't run Bundler as root. Installing your bundle as root will break this application for all non-root users on this machine.
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Fetching logger 1.7.0
Fetching concurrent-ruby 1.3.5
Installing logger 1.7.0
Fetching mime-types-data 3.2025.0429
Installing concurrent-ruby 1.3.5
Installing mime-types-data 3.2025.0429
Fetching rexml 3.4.1
Fetching rouge 4.5.2
Installing rexml 3.4.1
Fetching rubyzip 2.4.1
Installing rubyzip 2.4.1
Installing rouge 4.5.2
Fetching mime-types 3.6.2
Installing mime-types 3.6.2
Fetching playwright-ruby-client 1.51.0
Installing playwright-ruby-client 1.51.0
Fetching review 5.8.0
Installing review 5.8.0
Bundle complete! 4 Gemfile dependencies, 18 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from rubyzip:
RubyZip 3.0 is coming!
**********************
The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
* `Zip::File`
* `Zip::Entry`
* `Zip::InputStream`
* `Zip::OutputStream`
* `Zip::DOSTime`
Run your test suite with the `RUBYZIP_V3_API_WARN` environment
variable set to see warnings about usage of the old API. This will
help you to identify any changes that you need to make to your code.
See https://github.com/rubyzip/rubyzip/wiki/Updating-to-version-3.x for
more information.
Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.
+ rm -rf node_modules
+ npm install --unsafe-perm
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'review-template@0.0.2',
npm WARN EBADENGINE required: { node: '>=20.0.0', npm: '>=10.8.0' },
npm WARN EBADENGINE current: { node: 'v20.13.1', npm: '10.5.2' }
npm WARN EBADENGINE }
npm WARN deprecated osenv@0.1.5: This package is no longer supported.
npm WARN deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm WARN deprecated glob@7.1.7: Glob versions prior to v9 are no longer supported
npm WARN deprecated rimraf@2.6.3: Rimraf versions prior to v4 are no longer supported
added 125 packages, and audited 126 packages in 2s
9 packages are looking for funding
run `npm fund` for details
1 moderate severity vulnerability
To address all issues, run:
npm audit fix
Run `npm audit` for details.
npm notice
npm notice New major version of npm available! 10.5.2 -> 11.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
npm notice Run npm install -g npm@11.3.0 to update!
npm notice
> review-template@0.0.2 pdf
> grunt pdf
Running "clean:review" (clean) task
>> 0 paths cleaned.
Running "shell:preprocess" (shell) task
Running "shell:compile2pdf" (shell) task
review-pdfmaker config.yml
ℹ INFO compiling preface.tex
ℹ INFO compiling article.tex
ℹ INFO compiling contributors.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO uplatex -interaction=nonstopmode -file-line-error -halt-on-error __REVIEW_BOOK__.tex
ℹ INFO dvipdfmx -d 5 -z 9 __REVIEW_BOOK__.dvi
✔ SUCCESS built ReVIEW-Template.pdf
Done.
articles/ReVIEW-Template.pdf
が生成されました。 表示してみると以下のようになっていました。
Re:VIEW 5.9 を利用する¶
Re:VIEW 5.9 での変更点 を見るとバグ修正や機能追加が行われているようです。 しっかり確認したわけではありませんが、おそらく下記で Re:VIEW 5.9 が利用出来ると思います (多分)。
git clone https://github.com/TechBooster/ReVIEW-Template.git ReVIEW-Template-5.9
cd ReVIEW-Template-5.9
sed -i -e "s/review:5.8/review:5.9/g" build-in-docker.sh
sed -i -e "s/gem 'review', '5.8.0'/gem 'review', '5.9.0'/g" Gemfile
あとは Docker コンテナを使ってコンテンツをビルドします。
./build-in-docker.sh