mirror of
https://github.com/lise-henry/crowbook
synced 2024-09-12 15:50:40 +02:00
Remove crowbook-intl dependencies
This commit is contained in:
parent
298005f08d
commit
ae4d6f2442
187
Cargo.lock
generated
187
Cargo.lock
generated
@ -8,15 +8,6 @@ version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.3"
|
||||
@ -47,7 +38,7 @@ version = "0.12.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -113,7 +104,7 @@ checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
|
||||
dependencies = [
|
||||
"hermit-abi 0.1.19",
|
||||
"libc",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -221,7 +212,7 @@ dependencies = [
|
||||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -306,7 +297,7 @@ dependencies = [
|
||||
"entities",
|
||||
"memchr",
|
||||
"once_cell",
|
||||
"regex 1.9.3",
|
||||
"regex",
|
||||
"shell-words",
|
||||
"slug",
|
||||
"syntect",
|
||||
@ -322,7 +313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8"
|
||||
dependencies = [
|
||||
"encode_unicode",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"unicode-width",
|
||||
"windows-sys 0.45.0",
|
||||
@ -394,14 +385,12 @@ dependencies = [
|
||||
"clap 4.3.21",
|
||||
"comrak",
|
||||
"console",
|
||||
"crowbook-intl",
|
||||
"crowbook-intl-runtime",
|
||||
"crowbook-text-processing",
|
||||
"epub-builder",
|
||||
"html-escape",
|
||||
"hyphenation",
|
||||
"indicatif",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"mime_guess",
|
||||
"numerals",
|
||||
@ -414,38 +403,18 @@ dependencies = [
|
||||
"textwrap 0.16.0",
|
||||
"upon",
|
||||
"uuid",
|
||||
"walkdir 2.3.3",
|
||||
"walkdir",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crowbook-intl"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04db38a154dbc8411c49a39b0c514fc29951deaf179bebee581ceb9f72a52c85"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11",
|
||||
"regex 0.2.11",
|
||||
"walkdir 1.0.7",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crowbook-intl-runtime"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "62cf6ec512b4d7fb7d8683efa703b17e5b8f5e24a9eb7ec9fb92237f039d941c"
|
||||
dependencies = [
|
||||
"lazy_static 0.2.11",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crowbook-text-processing"
|
||||
version = "1.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a749441fe0b30ba727c31367438f7e2f001e6ec23d3c5f417834f2fa17098a27"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0",
|
||||
"regex 1.9.3",
|
||||
"lazy_static",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -539,7 +508,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"
|
||||
dependencies = [
|
||||
"bit-set",
|
||||
"regex 1.9.3",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -599,11 +568,11 @@ version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "759c97c1e17c55525b57192c06a267cda0ac5210b222d6b82189a2338fa1c13d"
|
||||
dependencies = [
|
||||
"aho-corasick 1.0.3",
|
||||
"aho-corasick",
|
||||
"bstr",
|
||||
"fnv",
|
||||
"log",
|
||||
"regex 1.9.3",
|
||||
"regex",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -614,7 +583,7 @@ checksum = "93e3af942408868f6934a7b85134a3230832b9977cf66125df2f9edcfce4ddcc"
|
||||
dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
"ignore",
|
||||
"walkdir 2.3.3",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -712,13 +681,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dbe7873dab538a9a44ad79ede1faf5f30d49f9a5c883ddbab48bce81b64b7492"
|
||||
dependencies = [
|
||||
"globset",
|
||||
"lazy_static 1.4.0",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"memchr",
|
||||
"regex 1.9.3",
|
||||
"same-file 1.0.6",
|
||||
"thread_local 1.1.7",
|
||||
"walkdir 2.3.3",
|
||||
"regex",
|
||||
"same-file",
|
||||
"thread_local",
|
||||
"walkdir",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
@ -816,22 +785,6 @@ dependencies = [
|
||||
"wasm-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "kernel32-sys"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||
dependencies = [
|
||||
"winapi 0.2.8",
|
||||
"winapi-build",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
@ -1195,7 +1148,7 @@ dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.3.1",
|
||||
"rdrand",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1214,7 +1167,7 @@ dependencies = [
|
||||
"rand_os",
|
||||
"rand_pcg",
|
||||
"rand_xorshift",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1268,7 +1221,7 @@ checksum = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1282,7 +1235,7 @@ dependencies = [
|
||||
"libc",
|
||||
"rand_core 0.4.2",
|
||||
"rdrand",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1344,29 +1297,16 @@ dependencies = [
|
||||
"bitflags 1.3.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
|
||||
dependencies = [
|
||||
"aho-corasick 0.6.10",
|
||||
"memchr",
|
||||
"regex-syntax 0.5.6",
|
||||
"thread_local 0.3.6",
|
||||
"utf8-ranges",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.9.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a"
|
||||
dependencies = [
|
||||
"aho-corasick 1.0.3",
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-automata",
|
||||
"regex-syntax 0.7.4",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1375,18 +1315,9 @@ version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69"
|
||||
dependencies = [
|
||||
"aho-corasick 1.0.3",
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
"regex-syntax 0.7.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.5.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
|
||||
dependencies = [
|
||||
"ucd-util",
|
||||
"regex-syntax",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1413,7 +1344,7 @@ dependencies = [
|
||||
"itertools",
|
||||
"once_cell",
|
||||
"quote 1.0.32",
|
||||
"regex 1.9.3",
|
||||
"regex",
|
||||
"rust-i18n-extract",
|
||||
"rust-i18n-macro",
|
||||
"rust-i18n-support",
|
||||
@ -1432,7 +1363,7 @@ dependencies = [
|
||||
"ignore",
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"regex 1.9.3",
|
||||
"regex",
|
||||
"rust-i18n-support",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -1517,16 +1448,6 @@ version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d931a44fdaa43b8637009e7632a02adc4f2b2e0733c08caa4cf00e8da4a117a7"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "same-file"
|
||||
version = "1.0.6"
|
||||
@ -1691,11 +1612,11 @@ dependencies = [
|
||||
"once_cell",
|
||||
"onig",
|
||||
"plist",
|
||||
"regex-syntax 0.7.4",
|
||||
"regex-syntax",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"walkdir 2.3.3",
|
||||
"walkdir",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
@ -1771,15 +1692,6 @@ dependencies = [
|
||||
"syn 2.0.28",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "1.1.7"
|
||||
@ -1860,12 +1772,6 @@ version = "2.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a"
|
||||
|
||||
[[package]]
|
||||
name = "ucd-util"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abd2fc5d32b590614af8b0a20d837f32eca055edd0bbead59a9cfe80858be003"
|
||||
|
||||
[[package]]
|
||||
name = "unicase"
|
||||
version = "2.6.0"
|
||||
@ -1916,12 +1822,6 @@ dependencies = [
|
||||
"unicode-width",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7fcfc827f90e53a02eaef5e535ee14266c1d569214c6aa70133a624d8a3164ba"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-width"
|
||||
version = "0.1.6"
|
||||
@ -1955,24 +1855,13 @@ version = "0.9.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "1.0.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "bb08f9e670fab86099470b97cd2b252d6527f0b3cc1401acdb595ffc9dd288ff"
|
||||
dependencies = [
|
||||
"kernel32-sys",
|
||||
"same-file 0.1.3",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "walkdir"
|
||||
version = "2.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698"
|
||||
dependencies = [
|
||||
"same-file 1.0.6",
|
||||
"same-file",
|
||||
"winapi-util",
|
||||
]
|
||||
|
||||
@ -2036,12 +1925,6 @@ version = "0.2.87"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.2.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
@ -2052,12 +1935,6 @@ dependencies = [
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-build"
|
||||
version = "0.1.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
@ -2070,7 +1947,7 @@ version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
|
||||
dependencies = [
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -11,7 +11,6 @@ keywords = ["markdown", "book"]
|
||||
categories = ["command-line-utilities", "text-processing"]
|
||||
license = "LGPL-2.1+"
|
||||
publish = true
|
||||
build = "build.rs"
|
||||
autobins = false
|
||||
rust-version = "1.58"
|
||||
|
||||
@ -42,9 +41,6 @@ default = ["binary", "syntect"]
|
||||
binary = ["clap", "simplelog", "tempfile", "console", "indicatif", "textwrap"]
|
||||
nightly = ["punkt", "hyphenation"]
|
||||
|
||||
[build-dependencies]
|
||||
crowbook-intl = "0.2"
|
||||
|
||||
[dependencies]
|
||||
rust-i18n = "2"
|
||||
html-escape = "0.2"
|
||||
@ -58,7 +54,6 @@ base64 = "0.21"
|
||||
rayon = "1.6"
|
||||
crowbook-text-processing = "^1.1.1"
|
||||
lazy_static = "1"
|
||||
crowbook-intl-runtime = "0.1"
|
||||
numerals = "0.1"
|
||||
epub-builder = "^0.7.1"
|
||||
log = "0.4"
|
||||
|
44
build.rs
44
build.rs
@ -1,44 +0,0 @@
|
||||
use crowbook_intl::{Extractor, Localizer};
|
||||
|
||||
use std::env;
|
||||
use std::path::Path;
|
||||
|
||||
fn main() {
|
||||
println!("cargo:rerun-if-changed=build.rs");
|
||||
println!("cargo:rerun-if-changed=lang/fr.po");
|
||||
// Extract and localize src/lib
|
||||
let mut extractor = Extractor::new();
|
||||
extractor
|
||||
.add_messages_from_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/src/lib"))
|
||||
.unwrap();
|
||||
// Uncomment to update crowbook.pot
|
||||
//extractor.write_pot_file(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/lib/crowbook.pot")).unwrap();
|
||||
|
||||
let mut localizer = Localizer::new(&extractor);
|
||||
localizer
|
||||
.add_lang(
|
||||
"fr",
|
||||
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/lib/fr.po")),
|
||||
)
|
||||
.unwrap();
|
||||
let dest_path = Path::new(&env::var("OUT_DIR").unwrap()).join("localize_macros.rs");
|
||||
localizer.write_macro_file(dest_path).unwrap();
|
||||
|
||||
// Extract and localize src/bin
|
||||
let mut extractor = Extractor::new();
|
||||
extractor
|
||||
.add_messages_from_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/src/bin"))
|
||||
.unwrap();
|
||||
// Uncomment to update crowbook.pot
|
||||
//extractor.write_pot_file(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/bin/crowbook.pot")).unwrap();
|
||||
|
||||
let mut localizer = Localizer::new(&extractor);
|
||||
localizer
|
||||
.add_lang(
|
||||
"fr",
|
||||
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/lang/bin/fr.po")),
|
||||
)
|
||||
.unwrap();
|
||||
let dest_path = Path::new(&env::var("OUT_DIR").unwrap()).join("localize_macros_bin.rs");
|
||||
localizer.write_macro_file(dest_path).unwrap();
|
||||
}
|
152
lang/lib/en.yml
152
lang/lib/en.yml
@ -158,3 +158,155 @@ zipper:
|
||||
command_result_err: "could not open result of command '%{command}'"
|
||||
copy_error: "error copying file '%{file}'"
|
||||
command_no_success: "%{command} didn't return succesfully"
|
||||
opt:
|
||||
metadata: Metadata
|
||||
add_metadata: Additional metadata
|
||||
output_opt: Output options
|
||||
output: Specify a list of output formats to render
|
||||
render: Rendering options
|
||||
special: Special options
|
||||
html: HTML options
|
||||
html_single: Standalone HTML options
|
||||
html_dir: Multifile HTML options
|
||||
html_if: Interactive fiction HTML options
|
||||
epub: EPUB options
|
||||
tex: LaTeX options
|
||||
resources: Resources options
|
||||
input: Input options
|
||||
crowbook: Crowbook options
|
||||
deprecated: Deprecated options
|
||||
author: Author of the book
|
||||
title: Title of the book
|
||||
lang: Language of the book
|
||||
subject: Subject of the book (used for EPUB metadata)
|
||||
description: Description of the book (used for EPUB metadata)
|
||||
cover: Path to the cover of the book
|
||||
subtitle: Subtitle of the book
|
||||
license: License of the book
|
||||
version: Version of the book
|
||||
date: Date the book was revised
|
||||
autograph: An autograph
|
||||
output_epub: Output file name for EPUB rendering
|
||||
output_html: Output file name for HTML rendering
|
||||
output_tex: Output file name for LaTeX rendering
|
||||
output_pdf: Output file name for PDF rendering
|
||||
output_if: Output file name for HTML interactive fiction rendering
|
||||
output_html_dir: Output directory name for HTML rendering
|
||||
output_base_path: Directory where those output files will we written
|
||||
rendering_highlight: "If/how highligh code blocks. Possible values: \"syntect\" (default, performed at runtime), \"highlight.js\" (HTML-only, uses Javascript), \"none\""
|
||||
rendering_highlight_theme: "Theme for syntax highlighting (if rendering.highlight is set to 'syntect')"
|
||||
rendering_initials: "Use initials ('lettrines') for first letter of a chapter"
|
||||
inline_toc: Display a table of content in the document
|
||||
toc_name: Name of the table of contents if it is displayed in document
|
||||
num_depth: "The maximum heading levels that should be numbered (0: no numbering, 1: only chapters, ..., 6: all)"
|
||||
part: "How to call parts (or 'books', 'episodes', ...)"
|
||||
chapter: How to call chapters
|
||||
chapter_template: Naming scheme of chapters, for TOC
|
||||
part_template: Naming scheme of parts, for TOC
|
||||
roman_numeral_parts: If set to true, display part number with roman numerals
|
||||
roman_numeral_chapters: If set to true, display chapter number with roman numerals
|
||||
reset_counter: If set to true, reset chapter number at each part
|
||||
import: Import another book configuration file
|
||||
html_icon: Path to an icon to be used for the HTML files(s)
|
||||
html_header: Custom header to display at the beginning of html file(s)
|
||||
html_footer: Custom footer to display at the end of HTML file(s)
|
||||
html_css: Path of a stylesheet for HTML rendering
|
||||
html_css_add: Some inline CSS added to the stylesheet template
|
||||
css_colors: Path of a stylesheet for the colors for HTML
|
||||
html_js: Path of a javascript file
|
||||
css_print: Path of a media print stylesheet for HTML rendering
|
||||
highlight_js: Set another highlight.js version than the bundled one
|
||||
highlight_css: Set another highlight.js CSS theme than the default one
|
||||
side_notes: Display footnotes as side notes in HTML/Epub (experimental)
|
||||
nb_spaces: Replace unicode non breaking spaces with HTML entities and CSS
|
||||
nb_spaces_tex: Replace unicode non breaking spaces with TeX code
|
||||
one_chapter: Display only one chapter at a time (with a button to display all)
|
||||
single_html: Path of an HTML template for standalone HTML
|
||||
single_js: Path of a javascript file
|
||||
if_js: Path of a javascript file
|
||||
if_new_turn: Javascript code that will be run at the beginning of each segment
|
||||
if_end_turn: Javascript code that will be run at the end of each segment
|
||||
if_new_game: "Javascript code that will be run at the beginning of a 'game'"
|
||||
html_chapter_template: Inline template for HTML chapter formatting
|
||||
html_part_template: Inline template for HTML part formatting
|
||||
html_dir_template: Path of a HTML template for multifile HTML
|
||||
epub_ver: EPUB version to generate (2 or 3)
|
||||
epub_css: Path of a stylesheet for EPUB
|
||||
epub_css_add: Inline CSS added to the EPUB stylesheet template
|
||||
chapter_xhtml: Path of an xhtml template for each chapter
|
||||
titlepage_xhtml: Path of an xhtml template for the title page
|
||||
epub_toc: "Add 'Title' and (if set) 'Cover' in the EPUB table of contents"
|
||||
tex_links: Add foontotes to URL of links so they are readable when printed
|
||||
tex_command: LaTeX command to use for generating PDF
|
||||
tex_tmpl: Path of a LaTeX template file
|
||||
tex_tmpl_add: Inline code added in the LaTeX template
|
||||
tex_class: LaTeX class to use
|
||||
tex_title: If true, generate a title with \\maketitle
|
||||
tex_paper_size: Specifies the size of the page
|
||||
tex_margin_left: "Specifies left margin (note that with book class left and right margins are reversed for odd pages, thus the default value is 1.5cm for book class and 2cm else)"
|
||||
tex_margin_right: "Specifies right margin(note that with book class left and right margins are reversed for odd pages, thus the default value is 2.5cm for book class and 2cm else)"
|
||||
tex_margin_top: Specifies top margin
|
||||
tex_margin_bottom: Specifies bottom margin
|
||||
tex_font_size: Specify latex font size (in pt, 10 (default), 11, or 12 are accepted)
|
||||
tex_hyperref: If disabled, don't try to find references inside the document
|
||||
tex_stdpage: "If set to true, use 'stdpage' package to format a manuscript according to standards"
|
||||
rs_files: Whitespace-separated list of files to embed in e.g. EPUB file; useful for including e.g. fonts
|
||||
rs_out: Paths where additional resources should be copied in the EPUB file or HTML directory
|
||||
rs_base: Path where to find resources (in the source tree). By default, links and images are relative to the Markdown file. If this is set, it will be to this path.
|
||||
rs_links: Set base path but only for links. Useless if resources.base_path is set
|
||||
rs_img: Set base path but only for images. Useless if resources.base_path is set
|
||||
rs_base_files: Set base path but only for additional files. Useless if resources.base_path is set.
|
||||
rs_tmpl: Set base path but only for templates files. Useless if resources.base_path is set
|
||||
autoclean: Toggle typographic cleaning of input markdown according to lang
|
||||
smart: If enabled, tries to replace vertical quotations marks to curly ones
|
||||
dashes: "If enabled, replaces '--' to en dash ('–') and '---' to em dash ('—')"
|
||||
guillemets: "If enabled, replaces '<<' and '>>' to french \"guillemets\" ('«' and '»')"
|
||||
superscript: "If enabled, allow support for superscript and subscript using respectively foo^up^ and bar~down~ syntax."
|
||||
yaml: Enable/disable inline YAML blocks to override options set in config file
|
||||
html_as_text: Consider HTML blocks as text. This avoids having <foo> being considered as HTML and thus ignored.
|
||||
files_mean_chapters: "Consider that a new file is always a new chapter, even if it does not include heading (default: only for numbered chapters)"
|
||||
tmp_dir: "Path where to create a temporary directory (default: uses result from Rust's std::env::temp_dir())"
|
||||
zip: "Command to use to zip files (for EPUB/ODT)"
|
||||
tex_theme: "If set, set theme for syntax highlighting for LaTeX/PDF output (syntect only)"
|
||||
html_theme: If set, set theme for syntax highlighting for HTML output (syntect only)
|
||||
epub_theme: If set, set theme for syntax highlighting for EPUB output (syntect only)
|
||||
renamed: Renamed
|
||||
removed: Removed
|
||||
ill_formatted: "Ill-formatted OPTIONS string: unrecognized type %{opption_type}'"
|
||||
expected_string: "Expected a String as a key, found %{key}"
|
||||
expected_strings: "Expected only strings in the list for key %{key}, found %{value}"
|
||||
expected_string_value: "Expected a string as value for key %{key}, found %{value}"
|
||||
format_not_recognized: "The output format %{format} for key %{key} is not recognized"
|
||||
expected_list: "Expected a list as value for key %{key}, found %{value}"
|
||||
invalid_utf8: "'%{value}''s path contains invalid UTF-8 code"
|
||||
expected_char: "could not parse '%{value}' as a char: does not contain exactly one char"
|
||||
expected_char_value: "expected a string as value containing a char for key '%{key}', found %{value}"
|
||||
expected_bool: "expected a boolean as value for key '%{key}', found %{value}"
|
||||
expected_int: "expected an integer as value for key '%{key}', found %{value}"
|
||||
expected_float: "could not parse '%{value}' as a float for key '%{key}'"
|
||||
warn_deprecated: "'%{old_key}' has been deprecated, you should now use '%{new_key}'"
|
||||
err_deprecated: "key '%{key}' has been deprecated."
|
||||
unrecognized: "unrecognized key '%{key}'"
|
||||
one_yaml: "value '%{value}' for key '%{key}' does not contain one and only one YAML value"
|
||||
yaml_value: "could not parse '%{value}' as a valid YAML value"
|
||||
miss_key: "option '%{key}' is not present"
|
||||
curr_dir: could not get current directory
|
||||
not_set: not set
|
||||
option_description_md: |
|
||||
"- **`%{key}`**"
|
||||
"- **type**: %{option_type}"
|
||||
"- **default value**: `%{default}`"
|
||||
"- %{comment}\n""
|
||||
ty:
|
||||
type: "type:"
|
||||
default: "default:"
|
||||
bool: boolean
|
||||
float: float
|
||||
int: integer
|
||||
char: char
|
||||
str: string
|
||||
path: path
|
||||
tpl: template path
|
||||
meta: metadata
|
||||
strvec: list of strings
|
||||
alias: DEPRECATED
|
||||
|
@ -1 +0,0 @@
|
||||
include!(concat!(env!("OUT_DIR"), "/localize_macros_bin.rs"));
|
@ -1,5 +1,4 @@
|
||||
#[macro_use]
|
||||
mod localize_macros;
|
||||
#[cfg(feature = "binary")]
|
||||
mod helpers;
|
||||
#[cfg(feature = "binary")]
|
||||
|
@ -7,6 +7,7 @@ use std::collections::HashMap;
|
||||
use std::env;
|
||||
use std::path::{Path, PathBuf};
|
||||
use yaml_rust::{Yaml, YamlLoader};
|
||||
use rust_i18n::t;
|
||||
|
||||
lazy_static! {
|
||||
static ref OPTIONS: String = format!("\
|
||||
@ -202,133 +203,133 @@ proofread.repetitions.threshold:float:2.0 # {removed}
|
||||
output.odt:path # {removed}
|
||||
|
||||
",
|
||||
metadata = lformat!("Metadata"),
|
||||
metadata2 = lformat!("Additional metadata"),
|
||||
output_opt = lformat!("Output options"),
|
||||
output = lformat!("Specify a list of output formats to render"),
|
||||
render_opt = lformat!("Rendering options"),
|
||||
special_ops = lformat!("Special option"),
|
||||
html_opt = lformat!("HTML options"),
|
||||
html_single_opt = lformat!("Standalone HTML options"),
|
||||
html_dir_opt = lformat!("Multifile HTML options"),
|
||||
html_if_opt = lformat!("Interactive fiction HTML options"),
|
||||
epub_opt = lformat!("EPUB options"),
|
||||
tex_opt = lformat!("LaTeX options"),
|
||||
rs_opt = lformat!("Resources option"),
|
||||
input_opt = lformat!("Input options"),
|
||||
crowbook_opt = lformat!("Crowbook options"),
|
||||
deprecated_opt = lformat!("Deprecated options"),
|
||||
metadata = t!("opt.metadata"),
|
||||
metadata2 = t!("opt.add_metadata"),
|
||||
output_opt = t!("opt.output_opt"),
|
||||
output = t!("opt.output"),
|
||||
render_opt = t!("opt.render"),
|
||||
special_ops = t!("opt.special"),
|
||||
html_opt = t!("opt.html"),
|
||||
html_single_opt = t!("opt.html_single"),
|
||||
html_dir_opt = t!("opt.html_dir"),
|
||||
html_if_opt = t!("opt.html_if"),
|
||||
epub_opt = t!("opt.epub"),
|
||||
tex_opt = t!("opt.tex"),
|
||||
rs_opt = t!("opt.resources"),
|
||||
input_opt = t!("opt.input"),
|
||||
crowbook_opt = t!("opt.crowbook"),
|
||||
deprecated_opt = t!("opt.deprecated"),
|
||||
|
||||
author = lformat!("Author of the book"),
|
||||
title = lformat!("Title of the book"),
|
||||
lang = lformat!("Language of the book"),
|
||||
subject = lformat!("Subject of the book (used for EPUB metadata)"),
|
||||
description = lformat!("Description of the book (used for EPUB metadata)"),
|
||||
cover = lformat!("Path to the cover of the book"),
|
||||
author = t!("opt.author"),
|
||||
title = t!("opt.title"),
|
||||
lang = t!("opt.lang"),
|
||||
subject = t!("opt.subject"),
|
||||
description = t!("opt.description"),
|
||||
cover = t!("opt.cover"),
|
||||
|
||||
subtitle = lformat!("Subtitle of the book"),
|
||||
license = lformat!("License of the book. This information will be displayed on PDF documents"),
|
||||
version = lformat!("Version of the book"),
|
||||
date = lformat!("Date the book was revised"),
|
||||
autograph = lformat!("An autograph"),
|
||||
subtitle = t!("opt.subtitle"),
|
||||
license = t!("opt.license"),
|
||||
version = t!("opt.version"),
|
||||
date = t!("opt.date"),
|
||||
autograph = t!("opt.autograph"),
|
||||
|
||||
output_epub = lformat!("Output file name for EPUB rendering"),
|
||||
output_html = lformat!("Output file name for HTML rendering"),
|
||||
output_tex = lformat!("Output file name for LaTeX rendering"),
|
||||
output_pdf = lformat!("Output file name for PDF rendering"),
|
||||
output_if = lformat!("Output file name for HTML (interactive fiction) rendering"),
|
||||
output_html_dir = lformat!("Output directory name for HTML rendering"),
|
||||
output_base_path = lformat!("Directory where those output files will we written"),
|
||||
output_epub = t!("opt.output_epub"),
|
||||
output_html = t!("opt.output_html"),
|
||||
output_tex = t!("opt.output_tex"),
|
||||
output_pdf = t!("opt.output_pdf"),
|
||||
output_if = t!("opt.output_if"),
|
||||
output_html_dir = t!("opt.output_html_dir"),
|
||||
output_base_path = t!("opt.output_base_path"),
|
||||
|
||||
rendering_highlight = lformat!("If/how highligh code blocks. Possible values: \"syntect\" (default, performed at runtime), \"highlight.js\" (HTML-only, uses Javascript), \"none\""),
|
||||
rendering_highlight_theme = lformat!("Theme for syntax highlighting (if rendering.highlight is set to 'syntect')"),
|
||||
rendering_initials = lformat!("Use initials ('lettrines') for first letter of a chapter"),
|
||||
inline_toc = lformat!("Display a table of content in the document"),
|
||||
toc_name = lformat!("Name of the table of contents if it is displayed in document"),
|
||||
num_depth = lformat!("The maximum heading levels that should be numbered (0: no numbering, 1: only chapters, ..., 6: all)"),
|
||||
part = lformat!("How to call parts (or 'books', 'episodes', ...)"),
|
||||
chapter = lformat!("How to call chapters"),
|
||||
chapter_template = lformat!("Naming scheme of chapters, for TOC"),
|
||||
part_template = lformat!("Naming scheme of parts, for TOC"),
|
||||
roman_numerals_parts = lformat!("If set to true, display part number with roman numerals"),
|
||||
roman_numerals_chapters = lformat!("If set to true, display chapter number with roman numerals"),
|
||||
reset_counter = lformat!("If set to true, reset chapter number at each part"),
|
||||
rendering_highlight = t!("opt.rendering_highlight"),
|
||||
rendering_highlight_theme = t!("opt.rendering_highlight_theme"),
|
||||
rendering_initials = t!("opt.rendering_initials"),
|
||||
inline_toc = t!("opt.inline_toc"),
|
||||
toc_name = t!("opt.toc_name"),
|
||||
num_depth = t!("opt.num_depth"),
|
||||
part = t!("opt.part"),
|
||||
chapter = t!("opt.chapter"),
|
||||
chapter_template = t!("opt.chapter_template"),
|
||||
part_template = t!("opt.part_template"),
|
||||
roman_numerals_parts = t!("opt.roman_numeral_parts"),
|
||||
roman_numerals_chapters = t!("opt.roman_numerals_chapters"),
|
||||
reset_counter = t!("opt.reset_counter"),
|
||||
|
||||
import_config = lformat!("Import another book configuration file"),
|
||||
import_config = t!("opt.import"),
|
||||
|
||||
html_icon = lformat!("Path to an icon to be used for the HTML files(s)"),
|
||||
html_header = lformat!("Custom header to display at the beginning of html file(s)"),
|
||||
html_footer = lformat!("Custom footer to display at the end of HTML file(s)"),
|
||||
html_css = lformat!("Path of a stylesheet for HTML rendering"),
|
||||
html_css_add = lformat!("Some inline CSS added to the stylesheet template"),
|
||||
css_colors = lformat!("Path of a stylesheet for the colors for HTML"),
|
||||
html_js = lformat!("Path of a javascript file"),
|
||||
css_print = lformat!("Path of a media print stylesheet for HTML rendering"),
|
||||
highlight_js = lformat!("Set another highlight.js version than the bundled one"),
|
||||
highlight_css = lformat!("Set another highlight.js CSS theme than the default one"),
|
||||
side_notes = lformat!("Display footnotes as side notes in HTML/Epub (experimental)"),
|
||||
nb_spaces = lformat!("Replace unicode non breaking spaces with HTML entities and CSS"),
|
||||
nb_spaces_tex = lformat!("Replace unicode non breaking spaces with TeX code"),
|
||||
html_icon = t!("opt.html_icon"),
|
||||
html_header = t!("opt.html_header"),
|
||||
html_footer = t!("opt.html_footer"),
|
||||
html_css = t!("opt.html_css"),
|
||||
html_css_add = t!("opt.html_css_add"),
|
||||
css_colors = t!("opt.css_colors"),
|
||||
html_js = t!("opt.html_js"),
|
||||
css_print = t!("opt.css_print"),
|
||||
highlight_js = t!("opt.highlight_js"),
|
||||
highlight_css = t!("opt.highlight_css"),
|
||||
side_notes = t!("opt.side_notes"),
|
||||
nb_spaces = t!("opt.nb_spaces"),
|
||||
nb_spaces_tex = t!("opt.nb_spaces_tex"),
|
||||
|
||||
one_chapter = lformat!("Display only one chapter at a time (with a button to display all)"),
|
||||
single_html = lformat!("Path of an HTML template for standalone HTML"),
|
||||
single_js = lformat!("Path of a javascript file"),
|
||||
if_js = lformat!("Path of a javascript file"),
|
||||
if_new_turn = lformat!("Javascript code that will be run at the beginning of each segment"),
|
||||
if_end_turn = lformat!("Javascript code that will be run at the end of each segment"),
|
||||
if_new_game = lformat!("Javascript code that will be run at the beginning of a 'game'"),
|
||||
one_chapter = t!("opt.one_chapter"),
|
||||
single_html = t!("opt.single_html"),
|
||||
single_js = t!("opt.single_js"),
|
||||
if_js = t!("opt.if_js"),
|
||||
if_new_turn = t!("opt.if_new_turn"),
|
||||
if_end_turn = t!("opt.if_end_turn"),
|
||||
if_new_game = t!("opt.if_new_game"),
|
||||
|
||||
html_chapter_template = lformat!("Inline template for HTML chapter formatting"),
|
||||
html_part_template = lformat!("Inline template for HTML part formatting"),
|
||||
html_dir_template = lformat!("Path of a HTML template for multifile HTML"),
|
||||
html_chapter_template = t!("opt.html_chapter_template"),
|
||||
html_part_template = t!("opt.html_part_template"),
|
||||
html_dir_template = t!("opt.html_dir_template"),
|
||||
|
||||
epub_ver = lformat!("EPUB version to generate (2 or 3)"),
|
||||
epub_css = lformat!("Path of a stylesheet for EPUB"),
|
||||
epub_css_add = lformat!("Inline CSS added to the EPUB stylesheet template"),
|
||||
chapter_xhtml = lformat!("Path of an xhtml template for each chapter"),
|
||||
titlepage_xhtml = lformat!("Path of an xhtml template for the title page"),
|
||||
epub_toc = lformat!("Add 'Title' and (if set) 'Cover' in the EPUB table of contents"),
|
||||
epub_ver = t!("opt.epub_ver"),
|
||||
epub_css = t!("opt.epub_css"),
|
||||
epub_css_add = t!("opt.epub_css_add"),
|
||||
chapter_xhtml = t!("opt.chapter_xhtml"),
|
||||
titlepage_xhtml = t!("opt.titlepage_xhtml"),
|
||||
epub_toc = t!("opt.epub_toc"),
|
||||
|
||||
tex_links = lformat!("Add foontotes to URL of links so they are readable when printed"),
|
||||
tex_command = lformat!("LaTeX command to use for generating PDF"),
|
||||
tex_tmpl = lformat!("Path of a LaTeX template file"),
|
||||
tex_tmpl_add = lformat!("Inline code added in the LaTeX template"),
|
||||
tex_class = lformat!("LaTeX class to use"),
|
||||
tex_title = lformat!("If true, generate a title with \\maketitle"),
|
||||
tex_paper_size = lformat!("Specifies the size of the page."),
|
||||
tex_margin_left = lformat!("Specifies left margin (note that with book class left and right margins are reversed for odd pages, thus the default value is 1.5cm for book class and 2cm else)"),
|
||||
tex_margin_right = lformat!("Specifies right margin(note that with book class left and right margins are reversed for odd pages, thus the default value is 2.5cm for book class and 2cm else)"),
|
||||
tex_margin_top = lformat!("Specifies top margin"),
|
||||
tex_margin_bottom = lformat!("Specifies left margin"),
|
||||
tex_font_size = lformat!("Specify latex font size (in pt, 10 (default), 11, or 12 are accepted)"),
|
||||
tex_hyperref = lformat!("If disabled, don't try to find references inside the document"),
|
||||
tex_stdpage = lformat!("If set to true, use 'stdpage' package to format a manuscript according to standards"),
|
||||
tex_links = t!("opt.tex_links"),
|
||||
tex_command = t!("opt.tex_command"),
|
||||
tex_tmpl = t!("opt.tex_tmpl"),
|
||||
tex_tmpl_add = t!("opt.tex_tmpl_add"),
|
||||
tex_class = t!("opt.tex_class"),
|
||||
tex_title = t!("opt.tex_title"),
|
||||
tex_paper_size = t!("opt.tex_paper_size"),
|
||||
tex_margin_left = t!("opt.tex_margin_left"),
|
||||
tex_margin_right = t!("opt.tex_margin_right"),
|
||||
tex_margin_top = t!("opt.tex_margin_top"),
|
||||
tex_margin_bottom = t!("opt.tex_margin_bottom"),
|
||||
tex_font_size = t!("opt.tex_font_size"),
|
||||
tex_hyperref = t!("opt.tex_hyperref"),
|
||||
tex_stdpage = t!("opt.tex_stdpage"),
|
||||
|
||||
rs_files = lformat!("Whitespace-separated list of files to embed in e.g. EPUB file; useful for including e.g. fonts"),
|
||||
rs_out = lformat!("Paths where additional resources should be copied in the EPUB file or HTML directory"),
|
||||
rs_base = lformat!("Path where to find resources (in the source tree). By default, links and images are relative to the Markdown file. If this is set, it will be to this path."),
|
||||
rs_links = lformat!("Set base path but only for links. Useless if resources.base_path is set"),
|
||||
rs_img = lformat!("Set base path but only for images. Useless if resources.base_path is set"),
|
||||
rs_base_files = lformat!("Set base path but only for additional files. Useless if resources.base_path is set."),
|
||||
rs_tmpl = lformat!("Set base path but only for templates files. Useless if resources.base_path is set"),
|
||||
rs_files = t!("opt.rs_files"),
|
||||
rs_out = t!("opt.rs_out"),
|
||||
rs_base = t!("opt.rs_base"),
|
||||
rs_links = t!("opt.rs_links"),
|
||||
rs_img = t!("opt.rs_img"),
|
||||
rs_base_files = t!("opt.rs_base_files"),
|
||||
rs_tmpl = t!("opt.rs_tmpl"),
|
||||
|
||||
autoclean = lformat!("Toggle typographic cleaning of input markdown according to lang"),
|
||||
smart_quotes = lformat!("If enabled, tries to replace vertical quotations marks to curly ones"),
|
||||
ligature_dashes = lformat!("If enabled, replaces '--' to en dash ('–') and '---' to em dash ('—')"),
|
||||
ligature_guillemets = lformat!("If enabled, replaces '<<' and '>>' to french \"guillemets\" ('«' and '»')"),
|
||||
superscript = lformat!("If enabled, allow support for superscript and subscript using respectively foo^up^ and bar~down~ syntax."),
|
||||
yaml = lformat!("Enable inline YAML blocks to override options set in config file"),
|
||||
html_as_text = lformat!("Consider HTML blocks as text. This avoids having <foo> being considered as HTML and thus ignored."),
|
||||
files_mean_chapters = lformat!("Consider that a new file is always a new chapter, even if it does not include heading (default: only for numbered chapters)"),
|
||||
tmp_dir = lformat!("Path where to create a temporary directory (default: uses result from Rust's std::env::temp_dir())"),
|
||||
zip = lformat!("Command to use to zip files (for EPUB/ODT)"),
|
||||
autoclean = t!("opt.autoclean"),
|
||||
smart_quotes = t!("opt.smart"),
|
||||
ligature_dashes = t!("opt.dashes"),
|
||||
ligature_guillemets = t!("opt.guillemets"),
|
||||
superscript = t!("opt.superscript"),
|
||||
yaml = t!("opt.yaml"),
|
||||
html_as_text = t!("opt.html_as_text"),
|
||||
files_mean_chapters = t!("opt.files_mean_chapters"),
|
||||
tmp_dir = t!("opt.tmp_dir"),
|
||||
zip = t!("opt.zip"),
|
||||
|
||||
tex_theme = lformat!("If set, set theme for syntax highlighting for LaTeX/PDF output (syntect only)"),
|
||||
html_theme = lformat!("If set, set theme for syntax highlighting for HTML output (syntect only)"),
|
||||
epub_theme = lformat!("If set, set theme for syntax highlighting for EPUB output (syntect only)"),
|
||||
tex_theme = t!("opt.tex_theme"),
|
||||
html_theme = t!("opt.html_theme"),
|
||||
epub_theme = t!("opt.epub_theme"),
|
||||
|
||||
renamed = lformat!("Renamed"),
|
||||
removed = lformat!("Removed"),
|
||||
renamed = t!("opt.renamed"),
|
||||
removed = t!("opt.removed"),
|
||||
);
|
||||
}
|
||||
|
||||
@ -430,9 +431,8 @@ impl BookOptions {
|
||||
_ => {
|
||||
panic!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Ill-formatted OPTIONS string: unrecognized type \
|
||||
'{option_type}'",
|
||||
t!(
|
||||
"opt.ill_forrmatted",
|
||||
option_type = option_type.unwrap()
|
||||
)
|
||||
)
|
||||
@ -473,7 +473,7 @@ impl BookOptions {
|
||||
} else {
|
||||
return Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!("Expected a String as a key, found {:?}", key),
|
||||
t!("opt.expected_string", key = format!("{:?}", key)),
|
||||
));
|
||||
};
|
||||
|
||||
@ -487,10 +487,10 @@ impl BookOptions {
|
||||
} else {
|
||||
return Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"Expected only string in the list for key {}, found {:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_strings",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
));
|
||||
}
|
||||
@ -505,8 +505,8 @@ impl BookOptions {
|
||||
.map_err(|_| {
|
||||
Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"The output format {format} for key {key} is not recognized",
|
||||
t!(
|
||||
"opt.format_not_recognized",
|
||||
key = key,
|
||||
format = format
|
||||
),
|
||||
@ -518,10 +518,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"Expected a list as value for key {}, found {:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_list",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -532,11 +532,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"Expected a string as value for key {}, found \
|
||||
{:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_string_value",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -549,9 +548,8 @@ impl BookOptions {
|
||||
let file = tmp.to_str().ok_or_else(|| {
|
||||
Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"'{value}''s path contains invalid \
|
||||
UTF-8 code",
|
||||
t!(
|
||||
"opt.invalid_utf8",
|
||||
value = &value
|
||||
),
|
||||
)
|
||||
@ -566,11 +564,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected a string as value for key '{}', found \
|
||||
{:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_string_value",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -581,10 +578,8 @@ impl BookOptions {
|
||||
if chars.len() != 1 {
|
||||
return Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"could not parse '{value}' as a \
|
||||
char: does not contain exactly one \
|
||||
char",
|
||||
t!(
|
||||
"opt.expected_char",
|
||||
value = &value
|
||||
),
|
||||
));
|
||||
@ -593,11 +588,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected a string as value containing a char \
|
||||
for key '{}', found {:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_char_value",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -608,11 +602,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected a boolean as value for key '{}', \
|
||||
found {:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_bool",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -623,11 +616,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected an integer as value for key '{}', \
|
||||
found {:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_int",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -638,9 +630,8 @@ impl BookOptions {
|
||||
Ok(value) => Ok(self.options.insert(key, BookOption::Float(value))),
|
||||
Err(_) => Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"could not parse '{value}' as a float \
|
||||
for key '{key}'",
|
||||
t!(
|
||||
"opt.expected_float",
|
||||
value = &value,
|
||||
key = &key
|
||||
),
|
||||
@ -649,11 +640,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected a float as value for key '{}', found \
|
||||
{:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_float",
|
||||
key = &key,
|
||||
value = format!("{:?}", &value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -662,9 +652,8 @@ impl BookOptions {
|
||||
if let Some(new_key) = opt {
|
||||
warn!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"'{old_key}' has been deprecated, you should \
|
||||
now use '{new_key}'",
|
||||
t!(
|
||||
"opt.warn_deprecated",
|
||||
old_key = &key,
|
||||
new_key = &new_key
|
||||
)
|
||||
@ -673,7 +662,7 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
self.source.clone(),
|
||||
lformat!("key '{key}' has been deprecated.", key = &key),
|
||||
t!("opt.err_deprecated", key = &key),
|
||||
))
|
||||
}
|
||||
} else if key.starts_with("metadata.") {
|
||||
@ -685,11 +674,10 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"expected a string as value for key '{}', found \
|
||||
{:?}",
|
||||
&key,
|
||||
&value
|
||||
t!(
|
||||
"opt.expected_string_value",
|
||||
key = &key,
|
||||
value = format!("{:?}", &&value)
|
||||
),
|
||||
))
|
||||
}
|
||||
@ -697,7 +685,7 @@ impl BookOptions {
|
||||
// key not recognized
|
||||
Err(Error::book_option(
|
||||
self.source.clone(),
|
||||
lformat!("unrecognized key '{key}'", key = &key),
|
||||
t!("opt.unrecognized", key = &key),
|
||||
))
|
||||
}
|
||||
}
|
||||
@ -738,9 +726,8 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"value '{value}' for key '{key}' does not \
|
||||
contain one and only one YAML value",
|
||||
t!(
|
||||
"opt.one_yaml",
|
||||
value = value,
|
||||
key = key
|
||||
),
|
||||
@ -749,8 +736,8 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"could not parse '{value}' as a valid YAML value",
|
||||
t!(
|
||||
"opt.yaml_value",
|
||||
value = value
|
||||
),
|
||||
))
|
||||
@ -769,7 +756,7 @@ impl BookOptions {
|
||||
self.options.get(key).ok_or_else(|| {
|
||||
Error::invalid_option(
|
||||
&self.source,
|
||||
lformat!("option '{key}' is not present", key = key),
|
||||
t!("opt.miss_key", key = key),
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -855,7 +842,7 @@ impl BookOptions {
|
||||
} else {
|
||||
Err(Error::book_option(
|
||||
&self.source,
|
||||
lformat!("'{key}''s path contains invalid UTF-8 code", key = key),
|
||||
t!("opt.invalid_utf8", value = key),
|
||||
))
|
||||
}
|
||||
}
|
||||
@ -935,7 +922,7 @@ impl BookOptions {
|
||||
.map_err(|_| {
|
||||
Error::default(
|
||||
Source::empty(),
|
||||
lformat!("could not get current directory!"),
|
||||
t!("opt.curr_dir"),
|
||||
)
|
||||
})?
|
||||
.join(&path);
|
||||
@ -944,10 +931,9 @@ impl BookOptions {
|
||||
} else {
|
||||
return Err(Error::book_option(
|
||||
Source::new(other.root.to_str().unwrap()),
|
||||
lformat!(
|
||||
"'{key}''s path contains invalid \
|
||||
UTF-8 code",
|
||||
key = key
|
||||
t!(
|
||||
"opt.invalid_utf8",
|
||||
value = key
|
||||
),
|
||||
));
|
||||
};
|
||||
@ -974,7 +960,7 @@ impl BookOptions {
|
||||
let mut previous_is_comment = true;
|
||||
for (comment, key, o_type, default) in Self::options_to_vec() {
|
||||
// Don't display deprecated options if md is not set
|
||||
if !md && comment.trim() == lformat!("Deprecated options") {
|
||||
if !md && comment.trim() == t!("opt.deprecated") {
|
||||
return out;
|
||||
}
|
||||
if key.is_none() {
|
||||
@ -992,29 +978,26 @@ impl BookOptions {
|
||||
}
|
||||
previous_is_comment = false;
|
||||
let o_type = match o_type.unwrap() {
|
||||
"bool" => lformat!("boolean"),
|
||||
"float" => lformat!("float"),
|
||||
"int" => lformat!("integer"),
|
||||
"char" => lformat!("char"),
|
||||
"str" => lformat!("string"),
|
||||
"path" => lformat!("path"),
|
||||
"tpl" => lformat!("template path"),
|
||||
"meta" => lformat!("metadata"),
|
||||
"strvec" => lformat!("list of strings"),
|
||||
"alias" => lformat!("DEPRECATED"),
|
||||
"bool" => t!("ty.bool"),
|
||||
"float" => t!("ty.float"),
|
||||
"int" => t!("ty.int"),
|
||||
"char" => t!("ty.char"),
|
||||
"str" => t!("ty.str"),
|
||||
"path" => t!("ty.path"),
|
||||
"tpl" => t!("ty.tpl"),
|
||||
"meta" => t!("ty.meta"),
|
||||
"strvec" => t!("ty.strvec"),
|
||||
"alias" => t!("ty.alias"),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let def = if let Some(value) = default {
|
||||
value.to_owned()
|
||||
} else {
|
||||
lformat!("not set")
|
||||
t!("opt.not_set")
|
||||
};
|
||||
if md {
|
||||
out.push_str(&lformat!(
|
||||
"- **`{key}`**
|
||||
- **type**: {option_type}
|
||||
- **default value**: `{default}`
|
||||
- {comment}\n",
|
||||
out.push_str(&t!(
|
||||
"opt.option_description_md",
|
||||
key = key.unwrap(),
|
||||
option_type = o_type,
|
||||
default = def,
|
||||
@ -1024,10 +1007,10 @@ impl BookOptions {
|
||||
out.push_str(&format!("{key}
|
||||
{type} {option_type} ({msg} {default})
|
||||
{comment}\n",
|
||||
type = style::field(&lformat!("type:")),
|
||||
type = style::field(&t!("ty.type")),
|
||||