Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Commit

Permalink
Remove duplicate whitespace from comic title
Browse files Browse the repository at this point in the history
  • Loading branch information
mlafeldt committed Oct 10, 2021
1 parent 4b9e536 commit 8dd1bcf
Show file tree
Hide file tree
Showing 2 changed files with 456 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/bin/get-strip/dilbert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ impl Client {
let title = container
.attr("data-title")
.ok_or_else(|| anyhow!("title not found"))?
.trim()
.to_string();
.split_whitespace()
.collect::<Vec<&str>>()
.join(" ");

let image_url = container
.attr("data-image")
.ok_or_else(|| anyhow!("image URL not found"))?
Expand Down Expand Up @@ -124,6 +126,15 @@ mod tests {
},
html: include_str!("testdata/strip/2020-11-11"),
},
Test {
comic: Comic {
date: NaiveDate::from_ymd(2021, 10, 10),
title: "Sunday Data Looks Two Ways".to_string(),
image_url: "https://assets.amuniversal.com/4b9300d0f2400139769e005056a9545d".to_string(),
strip_url: format!("{}/strip/2021-10-10", base_url),
},
html: include_str!("testdata/strip/2021-10-10"),
},
]
}

Expand Down
Loading

0 comments on commit 8dd1bcf

Please sign in to comment.