mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-24 10:46:50 -06:00
xl/sharedStrings.xml can carry phonetic runs (<rPh sb="0" eb="2"><t>ふりがな</t></rPh>) and a <phoneticPr> beside a string item. GridCraft read only the text and wrote every string back as <si><t>…</t></si>, so a plain open + save deleted a Japanese workbook's furigana. Both are now read — offsets validated against the base text, runs with bad or missing offsets, sb >= eb or no reading dropped with a warning, and never used to index — and kept on the workbook as Workbook::phonetics, one entry per string text. The writer emits them next to the <si> of the same text. The saved table holds each text once, so two identical texts cannot keep two different readings: the reader keeps the first and warns. Strings without phonetic data are written byte for byte as before. Behaviour reference: ISO/IEC 29500-1 §18.4.6 rPh and §18.4.7 phoneticPr (Microsoft Learn PhoneticRun/PhoneticProperties). Tests: crates/xlsx/src/tests/phonetic_tests.rs (round trip, plain string, hostile offsets, shared text, unused data, comments and inline strings). Docs: file-format-parity.md, localization-parity.md.