-
-
Notifications
You must be signed in to change notification settings - Fork 0
Vivliostyle CLI v3.0 new spec
Shinyu Murakami edited this page Feb 7, 2021
·
4 revisions
このドラフト案は、v3.0.0-pre.4 当時に書かれたものです。その後、https://github.com/vivliostyle/vivliostyle-cli/issues/86 の議論で仕様が改良されてv3.0が完成してます。最新版のREADME をご覧ください。
Revise the Vivliostyle CLI v3.0 spec to solve the issues found in the previous V3.0.0-pre-releases.
(これまでのv3.0プレリリース版で見つかった問題を解決するため、CLI v3.0の仕様を改訂)
vivliostyle --help will show:
Usage: vivliostyle [options] [command]
Options:
-v, --version output the version number
-h, --help display help for command
Commands:
build build and create PDF file
preview launch preview server
init create vivliostyle config
help [command] display help for command
vivliostyle build --help will show:
Usage: vivliostyle build [options] <input>
build and create PDF file
Options:
-b, --book input is a webbook (index.html or publication.json manifest),
unzipped EPUB (root dir, or package.opf file).
-c, --config <config_file> path to vivliostyle.config.js [vivliostyle.config.js]
-o, --output <output_file> specify output file path [<title>.pdf]
-T, --theme <theme> theme path or package name
-s, --size <size> output page size, default to the page size specified in CSS,
or Letter if not specified.
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal, ledger
custom (comma separated): 182mm,257mm or 8.5in,11in
-p, --press-ready make generated PDF compatible with press ready PDF/X-1a [false]
--gray-scale with press-ready option, use Grayscale instead of CMYK color
-f, --format <output_format> specify output format (pdf, webbook) [pdf]
--generate-webbook generate a webbook (with publication.json manifest)
default to true if input is Markdown (.md)
-n, --no-generate-webbook no generate webbook (use existing publication.json and html files)
-N, --no-output no output (only generate webbook)
--title <title> title
--author <author> author
-l, --language <language> language (en, ja, etc.), default to undefined
--verbose verbose log output
--dist-dir <directory> dist dir for webbook where publication.json and other files are generated.
default to undefined (use current dir as webbook root dir).
-t, --timeout <seconds> timeout limit (seconds) for waiting Vivliostyle process [60]
--no-sandbox launch chrome without sandbox. use this option when ECONNREFUSED error occurred.
--executable-chromium <path> specify a path of executable Chrome (or Chromium) you installed
-h, --help display help for command
-
-b, --book(was in v2) restored -
-t→-T(for compat with v2,-tis for timeout) -
-t(short option for timeout, was in v2) restored -
--out-file→--output(for compat with v2), remove-d, --out-dir - add
--gray-scale- Resolve #44 Add --grayscale option
- add
--generate-webbookand-n, --no-generate-webbook - add
-N, --no-output -
--languagedefault to undefined, changed from "en" - add
-l(short option for language) -
--dist-dirdefault to undefined (use current dir as webbook root dir), changed from.vivliostyle - change pub-manifest file name and spec
manifest.json(Readium Web Publication Manifest) →publication.json(W3C Publication Manifest)
vivliostyle preview --help will show:
Usage: vivliostyle preview [options] <input>
launch preview server
Options:
-b, --book input is a webbook (index.html or publication.json manifest),
unzipped EPUB (root dir, or package.opf file).
-c, --config <config_file> path to vivliostyle.config.js [vivliostyle.config.js]
-T, --theme <theme> theme path or package name
-s, --size <size> output page size, default to the page size specified in CSS,
or Letter if not specified.
preset: A5, A4, A3, B5, B4, JIS-B5, JIS-B4, letter, legal, ledger
custom (comma separated): 182mm,257mm or 8.5in,11in
--title <title> title
--author <author> author
-l, --language <language> language (en, ja, etc.), default to undefined
--verbose verbose log output
--no-sandbox launch chrome without sandbox (use this option to avoid ECONNREFUSED error)
--executable-chromium <path> specify a path of executable Chrome(Chromium) you installed
-h, --help display help for command
-
-t→-T(see same as build option) - add
-l(short option for language)
vivliostyle init --help will show:
Usage: vivliostyle init [options]
create vivliostyle config file
Options:
--title <title> title
--author <author> author
-l, --language <language> language (en, ja, etc.), default to undefined
-T, --theme <theme> theme path or package name
-h, --help display help for command
-
-t→-T(for compat with v2,-tis for timeout) - remove
-s, --size- We should leave it undefined in the config because the page size specified in CSS should be honored
Current spec: https://github.com/vivliostyle/vivliostyle-cli/blob/41aee32e19e16ad33779d02bae6bdc7eb7c808c7/src/commands/init.ts#L46-L68
Change to:
const vivliostyleConfig = `module.exports = {
title: '${ cliFlags.title || 'Principia'}', // populated into 'manifest.json', default to 'title' of the first entry or 'name' in 'package.json'.
author: '${cliFlags.author || 'Isaac Newton'}', // default to 'author' in 'package.json' or undefined
language: '${cliFlags.language || 'la'}', // default to undefined
// size: 'A4', // default to the page size specified in CSS, or Letter if not specified
theme: '${cliFlags.theme || ''}', // .css or local dir or npm package. default to undefined
entry: [ // **required field**
// 'introduction.md', // 'title' is automatically guessed from the file (frontmatter > first heading)
// {
// path: 'epigraph.md',
// title: 'おわりに', // title can be overwritten (entry > file),
// theme: '@vivliostyle/theme-whatever' // theme can be set indivisually. default to root 'theme'
// },
// 'glossary.html' // html is also acceptable
], // 'entry' can be 'string' or 'object' if there's only single markdown file
// entryContext: './manuscripts', // default to '.' (relative to 'vivliostyle.config.js')
// outFile: './output.pdf', // path to generated pdf file. cannot be used with outDir.
// outDir: './output', // path to the directory where the generated pdf is located. filename is picked from 'title'. cannot be used with outFile.
// toc: true, // whether generate TOC in index.html for webbook
// format: 'pdf', // reserved for future usage. default to 'pdf'.
// distDir: './webbook', // default to undefined (use current dir as webbook root dir)
};
`;- change
languagethat was "default to 'en'" to "default to undefined"- see build options
- change
sizeto not specified, and add description- see build options
- change
distDir- see build options
- change
tocthat was "whether generate and include toc.html or not (does not affect manifest.json), default to 'false'. if 'string' given, use it as a custom toc.html."- Resolve #66 toc.html generation option
- Input as URL
-
buildcan be omitted when<input>is specified in command line- As an HTML-to-PDF tool, CLI syntax like
vivliostyle example.html -o example.pdfis preferable
- As an HTML-to-PDF tool, CLI syntax like
- EPUB出力サポート
- Resolve #55 EPUB support
- Themes関連の見直し
- Sass (.scss)対応
- カスタマイズしやすく
- Preview に Vivliostyle Viewer を使用
- watchモード、インクリメンタルビルド
- Cover画像の扱い
- tocでindex.html生成の見直し