Merge f2f756102e
into bab29c0de9
This commit is contained in:
commit
16494d50b0
2 changed files with 19 additions and 3 deletions
|
@ -206,10 +206,26 @@ pub fn run(args: Args) -> anyhow::Result<()> {
|
|||
stdout.write_all(buffer.as_bytes())?;
|
||||
}
|
||||
|
||||
let html = match &page.article_body.html {
|
||||
Some(html) => Cow::Borrowed(html),
|
||||
None => {
|
||||
warn!("Article without article_body.html field");
|
||||
if let Some(filter) = args.passthrough {
|
||||
match filter {
|
||||
ArticleFilter::Error | ArticleFilter::Panic => {
|
||||
stdout.write_all(buffer.as_bytes())?
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
continue;
|
||||
}
|
||||
};
|
||||
|
||||
let article_output = if args.no_simplify {
|
||||
Ok(Cow::Borrowed(&page.article_body.html))
|
||||
Ok(html)
|
||||
} else {
|
||||
html::process_str(&page.article_body.html, &page.in_language.identifier).map(Cow::Owned)
|
||||
html::process_str(&html, &page.in_language.identifier).map(Cow::Owned)
|
||||
};
|
||||
|
||||
match article_output {
|
||||
|
|
|
@ -61,7 +61,7 @@ pub struct Wikidata {
|
|||
pub struct ArticleBody {
|
||||
// TODO: Look into RawValue to lazily parse/allocate this:
|
||||
// https://docs.rs/serde_json/latest/serde_json/value/struct.RawValue.html
|
||||
pub html: String,
|
||||
pub html: Option<String>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)] // TODO: Reevaluate fields.
|
||||
|
|
Loading…
Add table
Reference in a new issue