mirror of
https://github.com/hanzoai/semantic.git
synced 2026-10-30 15:04:19 +00:00
The package doc said the Office formats needed decoders outside the standard library. They do not: OOXML is a zip of XML parts, and archive/zip and encoding/xml read it. Three readers now do, sharing one package walker and one generic helper, part[T], that decodes a named part into whatever shape the reader needs and reports a missing optional part as fs.ErrNotExist. - docx: the body in order; a heading, by outline level or built-in heading style (inherited through basedOn), opens a section at its level; a table is records of "column: value" lines named by its first row; deleted and moved-away revisions are not read. - pptx: one section per slide in the order the deck shows them, titled by the title placeholder, tables as records, speaker notes kept, slide numbers and footers left out. - xlsx: one section per sheet, shared and rich strings resolved, and a number in a date format written as the date: RFC 3339 full-date, partial-time, or the two joined by T, with no zone because a workbook records none. The 1900 system's phantom 29 February and the 1904 system are both honoured. All three return the core properties as tags. A part whose stated size exceeds 256 MiB is refused before it is inflated, and a tree nested past 10,000 elements is refused rather than recursed off the stack. .doc, .xls and .ppt were mapped onto the OOXML names, so a compound file went to a zip reader. They are now their own placeholders and fail with ErrFormat naming what they are. Detect also recognises a document with no extension by its bytes: %PDF-, or a zip whose main part lives under word/, xl/ or ppt/. Co-authored-by: Hanzo Dev <[email protected]>