diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..a797ade --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: [lise-henry] \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e1da4c8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,16 @@ +on: + push: + branches: + - main + +jobs: + contrib-readme-job: + runs-on: ubuntu-latest + name: A job to automate contrib in readme + steps: + - name: Contribute List + uses: akhilmhdh/contributors-readme-action@v2.3.6 + with: + readme_path: "README.md" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 7377814..914dd10 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c" dependencies = [ "memchr", ] @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -161,9 +161,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "cc" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6b2562119bf28c3439f7f02db99faf0aa1a8cdfe5772a2ee155d32227239f0" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "libc", ] @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fd304a20bff958a57f04c4e96a2e7594cc4490a0e809cbd48bb6437edaa452d" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", "clap_derive", @@ -201,9 +201,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.3.19" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01c6a3f08f1fe5662a35cfe393aec09c4df95f60ee93b7556505260f75eee9e1" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", @@ -255,7 +255,7 @@ dependencies = [ "entities", "memchr", "once_cell", - "regex 1.9.1", + "regex 1.9.3", "shell-words", "slug", "syntect", @@ -351,9 +351,8 @@ dependencies = [ "hyphenation", "indicatif", "lazy_static 1.4.0", - "log 0.4.19", + "log", "mime_guess", - "mustache", "numerals", "punkt", "rayon", @@ -361,6 +360,7 @@ dependencies = [ "syntect", "tempfile", "textwrap", + "upon", "uuid", "walkdir 2.3.3", "yaml-rust", @@ -393,7 +393,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a749441fe0b30ba727c31367438f7e2f001e6ec23d3c5f417834f2fa17098a27" dependencies = [ "lazy_static 1.4.0", - "regex 1.9.1", + "regex 1.9.3", ] [[package]] @@ -428,17 +428,17 @@ checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" [[package]] name = "epub-builder" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a72a19c37335c0e1d78857d4c1cf64c2fdd927896e7427685c19e67072d25907" +checksum = "a6fcc8fc7b93c7001e0d47c269aa5a30a78a1f44692dc09cc9d0f781378545e1" dependencies = [ "chrono", "eyre", "html-escape", - "log 0.4.19", - "mustache", + "log", "once_cell", - "tempdir", + "tempfile", + "upon", "uuid", "zip", ] @@ -481,7 +481,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" dependencies = [ "bit-set", - "regex 1.9.1", + "regex 1.9.3", ] [[package]] @@ -658,7 +658,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi", - "rustix 0.38.6", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -732,15 +732,6 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -dependencies = [ - "log 0.4.19", -] - [[package]] name = "log" version = "0.4.19" @@ -787,16 +778,6 @@ dependencies = [ "adler", ] -[[package]] -name = "mustache" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51956ef1c5d20a1384524d91e616fb44dfc7d8f249bf696d49c97dd3289ecab5" -dependencies = [ - "log 0.3.9", - "serde", -] - [[package]] name = "num" version = "0.1.42" @@ -1239,11 +1220,11 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2eae68fc220f7cf2532e4494aded17545fce192d59cd996e0fe7887f4ceb575" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick 1.0.3", "memchr", "regex-automata", "regex-syntax 0.7.4", @@ -1251,11 +1232,11 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b6d6190b7594385f61bd3911cd1be99dfddcfc365a4160cc2ab5bff4aed294" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ - "aho-corasick 1.0.2", + "aho-corasick 1.0.3", "memchr", "regex-syntax 0.7.4", ] @@ -1275,15 +1256,6 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - [[package]] name = "rust-freqdist" version = "0.1.5" @@ -1312,9 +1284,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.6" +version = "0.38.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee020b1716f0a80e2ace9b03441a749e402e86712f15f16fe8a8f75afac732f" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" dependencies = [ "bitflags 2.3.3", "errno", @@ -1362,18 +1334,18 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "serde" -version = "1.0.181" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d3e73c93c3240c0bda063c239298e633114c69a888c3e37ca8bb33f343e9890" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.181" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be02f6cb0cd3a5ec20bbcfbcbd749f57daddb1a0882dc2e46a6c236c90b977ed" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2 1.0.66", "quote 1.0.32", @@ -1403,7 +1375,7 @@ version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acee08041c5de3d5048c8b3f6f13fafb3026b24ba43c6a695a0c76179b844369" dependencies = [ - "log 0.4.19", + "log", "termcolor", "time", ] @@ -1479,26 +1451,16 @@ dependencies = [ "yaml-rust", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" -version = "3.7.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5486094ee78b2e5038a6382ed7645bc084dc2ec433426ca4c3cb61e2007b8998" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ "cfg-if", "fastrand", "redox_syscall", - "rustix 0.38.6", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1642,6 +1604,17 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +[[package]] +name = "upon" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a9260fe394dfd8ab204a8eab40f88eb9a331bb852147d24fc0aff6b30daa02" +dependencies = [ + "serde", + "unicode-ident", + "unicode-width", +] + [[package]] name = "utf8-ranges" version = "1.0.5" @@ -1719,7 +1692,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", - "log 0.4.19", + "log", "once_cell", "proc-macro2 1.0.66", "quote 1.0.32", diff --git a/Cargo.toml b/Cargo.toml index 8aa7f40..da065f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,6 @@ doc = false default = ["binary", "syntect"] binary = ["clap", "simplelog", "tempfile", "console", "indicatif", "textwrap"] nightly = ["punkt", "hyphenation"] -odt = [] [build-dependencies] crowbook-intl = "0.2" @@ -51,7 +50,7 @@ html-escape = "0.2" mime_guess = "2" comrak = "0.18" yaml-rust = "0.4" -mustache = "0.9" +upon = "0.7" uuid = { version = "1", features = ["v4"] } walkdir = "2" base64 = "0.21" @@ -71,6 +70,3 @@ clap = { version = "4", optional = true } simplelog = { version = "0.12", optional = true } syntect = { version = "5", optional = true } tempfile = { version = "3", optional = true } - - - diff --git a/README.md b/README.md index 57142d6..37b5210 100644 --- a/README.md +++ b/README.md @@ -20,14 +20,11 @@ either using precompiled binaries, or compiling it using `cargo`. See [the releases page](https://github.com/lise-henry/crowbook/releases) -to download a precompiled binary for your architecture -(currently: Linux, Windows and MacOSX). +to download a precompiled binary for your architecture. Just extract the archive and run `crowbook` (or `crowbook.exe` on Windows). You might also want to copy the binary somewhere in your `PATH` for later usage. -If you are on Debian GNU/Linux or Ubuntu (on a PC architecture), you can also download `.deb` packages on -[the releases page](https://github.com/lise-henry/crowbook/releases). ### Using Cargo @@ -49,16 +46,11 @@ compile it, and install it on your system. > Some dependencies also require building C libraries; > you might thus also need to install a C compiler and `make`/`cmake` build tools. -> You can also try to build a version of Crowbook without optional features: -> `cargo install crowbook --no-default-features --features "clap"` -> will disable syntactic highlighting and proofreading, requiring less dependencies. ## Dependencies -While there should be, strictly speaking, no real dependencies to be able to run Crowbook (it is published as a statically compiled binary), some features require additional commands to work correctly: - -* EPUB rendering requires the `zip` command to be present on your system; -* PDF rendering requires a working installation of LaTeX (preferably `xelatex`). +While there should be, strictly speaking, no real dependencies to be able to run Crowbook (it is published as a statically compiled binary), +PDF rendering requires a working installation of LaTeX (preferably `xelatex`). ## Quick tour @@ -138,12 +130,6 @@ title: My title This is mostly useful when Crowbook is run with the `--single` argument (receiving a single Markdown file instead of a book configuration file), for short texts that only contain one "chapter". -### Proofreading - -Crowbook can also generate "proofreading" copies in HTML or PDF, highlighting grammar errors and repetitions. -For more information, see -[the proofreading chapter of the guide](guide/05_proofreading.md). - ### Interactive fiction Crowbook has experimental support for writing interactive fiction (only for HTML). @@ -162,8 +148,132 @@ See the ## Contributors -* [Stéphane Mourey](http://stephanemourey.fr/) `` -* [Falco Hirschenberger](https://github.com/hirschenberger) + + + + + + + + + + + + + + + + + + + + + + +
+ + lise-henry +
+ Élisabeth Henry +
+
+ + Crowdagger +
+ Lizzie Crowdagger +
+
+ + stefan0xC +
+ Stefan Melmuk +
+
+ + hirschenberger +
+ Falco Hirschenberger +
+
+ + Geobert +
+ Geobert Quach +
+
+ + jrappen +
+ Johannes Rappen +
+
+ + taophp +
+ Stéphane Mourey +
+
+ + dkotrada +
+ Alfa +
+
+ + hfiguiere +
+ Hubert Figuière +
+
+ + dvalter +
+ Dmitry Valter +
+
+ + Dylan-DPC +
+ Dylan DPC +
+
+ + steffahn +
+ Frank Steffahn +
+
+ + cuviper +
+ Josh Stone +
+
+ + mgeisler +
+ Martin Geisler +
+
+ + sigurdsvela +
+ Sigurd Svela +
+
+ + twirrim +
+ Twirrim +
+
+ + ar1ocker +
+ Ar1oc +
+
+ ## Acknowledgements diff --git a/guide.book b/guide.book index 046cfe3..f2db895 100644 --- a/guide.book +++ b/guide.book @@ -41,7 +41,7 @@ proofread.languagetool: true rendering.num_depth: 4 rendering.initials: false rendering.inline_toc: true -rendering.chapter.template: "{{{number}}}. {{{chapter_title}}}" +rendering.chapter.template: "{{number}}. {{chapter_title}}" rendering.chapter.roman_numerals: false rendering.part.reset_counter: true rendering.highlight: syntect @@ -50,8 +50,8 @@ html.highlight.theme: "Solarized (dark)" # Html options html.icon: crowbook.svg -html.header: "{{{title}}} {{{version}}}" -html.footer: "Generated by [Crowbook](https://github.com/lise-henry/crowbook) {{{crowbook_version}}}" +html.header: "{{title}} {{version}}" +html.footer: "Generated by [Crowbook](https://github.com/lise-henry/crowbook) {{crowbook_version}}" html.side_notes: false html.standalone.one_chapter: false @@ -74,7 +74,6 @@ epub.version: 3 + guide/02_config.md + guide/03_markdown.md + guide/04_templates.md -+ guide/05_proofreading.md + guide/06_interactive_fiction.md + guide/07_miscellaneous.md + guide/08_contributing.md diff --git a/guide/01_arguments.md b/guide/01_arguments.md index db3cce5..5e1dc03 100644 --- a/guide/01_arguments.md +++ b/guide/01_arguments.md @@ -182,23 +182,6 @@ crowbook -S Display some statistics (word and character counts) about the book. -## `--proofread` - -**Usage**: - -```bash -crowbook --proofread -``` - -or: - -```bash -crowbook -p -``` - -Equivalent to `--set proofread true`, enables proofreading. -See [Proofreading](05_proofreading.md). - ## `--autograph` **Usage**: diff --git a/guide/02_config.md b/guide/02_config.md index 2f67434..ddde66d 100644 --- a/guide/02_config.md +++ b/guide/02_config.md @@ -299,11 +299,6 @@ Current output options are: * `output.tex`: renders a LaTeX file. * `output.pdf`: renders a PDF file (using `tex.command`). -(There are other output options for generating proofreading files, see -[Proofreading](05_proofreading.md), -and interactive fiction, see -[Interactive fiction](06_interactive_fiction.md).) - #### The `output` option Setting output file names manually can be a bit tedious, and is not always necessary. @@ -643,12 +638,6 @@ The `path` type might puzzle you a bit, but it's equivalent to a string, except - **default value**: `not set` - Output file name for PDF rendering -#### `output.odt` - -- **type**: path -- **default value**: `not set` -- Output file name for ODT rendering - #### `output.html.if` - **type**: path diff --git a/src/lib/book.rs b/src/lib/book.rs index ae0b39a..61577e1 100644 --- a/src/lib/book.rs +++ b/src/lib/book.rs @@ -1,4 +1,4 @@ -// Copyright (C) 2016, 2017, 2018 Élisabeth HENRY. +// Copyright (C) 2016-2023 Élisabeth HENRY. // // This file is part of Crowbook. // @@ -22,15 +22,13 @@ use crate::chapter::Chapter; use crate::cleaner::{Cleaner, CleanerParams, Default, French, Off}; use crate::epub::Epub; use crate::error::{Error, Result, Source}; -use crate::html_dir::{HtmlDir, ProofHtmlDir}; +use crate::html_dir::HtmlDir; use crate::html_if::HtmlIf; -use crate::html_single::{HtmlSingle, ProofHtmlSingle}; +use crate::html_single::HtmlSingle; use crate::lang; -use crate::latex::{Latex, Pdf, ProofLatex, ProofPdf}; +use crate::latex::{Latex, Pdf}; use crate::misc; use crate::number::Number; -#[cfg(feature = "odt")] -use crate::odt::Odt; use crate::parser::Features; use crate::parser::Parser; use crate::resource_handler::ResourceHandler; @@ -38,50 +36,15 @@ use crate::templates::{epub, epub3, highlight, html, html_dir, html_if, html_sin use crate::text_view::view_as_text; use crate::token::Token; -#[cfg(feature = "proofread")] -use crate::grammalecte::GrammalecteChecker; -#[cfg(feature = "proofread")] -use crate::grammar_check::GrammarChecker; -#[cfg(feature = "proofread")] -use crate::repetition_check::RepetitionDetector; -// Dummy grammarchecker thas does nothing to let the compiler compile -#[cfg(not(feature = "proofread"))] -struct GrammarChecker {} -#[cfg(not(feature = "proofread"))] -impl GrammarChecker { - fn check_chapter(&self, _: &[Token]) -> Result<()> { - Ok(()) - } -} -// Dummy grammalectechecker thas does nothing to let the compiler compile -#[cfg(not(feature = "proofread"))] -struct GrammalecteChecker {} -#[cfg(not(feature = "proofread"))] -impl GrammalecteChecker { - fn check_chapter(&self, _: &[Token]) -> Result<()> { - Ok(()) - } -} -// Dummy RepetitionDetector thas does nothing to let the compiler compile -#[cfg(not(feature = "proofread"))] -struct RepetitionDetector {} -#[cfg(not(feature = "proofread"))] -impl RepetitionDetector { - fn check_chapter(&self, _: &[Token]) -> Result<()> { - Ok(()) - } -} - use std::borrow::Cow; use std::cmp::Ordering; -use std::collections::HashMap; +use std::collections::{HashMap, BTreeMap}; use std::fmt; use std::fs::File; use std::io::{Read, Write}; use std::iter::IntoIterator; use std::path::{Path, PathBuf}; -use mustache::{MapBuilder, Template}; use numerals::roman::Roman; use rayon::prelude::*; use yaml_rust::{Yaml, YamlLoader}; @@ -156,7 +119,7 @@ impl fmt::Display for HeaderData { /// // Render the book as html to stdout /// book.render_format_to("html", &mut std::io::stdout()).unwrap(); /// ``` -pub struct Book { +pub struct Book<'a> { /// Internal structure. You should not accesss this directly except if /// you are writing a new renderer. pub chapters: Vec, @@ -177,75 +140,52 @@ pub struct Book { pub features: Features, cleaner: Box, - chapter_template: Option