Skip to content

Commit

Permalink
import: use domain name of blog post as Author.display_handle (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
delan committed Oct 3, 2024
1 parent f05df33 commit cd00ee0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/command/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@ pub async fn main(mut args: impl Iterator<Item = String>) -> eyre::Result<()> {
let author = if has_class(p_author.clone(), "h-card")? {
let card_url = mf2_u(p_author.clone(), "u-url", &base_href)?;
let card_name = mf2_p(p_author.clone(), "p-name")?.ok_or_eyre(".h-card has no .p-name")?;
let url = card_url.unwrap_or(u_url.clone());
Author {
href: card_url.unwrap_or(u_url.clone()).to_string(),
href: url.to_string(),
name: card_name.clone(),
display_name: card_name.clone(),
display_handle: "".to_owned(),
display_handle: url.authority().to_owned(),
}
} else {
let p_author = mf2_p(p_author.clone(), "p-author")?
Expand All @@ -70,7 +71,7 @@ pub async fn main(mut args: impl Iterator<Item = String>) -> eyre::Result<()> {
href: u_url.to_string(),
name: p_author.clone(),
display_name: p_author.clone(),
display_handle: "".to_owned(),
display_handle: u_url.authority().to_owned(),
}
};
trace!(?author);
Expand Down

0 comments on commit cd00ee0

Please sign in to comment.