mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-28 20:37:10 -06:00
* M8.1: Bibliography sources DOCX round-trip Store bibliography sources in package-root custom XML (customXml/item1.xml) with datastore item properties (customXml/itemProps1.xml), relationships, root customXml relationship (_rels/.rels), and content type overrides per ECMA-376 §15.2. Map internal source types to Word b:SourceType values (Book, BookSection, JournalArticle, ArticleInAPeriodical, InternetSite, DocumentFromInternetSite, ElectronicSource, Report, ConferenceProceedings, Case, Art, Film, Interview, Patent, Performance, SoundRecording, Standard, Thesis, Misc) and parse them back. Write SelectedStyle and StyleName attributes on b:Sources. Use safe slice indexing for author names parsing. Scan customXml relationships and customXml/item*.xml on read, extracting sources from b:Sources in the bibliography namespace. Add roundtrip integration tests in crates/docx/tests/roundtrip.rs verifying all parts, relationships, and attributes, update second-generation kitchen sink stability test, add hostile-input tests in crates/docx/tests/malformed.rs, and verify integration with citation styles in engine citations test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * Review fixes for #532: bounded source reading, real citation style - Read at most 10,000 bibliography sources and dedupe them with hash sets, so a hostile file with ~100k b:Source elements can't make opening quadratic; each custom XML part is read at most once (64 parts at most). Test: hostile_bibliography_source_count_is_capped. - Drop the rt::BIBLIOGRAPHY relationship branch (not an OPC relationship type) and the stray comment in write_as. - Write the document's citation style (References > Style) in b:Sources/@StyleName and @SelectedStyle instead of always APA: Settings::bib_style records it, the style command sets it, opening a file reads it back into the session. - The b: namespace goes with the other non-body namespaces (it isn't declared on document.xml), matching #612. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * Keep the custom XML properties relationship apart from customXml So #612, which adds the same rt::CUSTOM_XML line, merges with this branch without a conflict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * clippy: pass parse_persons by value (needless_borrows_for_generic_args) * rustfmt after merging main --------- Co-authored-by: yefan911 <yefan911@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com> Co-authored-by: Brandon Thomas <echelon@gmail.com>