Compare commits

..

1 Commits

Author SHA1 Message Date
Tom Milligan
92b441a950 bin: better error handling 2022-11-26 21:16:40 +00:00
10 changed files with 525 additions and 620 deletions

View File

@@ -70,7 +70,7 @@ jobs:
rust:
- stable
- beta
- 1.64.0
- 1.60.0
experimental:
- false
# Run a canary test on nightly that's allowed to fail

View File

@@ -1,16 +1,7 @@
# Changelog
## Changelog
## Unreleased
### Changed
- MSRV (minimum supported rust version) is now 1.64.0 for clap v4 ([#79](https://github.com/tommilligan/mdbook-admonish/pull/79))
- More verbose error messages for invalid TOML configurations ([#79](https://github.com/tommilligan/mdbook-admonish/pull/79))
### Fixed
- Custom installation and CSS directories are now normalized ([#49](https://github.com/tommilligan/mdbook-admonish/pull/49))
## 1.8.0
### Changed

1084
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@ path = "src/lib.rs"
[dependencies]
anyhow = "1.0.65"
clap = { version = "4", default_features = false, features = ["std", "derive"], optional = true }
env_logger = { version = "0.10", default_features = false, optional = true }
env_logger = { version = "0.9.1", default_features = false, optional = true }
log = { version = "0.4.17", optional = true }
mdbook = "0.4.21"
once_cell = "1.15.0"
@@ -33,8 +33,8 @@ regex = "1.6.0"
semver = "1.0.14"
serde = { version = "1.0.145", features = ["derive"] }
serde_json = "1.0.85"
toml = "0.7.3"
toml_edit = { version = "0.19.8", optional = true }
toml = "0.5.9"
toml_edit = { version = "0.15.0", optional = true }
[dev-dependencies]
pretty_assertions = "1.3.0"

View File

@@ -14,4 +14,4 @@ assets_version = "2.0.0" # do not edit: managed by `mdbook-admonish install`
[output]
[output.html]
additional-css = ["./mdbook-admonish.css"]
additional-css = ["././mdbook-admonish.css"]

View File

@@ -14,4 +14,4 @@ assets_version = "2.0.0" # do not edit: managed by `mdbook-admonish install`
[output]
[output.html]
additional-css = ["./mdbook-admonish.css"]
additional-css = ["././mdbook-admonish.css"]

View File

@@ -29,14 +29,7 @@
<p><a class="admonition-anchor-link" href="#admonition-error-rendering-admonishment"></a></p>
</div>
<div>
<p>Failed with:</p>
<pre><code>TOML parsing error: TOML parse error at line 1, column 8
|
1 | title=&quot;
| ^
invalid basic string
</code></pre>
<p>Failed with: TOML parsing error: unterminated string at line 1 column 7</p>
<p>Original markdown input:</p>
<pre><code>```admonish title=&quot;
No title, only body

View File

@@ -144,10 +144,7 @@ mod install {
let mut additional_css = additional_css(&mut doc);
for (name, content) in ADMONISH_CSS_FILES {
let filepath = proj_dir.join(css_dir.clone()).join(name);
// Normalize path to remove no-op components
// https://github.com/tommilligan/mdbook-admonish/issues/47
let filepath: PathBuf = filepath.components().collect();
let filepath = proj_dir.join(&css_dir).join(name);
let filepath_str = filepath.to_str().context("non-utf8 filepath")?;
if let Ok(ref mut additional_css) = additional_css {

View File

@@ -166,12 +166,7 @@ mod test {
fn test_from_config_string_invalid_toml_value() {
assert_eq!(
from_config_string(r#"note titlel=""#).unwrap_err(),
r#"TOML parsing error: TOML parse error at line 1, column 6
|
1 | note
| ^
expected `.`, `=`
"#
"TOML parsing error: expected an equals, found a newline at line 1 column 6".to_owned()
);
}
}

View File

@@ -264,11 +264,7 @@ fn parse_admonition<'a>(
additional_classnames: Vec::new(),
collapsible: false,
content: Cow::Owned(format!(
r#"Failed with:
```
{message}
```
r#"Failed with: {message}
Original markdown input:
@@ -717,16 +713,7 @@ Error rendering admonishment
</div>
<div>
Failed with:
```
TOML parsing error: TOML parse error at line 1, column 8
|
1 | title="
| ^
invalid basic string
```
Failed with: TOML parsing error: unterminated string at line 1 column 7
Original markdown input: