Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve docs for maintainability, update highlightjs and replace colours with colors #64

Closed
wants to merge 6 commits into from

Conversation

jrappen
Copy link
Contributor

@jrappen jrappen commented Dec 2, 2019

See commits for details:

@jrappen
Copy link
Contributor Author

jrappen commented Dec 2, 2019

To view the changes while ignoring whitespace-changes, add ?w=1 when viewing the "Files changed" tab:

https://github.com/lise-henry/crowbook/pull/64/files?w=1

@crowdagger
Copy link
Owner

Thanks for your contribution! Unfortunately, I can't merge this right now because of the "colors"/"colours" thing. Not that i'm particularly opinionated on this matter, but currently the options are spelled "colors" and changing that would break existing configuration files for no real good reason. (Enabling both could be an potion, though.)

@jrappen
Copy link
Contributor Author

jrappen commented Dec 13, 2019

Some leftovers:

diff --git a/ChangeLog.md b/ChangeLog.md
index 79d5536..a7e9ed7 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -380,19 +380,19 @@ Fixed a bug in `fr.po` translation that prevented building from fresh install.
 This release contains some breaking changes (mostly for the API, which has been split in separate libraries). It alse features some internationalization support, and
 the program should now be tranlated if your `LANG` environment
 variable is set to french.
-* **Breaking changes**: 
+* **Breaking changes**:
   * Templates:
-   * Conditional inclusion depending on `lang` must now be done using `lang_LANG` (e.g. 
-   `lang_fr`, `lang_en`, and so on). This might impact custom `epub.css` and `html.css` 
-   templates. 
+   * Conditional inclusion depending on `lang` must now be done using `lang_LANG` (e.g.
+   `lang_fr`, `lang_en`, and so on). This might impact custom `epub.css` and `html.css`
+   templates.
   * API:
     * The `escape` module has been moved to a separate crate,
       `crowbook_text_processing`. The `cleaner` module is no longer
       public, but the features it provided are also available in
-      `crowbook_text_processing`. 
+      `crowbook_text_processing`.
 * New options:
   * `html.css.colors` allows to provide a CSS file that only redefine
-    the colour scheme. Such a file can be built from `crowbook
+    the color scheme. Such a file can be built from `crowbook
     --print-template html.css.colors`.
   * `input.smart_quotes`: if set to `true`, tries to replace `'` and `"` by curly quotes.
 * Command line interface:
@@ -404,7 +404,7 @@ variable is set to french.
   * HTML:
     * The table of contents menu is no longer displayed in the HTML single renderer if
       it doesn't contain at least two elements.
-   * The default colour theme has been modified a little.
+   * The default color theme has been modified a little.
 * Bugfixes:
   * Fix the escaping of non-breaking spaces in EPUB, as ` ` and
     its friends aren't valid entities in XHTML, apparently.
diff --git a/guide/templates.md b/guide/templates.md
index 5d06bb8..bb00824 100644
--- a/guide/templates.md
+++ b/guide/templates.md
@@ -133,7 +133,7 @@ The main CSS file used by both the standalone HTML renderer and the multiple fil
 
 ### html.css.colors
 
-A CSS file containing only colour settings.
+A CSS file containing only color settings.
 Used by `html.css`.
 
 This is not currently an actual template, just a plain CSS file which cannot contain `mustache` tags.
diff --git a/src/lib/html.rs b/src/lib/html.rs
index 4a8370b..c5e1790 100644
--- a/src/lib/html.rs
+++ b/src/lib/html.rs
@@ -426,13 +426,13 @@ impl<'a> HtmlRenderer<'a> {
                                        escape::quotes(s.as_str()),
                                        content))
                         }
-                        Data::Repetition(ref colour) => {
+                        Data::Repetition(ref color) => {
                             if !this.as_ref().verbatim {
                                 Ok(format!("<span class = \"repetition\" \
                                             style = \"text-decoration-line: underline; \
                                             text-decoration-style: wavy; \
-                                            text-decoration-color: {colour}\">{content}</span>",
-                                           colour = colour,
+                                            text-decoration-color: {color}\">{content}</span>",
+                                           color = color,
                                            content = content))
                             } else {
                                 Ok(content)
diff --git a/src/lib/latex.rs b/src/lib/latex.rs
index 9d4bdfb..95c6ba1 100644
--- a/src/lib/latex.rs
+++ b/src/lib/latex.rs
@@ -530,8 +530,8 @@ impl<'a> Renderer for LatexRenderer<'a> {
                                        content,
                                        escape::tex(s.as_str())))
                         },
-                        Data::Repetition(ref colour) => {
-                            if !self.escape && colour == "red" {
+                        Data::Repetition(ref color) => {
+                            if !self.escape && color == "red" {
                                 Ok(format!("\\underline{{{}}}",
                                            content))
                             } else {
diff --git a/src/lib/repetition_check.rs b/src/lib/repetition_check.rs
index 3de2e7c..e756182 100644
--- a/src/lib/repetition_check.rs
+++ b/src/lib/repetition_check.rs
@@ -74,12 +74,12 @@ impl RepetitionDetector {
                         .map_err(|err| Error::default(Source::empty(),
                                                       lformat!("error detecting repetitions: {err}",
                                                        err = err)))?;
-                    
+
                     parser.detect_local(&mut ast, self.threshold);
                     let repetitions = parser.ast_to_repetitions(&ast);
                     for repetition in &repetitions {
                         insert_annotation(v,
-                                          &Data::Repetition(repetition.colour.to_string()),
+                                          &Data::Repetition(repetition.color.to_string()),
                                           repetition.offset,
                                           repetition.length);
                     }

@jrappen
Copy link
Contributor Author

jrappen commented Dec 13, 2019

@lise-henry Ok. I'll go ahead and close this. For manual merge later on on your side see:

https://patch-diff.githubusercontent.com/raw/lise-henry/crowbook/pull/64.patch

@jrappen jrappen closed this Dec 13, 2019
crowdagger added a commit that referenced this pull request Dec 15, 2019
…urs with colors

Merge patch from jrappen, see #64
+ mark "html.css.colours" as deprecated (but still a working alias)
@jrappen
Copy link
Contributor Author

jrappen commented Dec 16, 2019

@lise-henry I see you went ahead and manually merged the suggested changes. Thanks, appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants