mirror of
https://github.com/storytold/wordcraft.git
synced 2026-10-27 11:57:36 -06:00
* References: Word sources file import in Manage Sources (#2640) Manage Sources gains Import… and references.sources an "import": path parameter: it reads a b:Sources document (Word's own Sources.xml) into the document's sources with the same reader as a document's own bibliography part. A tag already here is left alone, an untagged entry is matched by title and author or gets a tag like a new source, the whole import is one undo step, and a file that isn't b:Sources is refused. Desktop only; the web build hides the button. The docx reader now shares the b:Sources parser (crates/docx/src/ bibliography.rs) with the import, with the same dedupe and 10,000-source cap; the hostile-input cap test still passes. Tests: docx unit tests (names, kinds, accessed/DOI fallbacks, repeated tags, empty entries, wrong root), engine import test (add, undo, second import, untagged matching, refused file), ui tests (the dialog button asks for a "sources" file; finish_pick imports), wordcraft-cli end to end (import, cite, bibliography, save, reopen; the package's customXml carries the sources). The button's label is in every interface catalogue. ROADMAP progress log and docs/roadmap.md, gaps.md, file-format-parity.md and target-app-parity.md get their rows. * References: review fixes for the sources import (#2640) - read_sources validates the root namespace instead of the local name alone: an un-namespaced or unrelated <Sources> is refused, and both bibliography namespaces read — OOXML's and Word's own 2004/10 (the VBA Source.XML format), the latter mapped onto the canonical b prefix with parse_ns. Tests: the 2004/10 namespace is accepted; a no-namespace or unrelated root is refused. - The import loop builds the tag and (title, author-or-editor) sets once and keeps a per-stem counter, with the stem rule shared with auto_tag (auto_tag_base). Importing thousands of untagged sources no longer costs O(n^3). Test: untagged sources sharing a stem get Riv21, Riv211, Src, and a second import adds none. - docs/target-app-parity.md and docs/file-format-parity.md no longer claim bibliography sources aren't saved in DOCX: #169 and #532 are closed and the round trip exists (#790). * References: doc comments for the sources import helpers (#2640) Hoist the untagged-source matching helper (by_author) to module level and document sources, auto_tag_base and sources_ui, so the functions this PR touches meet CodeRabbit's docstring-coverage pre-merge check. * References: re-apply the sources import's progress notes (#2640) The rebase onto current main took upstream's copies of ROADMAP.md, docs/file-format-parity.md and docs/gaps.md, because the rows this PR adds conflicted with upstream's own appends. Re-apply them on the current text: the progress log and revision rows, the bibliography row's source-format note, and #15's evidence, with each status line's change note. The other two documents (docs/roadmap.md, docs/target-app-parity.md) merged cleanly and keep their rows. --------- Co-authored-by: Brandon Thomas <echelon@gmail.com>