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

Feature/577 complete onix 3 1 #664

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

brendan-oconnell
Copy link
Contributor

@brendan-oconnell brendan-oconnell commented Jan 10, 2025

@brendan-oconnell brendan-oconnell self-assigned this Feb 3, 2025
@brendan-oconnell brendan-oconnell linked an issue Feb 3, 2025 that may be closed by this pull request
…ion for <PageRun> and <NumberOfPages> and move inside <TextItem> composite, break tests into smaller sections
@brendan-oconnell brendan-oconnell marked this pull request as ready for review February 4, 2025 14:45
thoth-export-server/src/data.rs Show resolved Hide resolved
thoth-export-server/src/xml/onix312_thoth.rs Show resolved Hide resolved
thoth-export-server/src/xml/onix312_thoth.rs Show resolved Hide resolved
thoth-export-server/src/xml/onix312_thoth.rs Show resolved Hide resolved
for language in &chapter.languages {
XmlElementBlock::<Onix312Thoth>::xml_element(language, w).ok();
}
if chapter.short_abstract.is_some()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Split these into individual ifs, removing the extra check inside the function (you're checking if either of these attributes is some, and then again in each function)

.map_err(|e| e.into())
})?;
let identifiers: Vec<(&str, Option<&str>)> = vec![
("programname", self.program.as_deref().to_owned()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's no need to clone with to_owned since Option<&str> is just a reference

write_element_block("FundingIdentifier", w, |w| {
// 01 Proprietary
write_element_block("FundingIDType", w, |w| {
w.write(XmlEvent::Characters("01")).map_err(|e| e.into())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All .map_err(|e| e.into()) can be turned into .map_err(Into::into)

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.

Produce complete ONIX 3.1
2 participants