interplane.Get Omega
Read in your language

omega-office

Omega office documents: read and write office files in Omega

Brought by drakestapleton

branch main Branches Tags History

omega-office / corpus / SOURCES.txt

127 lines · 11534 bytes Raw Blame History
1omega-office test corpus: where every file comes from, its licence, and the command that made it.
2Made on the Spark (Linux AArch64) on 2026-11-10, commands run from the repository root unless a scratch
3directory is named. The tools below are test-only oracles and builders, never part of omega-office:
4 LibreOffice 24.2.7.2 (Ubuntu libreoffice-core 4:24.2.7-0ubuntu0.24.04.6), headless, with a scratch profile
5 LO = soffice -env:UserInstallation=file:///tmp/oo/lo-profile --headless
6 Python 3.12.3 (Ubuntu python3.12 3.12.3-1ubuntu0.17), xml.sax over expat 2.6.1 (libexpat1 2.6.1-2ubuntu0.6)
7 Info-ZIP Zip 3.0 (3.0-13ubuntu0.2) and UnZip 6.0 (6.0-28ubuntu4.1); iconv of GNU libc 2.39
8No file was downloaded. Everything is ours (Apache-2.0, the repository LICENSE) except where a line says
9otherwise.
10
11corpus/src: documents written by hand for this corpus (OpenDocument flat XML), ours
12 plain.fodt paragraphs, runs, tabs, line breaks, spaces, non-ASCII, a hyperlink, a tracked insertion,
13 soft hyphen U+00AD, non-breaking hyphen U+2011, no-break space U+00A0, U+202F, a bookmark
14 features.fodt a heading, header and footer, a tracked deletion and insertion, a footnote, a page field,
15 a table, a page break
16 tables.fodt a table with empty and two-paragraph cells, a nested table, a tab and a break in cells
17 lists.fodt a bulleted list, a numbered list, a text frame
18 cells.fods three sheets: strings needing quotes, numbers, booleans, a formula, empty rows and cells,
19 a sheet whose first value is at C3, a sheet named with non-ASCII and a space
20 types.fods boolean, date, time, percentage and scientific formats, an error, string and boolean formulas
21
22corpus/docx, corpus/xlsx: made by LibreOffice from copies in the scratch directory /tmp/oo/lo
23 $LO --convert-to docx NAME.fodt plain, features, tables, lists
24 $LO --convert-to xlsx NAME.fods cells, types
25 $LO --infilter="CSV:44,34,76,1" --convert-to xlsx rows.csv rows (from corpus/gen/rows.csv)
26 omegese.docx: omega-mv 82e536e1 docs/one_layer/OMEGESE.md (sha256 13329b3e1984d4dd...769034381,
27 Apache-2.0, omega-mv LICENSE) copied as omegese.txt;
28 $LO --infilter="Text (encoded):UTF8" --convert-to docx omegese.txt
29 letter.docx: LibreOffice's template /usr/lib/libreoffice/share/template/common/officorr/
30 Modern_business_letter_sans_serif.ott (sha256 46d9cf6db1c27f05...b794d0c) copied as letter.ott;
31 $LO --convert-to docx letter.ott. Licence MPL-2.0 (/usr/share/doc/libreoffice-common/copyright,
32 "Files: *", License: MPL-2.0): test data only.
33
34corpus/hand: package parts written by hand for this corpus, ours
35 alt, strict, utf16, deflt (word processing), xalt, xstrict (spreadsheet), dmin and xmin (minimal packages)
36 squote: dmin with a word/document.xml whose attribute values are in single quotes and hold " and '
37 (the inline attribute path of src/sink.om must stop at the quote that opened the value)
38 utf16/word/document.xml = iconv -f UTF-8 -t UTF-16 corpus/hand/utf16-src.xml (FF FE, little-endian)
39 rp/NAME: the one part each refusal package changes (see corpus/refuse below)
40corpus/pkg: a package from each directory; zip -X leaves out extra fields, [Content_Types].xml goes first:
41 (cd corpus/hand/D && zip -X -q -r ../../pkg/h-D.docx "[Content_Types].xml" $(ls -A | grep -v "^\[Content_Types\].xml$"))
42 (.xlsx for xalt, xstrict, xmin). h-sstmax.xlsx: a copy of hand/xmin with hand/rp/rq-sstmax/ over it and
43 corpus/gen/sst1048576.xml as xl/sharedStrings.xml, zipped the same way.
44
45corpus/xml: XML files written byte for byte with printf, ours
46 x-basic.xml printf "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n<!-- a comment before the root -->\n<?pi before root?>\n<a:root xmlns:a=\"urn:example:a\" xmlns=\"urn:example:default\" plain=\"v&amp;w\" a:q=\"&#x41;&#66;&lt;&gt;&quot;&apos;\"><b>t&lt;x&gt;<![CDATA[<raw & text>]]]]>y &#x10437; \xc3\xa9</b><c/><c />\r\n<?pi data?>tail\r\nline\rlone</a:root>\n<!-- after -->\n"
47 x-ns.xml printf "<r xmlns=\"urn:d\" xmlns:p=\"urn:p\" xmlns:q=\"urn:p\" p:x=\"1\" q:y=\"2\" u=\"3\" xml:lang=\"en\"><e xmlns=\"\"><p:f xmlns:p=\"urn:p2\" p:z=\"4\"/></e><e2/><s:t s:a=\"5\" xmlns:s=\"urn:s\"/></r>"
48 x-text.xml printf "<r a=\"tab\tlf\ncr\rcrlf\r\nend\" b=\"&#9;&#10;&#13;&#32;\" c=\"&#x20;&#xA;\">]] and > and ]>: <![CDATA[]]]><![CDATA[]>]]><![CDATA[]]]]>\t\r\n\r</r>"
49 x-names.xml printf "<\xc3\xa9l\xc3\xa9ment _u-n.d1=\"x\" \xe4\xb8\xad:\xe6\x96\x87=\"y\" xmlns:\xe4\xb8\xad=\"urn:cjk\"><\xe4\xb8\xad:\xe5\xad\x90\xc2\xb7a/></\xc3\xa9l\xc3\xa9ment>"
50 x-ns-local.xml printf "<a:\xc3\xa9 xmlns:a=\"urn:x\" a:_x=\"1\" a:b-c.d=\"2\" xmlns:q\xc2\xb7=\"urn:y\" q\xc2\xb7:\xe4\xb8\xadz=\"3\"><q\xc2\xb7:z/></a:\xc3\xa9>"
51 x-ns-local2.xml printf "<a:\xd0\x96 xmlns:a=\"urn:x\" a:\xe0\xa4\x85=\"1\" xmlns:\xd0\x96q=\"urn:y\" \xd0\x96q:\xe3\x82\xa2=\"2\"><\xd0\x96q:\xe0\xa4\x85b/></a:\xd0\x96>"
52 (the character after each colon decoded from lead bytes 0xD0, 0xE0, 0xE3, which x-ns-local.xml lacks)
53 x-bom.xml printf "\xef\xbb\xbf<?xml version='1.0' encoding='utf-8' ?><r a = \"1\" b= '2' >x</r >"
54 x-misc.xml printf "<?xml version=\"1.0\" standalone=\"no\"?><r><!-- - a-b --><?t a?b ?c?><e a=\">\" /></r>"
55 x-nodecl.xml printf "<r>no declaration</r>"
56 x-utf16le.xml iconv -f UTF-8 -t UTF-16 corpus/xml/x-names.xml
57 x-utf16be.xml { printf "\xfe\xff"; iconv -f UTF-8 -t UTF-16BE corpus/xml/x-ns.xml; }
58 x-big.xml { printf "<big>"; head -c 200000 OMEGESE.md | sed -e "s/&/\&amp;/g" -e "s/</\&lt;/g"; printf "</big>"; }
59 (OMEGESE.md as above, 115 KiB: one text run above the 64 KiB text buffer; Apache-2.0)
60
61corpus/gen: written by tests/mkcases.om (Omega, in this repository), ours:
62 OMC < tests/mkcases.om > build/mkcases && chmod +x build/mkcases && build/mkcases corpus/gen
63 rb-*.xml (each bound and one past it), rows.csv, sst1048576.xml and sst1048577.xml. The two sst files
64 (17 MiB each) are not committed (.gitignore); the command regenerates them byte-identical; the packages
65 that hold them (pkg/h-sstmax.xlsx, refuse/rq-sstmany.xlsx) are committed.
66
67corpus/refuse: refusal fixtures, ours
68 rx-*.xml: printf, one command each; the file is the command's whole output (od -c corpus/refuse/rx-NAME.xml):
69 rx-doctype "<!DOCTYPE r [<!ENTITY e \"x\">]><r>&e;</r>" rx-doctype-ext "<!DOCTYPE r SYSTEM \"http://example.org/x.dtd\"><r/>"
70 rx-entity "<r>&nbsp;</r>" rx-cref0 "<r>&#0;</r>" rx-cref-surrogate "<r>&#xD800;</r>" rx-cref-big "<r>&#x110000;</r>"
71 rx-cref-fffe "<r>&#xFFFE;</r>" rx-cref-upperx "<r>&#X41;</r>" rx-bare-amp "<r>a & b</r>" rx-lt-in-attr "<r a=\"<\"/>"
72 rx-mismatch "<a><b></a></b>" rx-truncated "<a><b>text" rx-two-roots "<a/><b/>" rx-text-before "x<a/>"
73 rx-text-after "<a/>x" rx-cdata-outside "<![CDATA[x]]><a/>" rx-comment-dashes "<a><!-- a -- b --></a>"
74 rx-comment-end "<a><!-- a ---></a>" rx-cdata-end-in-text "<a>x]]>y</a>" rx-utf8-bad "<a>\xc3\x28</a>"
75 rx-utf8-overlong "<a>\xc0\xaf</a>" rx-utf8-surrogate "<a>\xed\xa0\x80</a>" rx-control "<a>\x01</a>" rx-fffe "<a>\xef\xbf\xbe</a>"
76 rx-utf16-lone "\xff\xfe<\x00a\x00>\x00\x00\xd8<\x00/\x00a\x00>\x00" rx-utf16-odd "\xff\xfe<\x00a\x00/\x00>\x00\x0a"
77 rx-utf16-nobom "<\x00a\x00/\x00>\x00" rx-latin1 "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?><a>\xe9</a>"
78 rx-utf16-declared "<?xml version=\"1.0\" encoding=\"UTF-16\"?><a/>" rx-version11 "<?xml version=\"1.1\"?><a/>"
79 rx-decl-not-first " <?xml version=\"1.0\"?><a/>" rx-decl-no-version "<?xml encoding=\"UTF-8\"?><a/>"
80 rx-pi-reserved "<a><?XML x?></a>" rx-ns-undeclared "<p:a/>" rx-ns-undeclared-attr "<a p:x=\"1\"/>"
81 rx-ns-empty-prefix "<a xmlns:p=\"\"/>" rx-ns-xmlns-prefix "<a xmlns:xmlns=\"urn:x\"/>" rx-ns-xml-wrong "<a xmlns:xml=\"urn:x\"/>"
82 rx-ns-bind-xml "<a xmlns:p=\"http://www.w3.org/XML/1998/namespace\"/>" rx-ns-two-colons "<a:b:c xmlns:a=\"urn:x\"/>"
83 rx-ns-local-digit "<a:1b xmlns:a=\"urn:x\"/>" rx-ns-local-attr "<a xmlns:p=\"urn:x\" p:-x=\"1\"/>" rx-ns-decl-digit "<a xmlns:1p=\"urn:x\"/>"
84 rx-ns-local-middot "<a:\xc2\xb7b xmlns:a=\"urn:x\"/>" (a local part is an NCName: it starts with a NameStartChar)
85 rx-ns-element-xmlns "<xmlns:a/>" rx-dup-attr "<a x=\"1\" x=\"2\"/>" rx-dup-expanded "<a xmlns:p=\"urn:x\" xmlns:q=\"urn:x\" p:x=\"1\" q:x=\"2\"/>"
86 rx-empty "" rx-no-root "<!-- only a comment -->" rx-attr-no-eq "<a x\"1\"/>" rx-attr-unquoted "<a x=1/>"
87 rx-utf8-then-mismatch "<a>\xc3\x28</b>" (a bad byte, then a mismatched end tag: the bad byte must win)
88 rx-attr-no-space "<a x=\"1\"y=\"2\"/>" rx-name-start "<1a/>" rx-end-space "<a></ a>" rx-comment-unclosed "<a/><!-- unclosed"
89 rp-NAME.docx: a copy of corpus/hand/dmin with corpus/hand/rp/rp-NAME/ over it, zipped as corpus/pkg above;
90 rp-norels.docx without _rels/.rels, rp-noct.docx without [Content_Types].xml.
91 rq-NAME.xlsx: a copy of corpus/hand/xmin with corpus/hand/rp/rq-NAME/ over it; rq-sstmany.xlsx: xmin with
92 corpus/gen/sst1048577.xml as xl/sharedStrings.xml.
93 corpus/refuse/ORACLE.txt: expat's verdict on each XML refusal fixture and on the changed part of the
94 XML-level package fixtures.
95
96corpus/expect: the oracles' outputs
97 NAME.ev: the xmlev oracle (below) on corpus/xml/NAME.xml, corpus/gen/NAME.xml, or, for NAME.PART.ev, on
98 the part extracted with unzip -p PACKAGE PART.
99 NAME.lo.txt: $LO --convert-to "txt:Text (encoded):UTF8" --outdir OUT PACKAGE.docx (the file as written)
100 NAME.N.lo.csv: $LO --convert-to "csv:Text - txt - csv (StarCalc):44,34,76,1,,0,false,true,false,false,false,N"
101 --outdir OUT PACKAGE.xlsx: comma, double quote, UTF-8, token 9 false (cell values as stored, not as
102 shown), token 12 = N (sheet N only).
103 features.txt, lists.txt, tables.txt, h-strict.txt, types.1.csv: officeread's output after review against the
104 LibreOffice output: NAME.lo.diff is the difference after the stated normalisation, every hunk one of the
105 classes in README "Oracles".
106 h-alt.txt, h-deflt.txt, h-xalt.1.csv, h-xalt.2.csv, h-xalt.sheets: written by hand with printf from
107 the clauses README cites (LibreOffice does not open h-alt.docx or h-deflt.docx); h-xalt.1.lo.diff is the
108 LibreOffice difference for h-xalt.1.csv; h-xalt.2.csv equals LibreOffice's h-xalt.2.lo.csv, which the gate uses.
109 cells.sheets, types.sheets: the sheet names LibreOffice gives its per-sheet CSV files, in order.
110
111The xmlev oracle (python3 FILE.py PATH > NAME.ev), the whole program:
112 import sys, xml.sax
113 from xml.sax.handler import feature_namespaces
114 def e(s): return s.replace("\\", "\\\\").replace("\n", "\\n").replace("\t", "\\t").replace("\r", "\\r")
115 o = []; t = [None]
116 def fl():
117 if t[0] is not None: o.append("T " + e(t[0])); t[0] = None
118 class H(xml.sax.ContentHandler):
119 def startElementNS(s, n, q, a):
120 fl(); o.append("( {%s}%s" % (n[0] or "", n[1]))
121 for k in a.getNames(): o.append("A {%s}%s %s" % (k[0] or "", k[1], e(a.getValue(k))))
122 def endElementNS(s, n, q): fl(); o.append(") {%s}%s" % (n[0] or "", n[1]))
123 def characters(s, c): t[0] = (t[0] or "") + c
124 p = xml.sax.make_parser(); p.setFeature(feature_namespaces, True); p.setContentHandler(H())
125 try: p.parse(sys.argv[1])
126 except Exception as x: sys.stderr.write("ERROR %s\n" % x); sys.exit(1)
127 sys.stdout.buffer.write("".join(l + "\n" for l in o).encode())