mirror of
https://github.com/lise-henry/crowbook
synced 2024-05-09 20:06:09 +02:00
Compare commits
5 Commits
c1f54fdbd4
...
54f9b1dd6d
Author | SHA1 | Date | |
---|---|---|---|
Elisabeth Henry | 54f9b1dd6d | ||
Elisabeth Henry | ae4d6f2442 | ||
Elisabeth Henry | 298005f08d | ||
Elisabeth Henry | 95b80bf7d1 | ||
Elisabeth Henry | d818b80d02 |
|
@ -10,18 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.6.10"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "81ce3d38065e618af2d7b77e10c5ad9a069859b4be3c2250f674af3840d9c8a5"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "1.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c"
|
||||
checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
@ -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]]
|
||||
|
@ -169,9 +160,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "2.3.3"
|
||||
version = "2.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42"
|
||||
checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635"
|
||||
|
||||
[[package]]
|
||||
name = "bstr"
|
||||
|
@ -221,7 +212,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"winapi 0.3.9",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -241,9 +232,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap"
|
||||
version = "4.3.21"
|
||||
version = "4.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd"
|
||||
checksum = "03aef18ddf7d879c15ce20f04826ef8418101c7e528014c3eeea13321047dca3"
|
||||
dependencies = [
|
||||
"clap_builder",
|
||||
"clap_derive",
|
||||
|
@ -252,9 +243,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "clap_builder"
|
||||
version = "4.3.21"
|
||||
version = "4.3.23"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa"
|
||||
checksum = "f8ce6fffb678c9b80a70b6b6de0aad31df727623a70fd9a842c30cd573e2fa98"
|
||||
dependencies = [
|
||||
"anstream",
|
||||
"anstyle",
|
||||
|
@ -271,8 +262,8 @@ checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050"
|
|||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"syn 2.0.28",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -302,11 +293,11 @@ version = "0.18.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "482aa5695bca086022be453c700a40c02893f1ba7098a2c88351de55341ae894"
|
||||
dependencies = [
|
||||
"clap 4.3.21",
|
||||
"clap 4.3.23",
|
||||
"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",
|
||||
|
@ -391,17 +382,15 @@ name = "crowbook"
|
|||
version = "0.17.0"
|
||||
dependencies = [
|
||||
"base64",
|
||||
"clap 4.3.21",
|
||||
"clap 4.3.23",
|
||||
"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,45 +403,25 @@ 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]]
|
||||
name = "deranged"
|
||||
version = "0.3.7"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929"
|
||||
checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946"
|
||||
|
||||
[[package]]
|
||||
name = "deunicode"
|
||||
|
@ -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]]
|
||||
|
@ -550,9 +519,9 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
|||
|
||||
[[package]]
|
||||
name = "flate2"
|
||||
version = "1.0.26"
|
||||
version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743"
|
||||
checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010"
|
||||
dependencies = [
|
||||
"crc32fast",
|
||||
"miniz_oxide",
|
||||
|
@ -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"
|
||||
|
@ -873,9 +826,9 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503"
|
|||
|
||||
[[package]]
|
||||
name = "log"
|
||||
version = "0.4.19"
|
||||
version = "0.4.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4"
|
||||
checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
|
@ -1178,9 +1131,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.32"
|
||||
version = "1.0.33"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965"
|
||||
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
]
|
||||
|
@ -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]]
|
||||
|
@ -1412,8 +1343,8 @@ dependencies = [
|
|||
"globwalk",
|
||||
"itertools",
|
||||
"once_cell",
|
||||
"quote 1.0.32",
|
||||
"regex 1.9.3",
|
||||
"quote 1.0.33",
|
||||
"regex",
|
||||
"rust-i18n-extract",
|
||||
"rust-i18n-macro",
|
||||
"rust-i18n-support",
|
||||
|
@ -1431,8 +1362,8 @@ dependencies = [
|
|||
"anyhow",
|
||||
"ignore",
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"regex 1.9.3",
|
||||
"quote 1.0.33",
|
||||
"regex",
|
||||
"rust-i18n-support",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -1449,7 +1380,7 @@ dependencies = [
|
|||
"glob",
|
||||
"once_cell",
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"quote 1.0.33",
|
||||
"rust-i18n-support",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
@ -1498,7 +1429,7 @@ version = "0.38.8"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f"
|
||||
dependencies = [
|
||||
"bitflags 2.3.3",
|
||||
"bitflags 2.4.0",
|
||||
"errno",
|
||||
"libc",
|
||||
"linux-raw-sys 0.4.5",
|
||||
|
@ -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"
|
||||
|
@ -1544,29 +1465,29 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
|
|||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.183"
|
||||
version = "1.0.171"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c"
|
||||
checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.183"
|
||||
version = "1.0.171"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816"
|
||||
checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"syn 2.0.28",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_json"
|
||||
version = "1.0.104"
|
||||
version = "1.0.105"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c"
|
||||
checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360"
|
||||
dependencies = [
|
||||
"itoa",
|
||||
"ryu",
|
||||
|
@ -1662,18 +1583,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"quote 1.0.33",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.28"
|
||||
version = "2.0.29"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567"
|
||||
checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"quote 1.0.33",
|
||||
"unicode-ident",
|
||||
]
|
||||
|
||||
|
@ -1691,19 +1612,19 @@ dependencies = [
|
|||
"once_cell",
|
||||
"onig",
|
||||
"plist",
|
||||
"regex-syntax 0.7.4",
|
||||
"regex-syntax",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"walkdir 2.3.3",
|
||||
"walkdir",
|
||||
"yaml-rust",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.7.1"
|
||||
version = "3.8.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651"
|
||||
checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"fastrand",
|
||||
|
@ -1753,31 +1674,22 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "thiserror"
|
||||
version = "1.0.44"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90"
|
||||
checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
|
||||
dependencies = [
|
||||
"thiserror-impl",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thiserror-impl"
|
||||
version = "1.0.44"
|
||||
version = "1.0.47"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96"
|
||||
checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"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",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.29",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1792,9 +1704,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "time"
|
||||
version = "0.3.25"
|
||||
version = "0.3.26"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea"
|
||||
checksum = "a79d09ac6b08c1ab3906a2f7cc2e81a0e27c7ae89c63812df75e52bef0751e07"
|
||||
dependencies = [
|
||||
"deranged",
|
||||
"itoa",
|
||||
|
@ -1813,9 +1725,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb"
|
|||
|
||||
[[package]]
|
||||
name = "time-macros"
|
||||
version = "0.2.11"
|
||||
version = "0.2.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd"
|
||||
checksum = "75c65469ed6b3a4809d987a41eb1dc918e9bc1d92211cbad7ae82931846f7451"
|
||||
dependencies = [
|
||||
"time-core",
|
||||
]
|
||||
|
@ -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",
|
||||
]
|
||||
|
||||
|
@ -2002,8 +1891,8 @@ dependencies = [
|
|||
"log",
|
||||
"once_cell",
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"syn 2.0.28",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.29",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
||||
|
@ -2013,7 +1902,7 @@ version = "0.2.87"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d"
|
||||
dependencies = [
|
||||
"quote 1.0.32",
|
||||
"quote 1.0.33",
|
||||
"wasm-bindgen-macro-support",
|
||||
]
|
||||
|
||||
|
@ -2024,8 +1913,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.66",
|
||||
"quote 1.0.32",
|
||||
"syn 2.0.28",
|
||||
"quote 1.0.33",
|
||||
"syn 2.0.29",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-shared",
|
||||
]
|
||||
|
@ -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]]
|
||||
|
@ -2085,7 +1962,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2103,7 +1980,7 @@ version = "0.48.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
||||
dependencies = [
|
||||
"windows-targets 0.48.1",
|
||||
"windows-targets 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2123,17 +2000,17 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.1"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
|
||||
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
||||
dependencies = [
|
||||
"windows_aarch64_gnullvm 0.48.0",
|
||||
"windows_aarch64_msvc 0.48.0",
|
||||
"windows_i686_gnu 0.48.0",
|
||||
"windows_i686_msvc 0.48.0",
|
||||
"windows_x86_64_gnu 0.48.0",
|
||||
"windows_x86_64_gnullvm 0.48.0",
|
||||
"windows_x86_64_msvc 0.48.0",
|
||||
"windows_aarch64_gnullvm 0.48.5",
|
||||
"windows_aarch64_msvc 0.48.5",
|
||||
"windows_i686_gnu 0.48.5",
|
||||
"windows_i686_msvc 0.48.5",
|
||||
"windows_x86_64_gnu 0.48.5",
|
||||
"windows_x86_64_gnullvm 0.48.5",
|
||||
"windows_x86_64_msvc 0.48.5",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2144,9 +2021,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_gnullvm"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
|
||||
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
||||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
|
@ -2156,9 +2033,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
|
|||
|
||||
[[package]]
|
||||
name = "windows_aarch64_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
|
||||
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
|
@ -2168,9 +2045,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_gnu"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
|
||||
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
|
@ -2180,9 +2057,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
|
|||
|
||||
[[package]]
|
||||
name = "windows_i686_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
|
||||
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
|
@ -2192,9 +2069,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnu"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
|
||||
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
|
@ -2204,9 +2081,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_gnullvm"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
|
||||
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
||||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
|
@ -2216,9 +2093,9 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
|
|||
|
||||
[[package]]
|
||||
name = "windows_x86_64_msvc"
|
||||
version = "0.48.0"
|
||||
version = "0.48.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
|
||||
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
||||
|
||||
[[package]]
|
||||
name = "winnow"
|
||||
|
|
|
@ -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();
|
||||
}
|
227
lang/lib/en.yml
227
lang/lib/en.yml
|
@ -58,6 +58,9 @@ error:
|
|||
roman_numerals: "can not use roman numerals with zero or negative chapter numbers (%{n})"
|
||||
render_key: "could not render `%{key}` for metadata:\n%{error}"
|
||||
yaml_set: "Inline YAML block could not set %{key} to %{value}: %{err}"
|
||||
yaml_lang: "Yaml file for language %{lang} didn't contain a hash"
|
||||
yaml_translation: "Could not find translation for %{key} in language %{lang}"
|
||||
yaml_translation_sring: "Yaml for %{key} in lang %{lang} is not a string"
|
||||
renderer:
|
||||
no_output: This renderer does not support the auto output
|
||||
file_creation: "could not create file '%{file}': '%{err}"
|
||||
|
@ -65,6 +68,8 @@ error:
|
|||
warn:
|
||||
above: "Warning: book contains chapter '%{file}' in a directory above the book file, this might cause problems"
|
||||
format:
|
||||
image: image
|
||||
markdown: markdown file
|
||||
book: book
|
||||
book_chapter: book chapter
|
||||
html_single: HTML (standalone page)
|
||||
|
@ -79,6 +84,10 @@ debug:
|
|||
yaml_ignore: "Ignoring YAML block:\n%{block}"
|
||||
found_yaml_block: "Found something that looked like a YAML block:\n%{block}"
|
||||
found_yaml_block2: "... but it didn't parse correctly as YAML('%{error}'), so treating it like Markdown."
|
||||
msg:
|
||||
attempting: "Attempting to generate %{format}..."
|
||||
generated: "Succesfully generated %{format}: %{path}"
|
||||
generated_short: "Succesfully generated %{format}"
|
||||
epub:
|
||||
zip_command: "Could not run zip command, falling back to zip library"
|
||||
cover: cover
|
||||
|
@ -88,8 +97,216 @@ epub:
|
|||
ambiguous_invisible: "EPUB (%{source}): detected two chapter titles inside the same markdown file, in a file where chapter titles are not even rendered."
|
||||
title_conflict: "EPUB ({source}): conflict between: %{title1} and %{title2}"
|
||||
guess: "EPUB: could not guess the format of %{file} based on extension. Assuming png."
|
||||
msg:
|
||||
attempting: "Attempting to generate %{format}..."
|
||||
generated: "Succesfully generated %{format}: %{path}"
|
||||
generated_short: "Succesfully generated %{format}"
|
||||
|
||||
html:
|
||||
exist_not_dir: "%{path} already exists and is not a directory"
|
||||
delete_dir: "%{path} already exists, deleting it"
|
||||
delete_dir_error: "error deleting directory %{path}: %{error}"
|
||||
create_dir_error: "could not create HTML directory %{path}: %{error}"
|
||||
reading_image_error: "error while reading image file %{file}: %{error}"
|
||||
resource_error: "error while reading resource file: %{error}"
|
||||
create_file_error: "could not create file %{file}: %{error}"
|
||||
write_file_error: "could not write to file %{file}: %{error}"
|
||||
write_error: "problem when writing HTML: %{error}"
|
||||
dir_to_stream_error: "can only render HTML directory to a path, not to a stream"
|
||||
if_error: "problem when writing interactive fiction: %{error}"
|
||||
highlight: "rendering.highlight set to '%{value}', not a valid value"
|
||||
footer_template_error: "rendering 'html.footer' template:\n%{error}"
|
||||
header_template_error: "rendering 'html.header' template:\n%{error}"
|
||||
latex:
|
||||
attempting: "Attempting to run LaTeX on generated file"
|
||||
image_error: "error while reading image file: %{error}"
|
||||
lang_error: "LaTeX: can't find a tex equivalent for lang '%{lang}', fallbacking on english"
|
||||
lists: "found %{n} indented ordered lists, LaTeX only allows for 4"
|
||||
remote_image: "LaTeX (%{source}): image '%{url}' doesn't seem to be local; ignoring it."
|
||||
write_error: "problem when writing LaTeX: %{error}"
|
||||
parser:
|
||||
ignore_html: "ignoring HTML block '%{block}'"
|
||||
resouces:
|
||||
non_local: "Resources: book includes non-local image %{file}, which might cause problem for proper inclusion."
|
||||
no_ext: "Resources: book includes image %{file} which doesn't have an extension"
|
||||
read_error: "Resources: could not read file %{file}"
|
||||
guess: "Resources: could not guess mime type of file %{file}"
|
||||
no_match: "Resources: could not find an in-book match for link %{file} or %{new_from}"
|
||||
read_file: "error reading file %{file}: %{error}"
|
||||
no_path: "error: %{path} is neither a file nor a directory"
|
||||
stats:
|
||||
no_advanced: "This version of crowboook has been compiled without support for advanced statistics"
|
||||
advanced: "For more advanced statistics, use the --verbose or -v option"
|
||||
chapter: Chapter
|
||||
chars: Chars
|
||||
syllables: Syllables
|
||||
words: Words
|
||||
sentences: Sentences
|
||||
chars_word: Chars/Word
|
||||
words_sentence: Words/Sentence
|
||||
flesch: Flesch reading index
|
||||
total: "TOTAL:"
|
||||
syntax:
|
||||
default_theme: "could not set syntect theme to %{theme}, defaulting to \"InspiredGitHub\""
|
||||
valid_themes: "valid theme names are: %{themes}"
|
||||
no_support: "crowbook was compiled without syntect support, syntax highlighting will be disabled"
|
||||
zipper:
|
||||
tmp_dir: "could not create temporary directory in %{path}"
|
||||
verboten: |
|
||||
"file %{file} refers to an absolute or a parent path."
|
||||
"This is forbidden because we are supposed to create a temporary file in a temporary dir."
|
||||
write_error: "could not write to temporary file %{file}"
|
||||
create_error: "could not create temporary file %{file}"
|
||||
command_output: "output for command %{name}:\n%{error}"
|
||||
command_error: "failed to run command '%{name}'"
|
||||
command_result_error: "could not open result of command %'{command}'\nCommand output:\n%{output}'"
|
||||
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")),
|
||||
key = style::element(key.unwrap()),
|
||||
option_type = style::tipe(&o_type),
|
||||
msg = lformat!("default:"),
|
||||
msg = t!("ty.default"),
|
||||
default = style::value(&def),
|
||||
comment = style::fill(comment.trim(), " ")));
|
||||
}
|
||||
|
|
|
@ -374,7 +374,7 @@ impl From<fmt::Error> for Error {
|
|||
fn from(err: fmt::Error) -> Error {
|
||||
Error::default(
|
||||
Source::empty(),
|
||||
lformat!("format error: {error}", error = err),
|
||||
t!("error.format", error = err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,9 @@ impl From<syntect::Error> for Error {
|
|||
fn from(err: syntect::Error) -> Error {
|
||||
Error::syntect(
|
||||
Source::empty(),
|
||||
lformat!("syntect error: {error}", error = err),
|
||||
format!("{msg}: {error}",
|
||||
msg = t!("error.syntect"),
|
||||
error = err),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ use crowbook_text_processing::escape;
|
|||
use epub_builder::Toc;
|
||||
use epub_builder::TocElement;
|
||||
use numerals::roman::Roman;
|
||||
use rust_i18n::t;
|
||||
|
||||
#[derive(Debug, PartialEq, Copy, Clone)]
|
||||
/// If/how to highlight code
|
||||
|
@ -128,7 +129,7 @@ impl<'a> HtmlRenderer<'a> {
|
|||
value => {
|
||||
error!(
|
||||
"{}",
|
||||
lformat!("rendering.highlight set to '{}', not a valid value", value)
|
||||
t!("html.highlight", value = value)
|
||||
);
|
||||
(Highlight::None, None)
|
||||
}
|
||||
|
@ -354,9 +355,8 @@ impl<'a> HtmlRenderer<'a> {
|
|||
} else {
|
||||
error!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"can not use roman numerals with zero or negative chapter numbers ({n})",
|
||||
n = self.current_chapter[i]
|
||||
t!("error.roman_numerals",
|
||||
n = self.current_chapter[i]
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -738,10 +738,8 @@ impl<'a> HtmlRenderer<'a> {
|
|||
Err(err) => {
|
||||
return Err(Error::render(
|
||||
&this.as_ref().book.source,
|
||||
lformat!(
|
||||
"rendering 'html.footer' \
|
||||
template:\n{error}",
|
||||
error = err
|
||||
t!("html.footer_template_error",
|
||||
error = err
|
||||
),
|
||||
))
|
||||
}
|
||||
|
@ -775,7 +773,7 @@ impl<'a> HtmlRenderer<'a> {
|
|||
}
|
||||
Err(err) => Err(Error::render(
|
||||
&this.as_ref().book.source,
|
||||
lformat!("rendering 'html.header' template:\n{error}", error = err),
|
||||
t!("html.header_template_error", error = err),
|
||||
)),
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -36,6 +36,7 @@ use std::io;
|
|||
use std::io::Read;
|
||||
use std::path::Path;
|
||||
use std::path::PathBuf;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// Multiple files HTML renderer
|
||||
///
|
||||
|
@ -71,25 +72,21 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
if metadata.is_file() {
|
||||
return Err(Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"{path} already exists and is not a \
|
||||
directory",
|
||||
t!("html.exist_not_dir",
|
||||
path = dest_path.display()
|
||||
),
|
||||
));
|
||||
} else if metadata.is_dir() {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"{path} already exists, deleting it",
|
||||
t!("html.delete_dir",
|
||||
path = dest_path.display()
|
||||
)
|
||||
);
|
||||
fs::remove_dir_all(dest_path).map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"error deleting directory {path}: {error}",
|
||||
t!("html.delete_dir_error",
|
||||
path = dest_path.display(),
|
||||
error = e
|
||||
),
|
||||
|
@ -104,10 +101,9 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
.map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"could not create HTML directory {path}: {error}",
|
||||
path = dest_path.display(),
|
||||
error = e
|
||||
t!("html.create_dir_error",
|
||||
path = dest_path.display(),
|
||||
error = e
|
||||
),
|
||||
)
|
||||
})?;
|
||||
|
@ -153,7 +149,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
let mut f = fs::canonicalize(source).and_then(File::open).map_err(|_| {
|
||||
Error::file_not_found(
|
||||
&self.html.book.source,
|
||||
lformat!("image or cover"),
|
||||
t!("epub.image_or_cover"),
|
||||
source.clone(),
|
||||
)
|
||||
})?;
|
||||
|
@ -161,8 +157,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
f.read_to_end(&mut content).map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"error while reading image file {file}: {error}",
|
||||
t!("html.reading_image_error",
|
||||
file = source,
|
||||
error = e
|
||||
),
|
||||
|
@ -194,7 +189,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
.map_err(|_| {
|
||||
Error::file_not_found(
|
||||
&self.html.book.source,
|
||||
lformat!("additional resource from resources.files"),
|
||||
t!("epub.resources"),
|
||||
abs_path.to_string_lossy().into_owned(),
|
||||
)
|
||||
})?;
|
||||
|
@ -202,7 +197,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
f.read_to_end(&mut content).map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!("error while reading resource file: {error}", error = e),
|
||||
t!("html.resource_error", error = e),
|
||||
)
|
||||
})?;
|
||||
self.write_file(data_path.join(&path).to_str().unwrap(), &content)?;
|
||||
|
@ -337,7 +332,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
if fs::metadata(&cover).is_err() {
|
||||
return Err(Error::file_not_found(
|
||||
&self.html.book.source,
|
||||
lformat!("cover"),
|
||||
t!("epub.cover"),
|
||||
cover,
|
||||
));
|
||||
}
|
||||
|
@ -482,8 +477,7 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
.map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"could not create directory in {path}: {error}",
|
||||
t!("html.create_dir_error",
|
||||
path = dest_dir.display(),
|
||||
error = e
|
||||
),
|
||||
|
@ -493,20 +487,18 @@ impl<'a> HtmlDirRenderer<'a> {
|
|||
let mut f = File::create(&dest_file).map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"could not create file {file}: {error}",
|
||||
file = dest_file.display(),
|
||||
error = e
|
||||
t!("html.create_file_error",
|
||||
file = dest_file.display(),
|
||||
error = e
|
||||
),
|
||||
)
|
||||
})?;
|
||||
io::Write::write_all(&mut f, content).map_err(|e| {
|
||||
Error::render(
|
||||
&self.html.book.source,
|
||||
lformat!(
|
||||
"could not write to file {file}: {error}",
|
||||
file = dest_file.display(),
|
||||
error = e
|
||||
t!("html.write_file_error",
|
||||
file = dest_file.display(),
|
||||
error = e
|
||||
),
|
||||
)
|
||||
})
|
||||
|
@ -530,7 +522,7 @@ impl BookRenderer for HtmlDir {
|
|||
fn render(&self, _: &Book, _: &mut dyn io::Write) -> Result<()> {
|
||||
Err(Error::render(
|
||||
Source::empty(),
|
||||
lformat!("can only render HTML directory to a path, not to a stream"),
|
||||
t!("html.dir_to_stream_error"),
|
||||
))
|
||||
}
|
||||
|
||||
|
@ -538,4 +530,4 @@ impl BookRenderer for HtmlDir {
|
|||
HtmlDirRenderer::new(book)?.render_book(path)?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ use crate::misc;
|
|||
|
||||
use std::convert::{AsMut, AsRef};
|
||||
use std::io;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// Interactive fiction HTML renderer
|
||||
///
|
||||
|
@ -367,9 +368,8 @@ impl BookRenderer for HtmlIf {
|
|||
to.write_all(result.as_bytes()).map_err(|e| {
|
||||
Error::render(
|
||||
&book.source,
|
||||
lformat!(
|
||||
"problem when writing interactive fiction: {error}",
|
||||
error = e
|
||||
t!("html.if_error",
|
||||
error = e
|
||||
),
|
||||
)
|
||||
})?;
|
||||
|
|
|
@ -29,6 +29,7 @@ use crate::misc;
|
|||
use std::convert::{AsMut, AsRef};
|
||||
use std::fmt::Write;
|
||||
use std::io;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// Single file HTML renderer
|
||||
///
|
||||
|
@ -343,7 +344,7 @@ impl BookRenderer for HtmlSingle {
|
|||
to.write_all(result.as_bytes()).map_err(|e| {
|
||||
Error::render(
|
||||
&book.source,
|
||||
lformat!("problem when writing HTML: {error}", error = e),
|
||||
t!("html.write_error", error = e),
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
|
@ -361,7 +362,7 @@ impl BookRenderer for ProofHtmlSingle {
|
|||
to.write_all(result.as_bytes()).map_err(|e| {
|
||||
Error::render(
|
||||
&book.source,
|
||||
lformat!("problem when writing HTML: {error}", error = e),
|
||||
t!("html.write_error", error = e),
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
use yaml_rust::yaml::Hash;
|
||||
use yaml_rust::{Yaml, YamlLoader};
|
||||
use rust_i18n::t;
|
||||
|
||||
static EN: &str = include_str!("../../lang/document/en.yaml");
|
||||
static ES: &str = include_str!("../../lang/document/es.yaml");
|
||||
|
@ -27,9 +28,8 @@ pub fn get_hash(lang: &str) -> Hash {
|
|||
} else {
|
||||
panic!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Yaml file for language {lang} didn't contain a hash",
|
||||
lang = lang
|
||||
t!("error.yaml_lang",
|
||||
lang = lang
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -38,8 +38,8 @@ pub fn get_hash(lang: &str) -> Hash {
|
|||
/// Get a string for a given language
|
||||
pub fn get_str(lang: &str, s: &str) -> String {
|
||||
let hash = get_hash(lang);
|
||||
let yaml = hash.get(&Yaml::String(s.to_owned())).expect(&lformat!(
|
||||
"Could not find translation for {key} in language {lang}",
|
||||
let yaml = hash.get(&Yaml::String(s.to_owned())).expect(&t!(
|
||||
"error.yaml_translation",
|
||||
key = s,
|
||||
lang = lang
|
||||
));
|
||||
|
@ -48,8 +48,7 @@ pub fn get_str(lang: &str, s: &str) -> String {
|
|||
} else {
|
||||
panic!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Yaml for {key} in lang {lang} is not a String!",
|
||||
t!("error.yaml_translation_string",
|
||||
key = s,
|
||||
lang = lang
|
||||
)
|
||||
|
|
|
@ -36,6 +36,7 @@ use std::fs::File;
|
|||
use std::io;
|
||||
use std::io::Read;
|
||||
use std::iter::Iterator;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// LaTeX renderer
|
||||
pub struct LatexRenderer<'a> {
|
||||
|
@ -95,20 +96,20 @@ impl<'a> LatexRenderer<'a> {
|
|||
/// Render pdf to a file
|
||||
pub fn render_pdf(&mut self, to: &mut dyn io::Write) -> Result<String> {
|
||||
let content = self.render_book()?;
|
||||
debug!("{}", lformat!("Attempting to run LaTeX on generated file"));
|
||||
debug!("{}", t!("latex.attempting"));
|
||||
let mut zipper = Zipper::new(&self.book.options.get_path("crowbook.temp_dir").unwrap())?;
|
||||
zipper.write("result.tex", content.as_bytes(), false)?;
|
||||
|
||||
// write image files
|
||||
for (source, dest) in self.handler.images_mapping() {
|
||||
let mut f = fs::canonicalize(source).and_then(File::open).map_err(|_| {
|
||||
Error::file_not_found(&self.source, lformat!("image"), source.to_owned())
|
||||
Error::file_not_found(&self.source, t!("format.image"), source.to_owned())
|
||||
})?;
|
||||
let mut content = vec![];
|
||||
f.read_to_end(&mut content).map_err(|e| {
|
||||
Error::render(
|
||||
&self.source,
|
||||
lformat!("error while reading image file: {error}", error = e),
|
||||
t!("latex.image_error", error = e),
|
||||
)
|
||||
})?;
|
||||
zipper.write(dest, &content, true)?;
|
||||
|
@ -200,10 +201,8 @@ impl<'a> LatexRenderer<'a> {
|
|||
_ => {
|
||||
warn!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"LaTeX: can't find a tex equivalent for lang '{lang}', \
|
||||
fallbacking on english",
|
||||
lang = self.book.options.get_str("lang").unwrap()
|
||||
t!("latex.lang_error",
|
||||
lang = self.book.options.get_str("lang").unwrap()
|
||||
)
|
||||
);
|
||||
"english"
|
||||
|
@ -314,10 +313,7 @@ impl<'a> Renderer for LatexRenderer<'a> {
|
|||
let initial = chars.next().ok_or_else(|| {
|
||||
Error::parser(
|
||||
&self.book.source,
|
||||
lformat!(
|
||||
"empty str token, could not find \
|
||||
initial"
|
||||
),
|
||||
t!("error.initial"),
|
||||
)
|
||||
})?;
|
||||
let mut first_word = String::new();
|
||||
|
@ -478,8 +474,7 @@ impl<'a> Renderer for LatexRenderer<'a> {
|
|||
_ => {
|
||||
return Err(Error::render(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"found {n} indented ordered lists, LaTeX only allows for 4",
|
||||
t!("latex.lists",
|
||||
n = self.enum_level
|
||||
),
|
||||
))
|
||||
|
@ -531,9 +526,7 @@ impl<'a> Renderer for LatexRenderer<'a> {
|
|||
} else {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"LaTeX ({source}): image '{url}' doesn't seem to be \
|
||||
local; ignoring it.",
|
||||
t!("latex.remote_image",
|
||||
source = self.source,
|
||||
url = url
|
||||
)
|
||||
|
@ -550,9 +543,7 @@ impl<'a> Renderer for LatexRenderer<'a> {
|
|||
} else {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"LaTeX ({source}): image '{url}' doesn't seem to be \
|
||||
local; ignoring it.",
|
||||
t!("latex.remote_image",
|
||||
source = self.source,
|
||||
url = url
|
||||
)
|
||||
|
@ -635,7 +626,7 @@ impl BookRenderer for Latex {
|
|||
to.write_all(result.as_bytes()).map_err(|e| {
|
||||
Error::render(
|
||||
&book.source,
|
||||
lformat!("problem when writing LaTeX: {error}", error = e),
|
||||
t!("latex.write_error", error = e),
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
|
@ -653,7 +644,7 @@ impl BookRenderer for ProofLatex {
|
|||
to.write_all(result.as_bytes()).map_err(|e| {
|
||||
Error::render(
|
||||
&book.source,
|
||||
lformat!("problem when writing LaTeX: {error}", error = e),
|
||||
t!("latex.write_error", error = e),
|
||||
)
|
||||
})?;
|
||||
Ok(())
|
||||
|
|
|
@ -125,9 +125,6 @@ pub use token::Token;
|
|||
|
||||
rust_i18n::i18n!("lang/lib", fallback="en");
|
||||
|
||||
#[macro_use]
|
||||
#[doc(hidden)]
|
||||
mod localize_macros;
|
||||
#[macro_use]
|
||||
mod html;
|
||||
mod book;
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
include!(concat!(env!("OUT_DIR"), "/localize_macros.rs"));
|
|
@ -29,6 +29,7 @@ use std::path::Path;
|
|||
|
||||
use comrak::nodes::{AstNode, ListType, NodeValue};
|
||||
use comrak::{parse_document, Arena, ComrakOptions};
|
||||
use rust_i18n::t;
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq)]
|
||||
/// The list of features used in a document.
|
||||
|
@ -170,7 +171,7 @@ impl Parser {
|
|||
let mut f = File::open(path).map_err(|_| {
|
||||
Error::file_not_found(
|
||||
&self.source,
|
||||
lformat!("markdown file"),
|
||||
t!("format.markdown"),
|
||||
format!("{}", path.display()),
|
||||
)
|
||||
})?;
|
||||
|
@ -179,9 +180,8 @@ impl Parser {
|
|||
f.read_to_string(&mut s).map_err(|_| {
|
||||
Error::parser(
|
||||
&self.source,
|
||||
lformat!(
|
||||
"file {file} contains invalid UTF-8, could not parse it",
|
||||
file = path.display()
|
||||
t!("error.utf8",
|
||||
file = path.display()
|
||||
),
|
||||
)
|
||||
})?;
|
||||
|
@ -298,7 +298,7 @@ impl Parser {
|
|||
if self.html_as_text {
|
||||
vec![Token::Str(text)]
|
||||
} else {
|
||||
debug!("{}", lformat!("ignoring HTML block '{}'", text));
|
||||
debug!("{}", t!("parser.ignore_html", block = text));
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
@ -307,7 +307,7 @@ impl Parser {
|
|||
if self.html_as_text {
|
||||
vec![Token::Str(text)]
|
||||
} else {
|
||||
debug!("{}", lformat!("ignoring HTML block '{}'", text));
|
||||
debug!("{}", t!("parser.ignore_html", block = text));
|
||||
vec![]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ use std::io::Read;
|
|||
use std::path::{Path, PathBuf};
|
||||
|
||||
use walkdir::WalkDir;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// Resource Handler.
|
||||
///
|
||||
|
@ -67,10 +68,8 @@ impl ResourceHandler {
|
|||
if !Self::is_local(file.as_ref()) {
|
||||
warn!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Resources: book includes non-local image {file}, which might \
|
||||
cause problem for proper inclusion.",
|
||||
file = file
|
||||
t!("resources.non_local",
|
||||
file = file
|
||||
)
|
||||
);
|
||||
return Ok(file);
|
||||
|
@ -80,7 +79,7 @@ impl ResourceHandler {
|
|||
if fs::metadata(file.as_ref()).is_err() {
|
||||
return Err(Error::file_not_found(
|
||||
source,
|
||||
lformat!("image"),
|
||||
t!("format.image"),
|
||||
format!("{file}"),
|
||||
));
|
||||
}
|
||||
|
@ -107,9 +106,7 @@ impl ResourceHandler {
|
|||
} else {
|
||||
warn!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Resources: book includes image {file} which doesn't have \
|
||||
an extension",
|
||||
t!("resources.no_ext",
|
||||
file = file
|
||||
)
|
||||
);
|
||||
|
@ -121,7 +118,7 @@ impl ResourceHandler {
|
|||
Err(_) => {
|
||||
return Err(Error::file_not_found(
|
||||
source,
|
||||
lformat!("image"),
|
||||
t!("format.image"),
|
||||
format!("{file}"),
|
||||
));
|
||||
}
|
||||
|
@ -130,7 +127,7 @@ impl ResourceHandler {
|
|||
if f.read_to_end(&mut content).is_err() {
|
||||
error!(
|
||||
"{}",
|
||||
lformat!("Resources: could not read file {file}", file = file)
|
||||
t!("resources.read_error", file = file)
|
||||
);
|
||||
return Ok(file);
|
||||
}
|
||||
|
@ -139,8 +136,7 @@ impl ResourceHandler {
|
|||
None => {
|
||||
error!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Resources: could not guess mime type of file {file}",
|
||||
t!("resources.guess",
|
||||
file = file
|
||||
)
|
||||
);
|
||||
|
@ -177,9 +173,7 @@ impl ResourceHandler {
|
|||
} else {
|
||||
warn!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"Resources: could not find an in-book match for link \
|
||||
{file} or {new_from}",
|
||||
t!("resources.no_match",
|
||||
file = from,
|
||||
new_from = new_from
|
||||
)
|
||||
|
@ -261,8 +255,7 @@ pub fn get_files(list: &[String], base: &str) -> Result<Vec<String>> {
|
|||
Err(err) => {
|
||||
return Err(Error::render(
|
||||
Source::empty(),
|
||||
lformat!(
|
||||
"error reading file {file}: {error}",
|
||||
t!("resources.read_file",
|
||||
file = abs_path.display(),
|
||||
error = err
|
||||
),
|
||||
|
@ -284,9 +277,7 @@ pub fn get_files(list: &[String], base: &str) -> Result<Vec<String>> {
|
|||
} else {
|
||||
return Err(Error::render(
|
||||
Source::empty(),
|
||||
lformat!(
|
||||
"error in epub rendering: {path} is \
|
||||
neither a file nor a directory",
|
||||
t!("resources.no_path",
|
||||
path = &path
|
||||
),
|
||||
));
|
||||
|
|
|
@ -29,6 +29,7 @@ use punkt::params::Standard;
|
|||
use punkt::{SentenceTokenizer, TrainingData};
|
||||
use std::f64;
|
||||
use std::fmt;
|
||||
use rust_i18n::t;
|
||||
|
||||
/* Only collected on nightly */
|
||||
struct AdvancedStats {
|
||||
|
@ -90,7 +91,7 @@ impl Stats {
|
|||
|
||||
if cfg!(not(feature = "nightly")) {
|
||||
if advanced {
|
||||
warn!("{}", lformat!("This version of crowboook has been compiled without support for advanced statistics"));
|
||||
warn!("{}", t!("stats.no_advanced"));
|
||||
}
|
||||
stats = Stats {
|
||||
chapters: vec![],
|
||||
|
@ -104,7 +105,7 @@ impl Stats {
|
|||
if !advanced {
|
||||
info!(
|
||||
"{}",
|
||||
lformat!("For more advanced statistics, use the --verbose or -v option")
|
||||
t!("stats.avanced")
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -290,24 +291,24 @@ impl fmt::Display for Stats {
|
|||
write!(
|
||||
f,
|
||||
"{:<width$} {:>8} {:>10} {:>7} {:>11} {:>11} {:>16} {:>29}\n---------\n",
|
||||
style::header(&lformat!("Chapter")),
|
||||
style::header(&lformat!("Chars")),
|
||||
style::header(&lformat!("Syllables")),
|
||||
style::header(&lformat!("Words")),
|
||||
style::header(&lformat!("Sentences")),
|
||||
style::header(&lformat!("Chars/Word")),
|
||||
style::header(&lformat!("Words/Sentence")),
|
||||
style::header(&lformat!("Flesch reading ease index")),
|
||||
style::header(&t!("stats.chapter")),
|
||||
style::header(&t!("stats.chars")),
|
||||
style::header(&t!("stats.syllables")),
|
||||
style::header(&t!("stats.words")),
|
||||
style::header(&t!("stats.sentences")),
|
||||
style::header(&t!("stats.chars_word")),
|
||||
style::header(&t!("stats.words_sentence")),
|
||||
style::header(&t!("stats.flesch")),
|
||||
width = max_chapter_length
|
||||
)?;
|
||||
} else {
|
||||
write!(
|
||||
f,
|
||||
"{:<width$} {:>8} {:>10} {:>11}\n---------\n",
|
||||
style::header(&lformat!("Chapter")),
|
||||
style::header(&lformat!("Chars")),
|
||||
style::header(&lformat!("Words")),
|
||||
style::header(&lformat!("Chars/Word")),
|
||||
style::header(&t!("stats.chapter")),
|
||||
style::header(&t!("stats.chars")),
|
||||
style::header(&t!("stats.words")),
|
||||
style::header(&t!("stats.chars_word")),
|
||||
width = max_chapter_length
|
||||
)?;
|
||||
}
|
||||
|
@ -365,7 +366,7 @@ impl fmt::Display for Stats {
|
|||
write!(
|
||||
f,
|
||||
"---------\n{:<width$} {:>8} {:>10} {:>7} {:>11} {:>11.2} {:>16.2} {:>8.1} => {:>17}\n",
|
||||
style::element(&lformat!("TOTAL:")),
|
||||
style::element(&t!("stats.total")),
|
||||
total.0,
|
||||
total.1,
|
||||
total.2,
|
||||
|
@ -380,7 +381,7 @@ impl fmt::Display for Stats {
|
|||
write!(
|
||||
f,
|
||||
"---------\n{:<width$} {:>8} {:>10} {:>11.2}\n",
|
||||
style::element(&lformat!("TOTAL:")),
|
||||
style::element(&t!("stats.total")),
|
||||
total.0,
|
||||
total.2,
|
||||
total.0 as f64 / total.2 as f64,
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
use crate::error::Result;
|
||||
|
||||
use crowbook_text_processing::escape;
|
||||
use rust_i18n::t;
|
||||
|
||||
#[cfg(feature = "syntect")]
|
||||
|
||||
|
@ -41,15 +42,13 @@ impl Syntax {
|
|||
None => {
|
||||
error!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"could not set syntect theme to {theme}, defaulting to \"InspiredGitHub\"",
|
||||
t!("syntax.default_theme",
|
||||
theme = theme_name
|
||||
)
|
||||
);
|
||||
info!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"valid theme names are: {themes}",
|
||||
t!("syntax valid_themes",
|
||||
themes = theme_set
|
||||
.themes
|
||||
.keys()
|
||||
|
@ -139,7 +138,7 @@ fn strip_language(language: &str) -> &str {
|
|||
#[cfg(not(feature = "syntect"))]
|
||||
impl Syntax {
|
||||
pub fn new(_: &str) -> Syntax {
|
||||
error!("{}", lformat!("crowbook was compiled without syntect support, syntax highlighting will be disabled"));
|
||||
error!("{}", t!("syntax.no_support"));
|
||||
Syntax {}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ use std::io::Write;
|
|||
use std::ops::Drop;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use rust_i18n::t;
|
||||
|
||||
/// Struct used to create zip (using filesystem and zip command)
|
||||
pub struct Zipper {
|
||||
|
@ -44,8 +45,8 @@ impl Zipper {
|
|||
.recursive(true)
|
||||
.create(&zipper_path)
|
||||
.map_err(|_| {
|
||||
Error::zipper(lformat!(
|
||||
"could not create temporary directory in {path}",
|
||||
Error::zipper(t!(
|
||||
"zipper.tmp_dir",
|
||||
path = path
|
||||
))
|
||||
})?;
|
||||
|
@ -61,11 +62,7 @@ impl Zipper {
|
|||
let path = path.as_ref();
|
||||
let file = format!("{}", path.display());
|
||||
if path.starts_with("..") || path.is_absolute() {
|
||||
return Err(Error::zipper(lformat!(
|
||||
"file {file} refers to an absolute or a parent \
|
||||
path.
|
||||
This is forbidden because we are supposed \
|
||||
to create a temporary file in a temporary dir.",
|
||||
return Err(Error::zipper(t!("zipper.verboten",
|
||||
file = file
|
||||
)));
|
||||
}
|
||||
|
@ -77,8 +74,8 @@ This is forbidden because we are supposed \
|
|||
.recursive(true)
|
||||
.create(dest_dir)
|
||||
.map_err(|_| {
|
||||
Error::zipper(lformat!(
|
||||
"could not create temporary directory in {path}",
|
||||
Error::zipper(t!(
|
||||
"zipper.tpm_dir",
|
||||
path = dest_dir.display()
|
||||
))
|
||||
})?;
|
||||
|
@ -91,40 +88,19 @@ This is forbidden because we are supposed \
|
|||
}
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::zipper(lformat!(
|
||||
"could not write to temporary file {file}",
|
||||
Err(Error::zipper(t!(
|
||||
"zipper.write_error",
|
||||
file = file
|
||||
)))
|
||||
}
|
||||
} else {
|
||||
Err(Error::zipper(lformat!(
|
||||
"could not create temporary file {file}",
|
||||
Err(Error::zipper(t!(
|
||||
"zipper.create_error",
|
||||
file = file
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
/// Unzip a file and deletes it afterwards
|
||||
#[cfg(feature = "odt")]
|
||||
pub fn unzip(&mut self, file: &str) -> Result<()> {
|
||||
let output = Command::new("unzip")
|
||||
.current_dir(&self.path)
|
||||
.arg(file)
|
||||
.output()
|
||||
.map_err(|e| {
|
||||
Error::zipper(lformat!(
|
||||
"failed to execute unzip on {file}: {error}",
|
||||
file = file,
|
||||
error = e
|
||||
))
|
||||
});
|
||||
|
||||
output?;
|
||||
|
||||
fs::remove_file(self.path.join(file))
|
||||
.map_err(|_| Error::zipper(lformat!("failed to remove file {file}", file = file)))
|
||||
}
|
||||
|
||||
/// run command and copy content of file output (supposed to result from the command) to current dir
|
||||
pub fn run_command(
|
||||
&mut self,
|
||||
|
@ -136,14 +112,13 @@ This is forbidden because we are supposed \
|
|||
let res_output = command.output().map_err(|e| {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"output for command {name}:\n{error}",
|
||||
t!("zipper.command_output",
|
||||
name = command_name,
|
||||
error = e
|
||||
)
|
||||
);
|
||||
Error::zipper(lformat!(
|
||||
"failed to run command '{name}'",
|
||||
Error::zipper(t!(
|
||||
"zipper.command_error",
|
||||
name = command_name
|
||||
))
|
||||
});
|
||||
|
@ -152,35 +127,32 @@ This is forbidden because we are supposed \
|
|||
let mut file = File::open(self.path.join(in_file)).map_err(|_| {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"could not open result of command '{command}'\n\
|
||||
Command output:\n\
|
||||
{output}'",
|
||||
t!("zipper.command_result_error",
|
||||
command = command_name,
|
||||
output = String::from_utf8_lossy(&output.stderr)
|
||||
)
|
||||
);
|
||||
Error::zipper(lformat!(
|
||||
"could not open result of command '{command}'",
|
||||
Error::zipper(t!(
|
||||
"zipper.command_result_err",
|
||||
command = command_name
|
||||
))
|
||||
})?;
|
||||
io::copy(&mut file, out).map_err(|_| {
|
||||
Error::zipper(lformat!("error copying file '{file}'", file = in_file))
|
||||
Error::zipper(t!("zipper.copy_error", file = in_file))
|
||||
})?;
|
||||
|
||||
Ok(String::from_utf8_lossy(&output.stdout).into_owned())
|
||||
} else {
|
||||
debug!(
|
||||
"{}",
|
||||
lformat!(
|
||||
"{command} didn't return succesfully: {output}",
|
||||
command = command_name,
|
||||
format!(
|
||||
"{cmd}: {output}",
|
||||
cmd = t!("zipper.command_no_success", command = command_name),
|
||||
output = String::from_utf8_lossy(&output.stderr)
|
||||
)
|
||||
);
|
||||
Err(Error::zipper(lformat!(
|
||||
"{command} didn't return succesfully",
|
||||
Err(Error::zipper(t!(
|
||||
"zipper.command_no_success",
|
||||
command = command_name
|
||||
)))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue