Skip to content

v0.7.0 — a slide holds shapes, and the words are inside them

Latest

Choose a tag to compare

@tannevaled tannevaled released this 10 Oct 20:41
3d1deee

Parse now reads ODP presentations and ODG drawings, which are the same
document: office:presentation and office:drawing both hold draw:page
elements, and a page holds shapes with the words inside them. Walking
office:text found nothing in either — the same silence an .ods gave before
office:spreadsheet was handled.

Each page becomes a heading of its own draw:name followed by the blocks found
in its shapes, so a reader can tell which slide a sentence was on.

⛔ Every rule was read off a file LibreOffice WROTE

The fixtures are files Impress and Draw produced. Four rules came out the
other way from the specification
, and the sharpest is the one the
specification suggests:

the title is not presentation:class="title" Impress strips that attribute from every frame it does not treat as a master-page placeholder, so a converted deck has no classed title frame at all. The heading is the page's own draw:name, which survives a conversion and is always there.
presentation:notes is skipped it holds a frame whose text reads exactly like body text, so walking into it puts words the audience never saw into the document.
a picture is held back Impress writes a draw:image preview of a table into the same frame as the table — Pictures/TablePreview1.svm. A picture is emitted only if its shape held nothing else.
svg:title/svg:desc are the frame's children beside draw:image, not inside it; a reader looking within finds none, and a slide's picture arrives with no alternative text.

The shape types are deliberately not enumerated: ODF has dozens and any of
them may carry text, so the walk descends and collects what it meets.
draw:g, draw:caption and draw:custom-shape work without being named.

TestNoFrameOnARealDeckIsClassedTitle is the witness for the heading rule
rather than a restatement of it: without it the specification's rule could be
reintroduced and every other test would still pass.

maxPages (65 536) joins the ceilings, so a file claiming four million pages
is refused rather than walked.

100 % statement coverage, race clean, go vet and gofmt clean. Four
mutations — notes no longer skipped, the picture no longer held back, the
ceiling raised, the page name dropped — are all caught.