test(fixtures): replace sector-specific example material with generic, fictitious examples — green
Every fixture, test document, tool example and document now uses an invented kitchen-and-baking handbook series, written in this repository. The package's behaviour is unchanged; src/ changes are comments and help text only. - Generated fixtures are regenerated from their generators. Their structural counts are identical before and after: elements, images, rows, cells, headings, bookmarks and the witness inventory's per-document totals. The image-inbox and accounting documents are renamed kapittel-84-*. - tools/okf_accounting_gate.py: the two options that named one real corpus each are replaced by a generic, repeatable --corpus PATH with no default. Row 5 compares the PDF pair alone. Gate verdict unchanged: RED rows 2, 3, 6. - tools/okf_witness.py: the STS JSON reader for one publisher's delivery is removed, along with its three twins and five tests. The mutation harness loses W09. - docs/: 13 dated reports that documented runs on a retired reference corpus are removed, and 40 are neutralized. Dead links are removed, and no new dangling path is introduced. - The synthetic MCP-gate corpus and the residual probe words are neutral. Valgt: keep the `okf quality --fasit` bar value (the measured fraction, one corpus) and rewrite only its provenance, because the verdict stays unchanged and the number names nothing. Term check with the local list: 0 of 411 tracked files, 0 file names, 0 of 27 binary fixtures. Suite after git add: 2457 passed, 1 skipped. The base tree had 2460 passed and 2 skipped; five tests went with the JSON reader and four were added by the term check. ruff, ruff format and mypy --strict src/ are clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
1e7345a401
commit
9d1f4b14ed
174 changed files with 1889 additions and 6512 deletions
18
tests/fixtures/README.md
vendored
18
tests/fixtures/README.md
vendored
|
|
@ -17,7 +17,7 @@ and reproducible from that one file.
|
|||
|---|---|
|
||||
| `two-line-krav.pdf` | One heading plus one requirement row with label and value on the **same line**. That pairing is the property `pdfplumber` was chosen for. |
|
||||
| `no-text-layer.pdf` | A structurally valid page with no text operators — the shape a scanned or image-only PDF presents. Must fail fast (`extractor_empty_pdf`), never persist as an empty concept. |
|
||||
| `outline-collision.pdf` | **Two bookmarks whose destinations resolve to the same line** — the tree's root node and a front-matter node, both on line 0, which is the shape R761 carries. The marks are collected in a dict keyed on the line index, so without this fixture the second node is dropped with nothing counting it: 2 763 nodes in, 2 762 marks out, `unresolved` at 0. A one-bookmark-per-line fixture cannot see that. |
|
||||
| `outline-collision.pdf` | **Two bookmarks whose destinations resolve to the same line** — the tree's root node and a front-matter node, both on line 0, which is the shape a 701-page reference standard carries. The marks are collected in a dict keyed on the line index, so without this fixture the second node is dropped with nothing counting it: 2 763 nodes in, 2 762 marks out, `unresolved` at 0. A one-bookmark-per-line fixture cannot see that. |
|
||||
| `three-page-krav.pdf` | Three pages, one line of text each, and **the middle page carries no text operators**. The extractor drops empty pages, so the last page's text belongs to page 3 — which is what separates a page NUMBER from a count of the pages that produced text. Two pages could not tell those apart. |
|
||||
|
||||
## The XML fixtures
|
||||
|
|
@ -31,9 +31,9 @@ round-trip-symmetric defect.
|
|||
|
||||
| Fixture | What it is for |
|
||||
|---|---|
|
||||
| `sts-mini.xml` | The known-positive. A `<standard>` root with `<sec>` at three nesting levels carrying `<label>`+`<title>`, two lettered points (`a)`, `b)`) with a **label and no title**, one `<table-wrap>` with a label and two rows, `<p>` bodies, a `<list>`, and **one unnumbered section** (`Forord`, `<title>` with no `<label>`) mirroring the single such section in R761. The lettered points are what the 4 954 label-only `<sec>` in that document look like: promoted to headings they would bury its own 2 761. |
|
||||
| `sts-empty-label.xml` | A `<sec>` carrying a `<label>` and **nothing else**, between a lettered point that has a body and the next titled section. The label is held as a prefix for a body line that never arrives, so it was overwritten and lost: measured on R761 that is exactly one `x)`, two characters of 1 283 395, ratio 0.999998. An exact invariant does not get to be 0.999998. |
|
||||
| `sts-identity.xml` | A document that **states who it is**: exactly one `<std-ident>` with a `<doc-number>` and a `<year>`, one `<title-wrap>` whose `<full>` carries a **comma** (as R761's does, which is why that title cannot be written into a `sources` flow mapping verbatim), and a `<std-ref type="dated">`. Its body carries the `sec-type="spec"` shape the `description` rule reads: a titled `<sec>` whose first spec point has one `<p>`, a second spec point that must never become the description, a titled child with no spec point of its own, and a spec point with **two** `<p>` of which only the first counts. `sts-mini.xml` is the half identity (a `<title-wrap>`, no `<doc-number>`) and `sts-empty-label.xml` the absent one. |
|
||||
| `sts-mini.xml` | The known-positive. A `<standard>` root with `<sec>` at three nesting levels carrying `<label>`+`<title>`, two lettered points (`a)`, `b)`) with a **label and no title**, one `<table-wrap>` with a label and two rows, `<p>` bodies, a `<list>`, and **one unnumbered section** (`Forord`, `<title>` with no `<label>`) mirroring the single such section in that reference standard. The lettered points are what the 4 954 label-only `<sec>` in that document look like: promoted to headings they would bury its own 2 761. |
|
||||
| `sts-empty-label.xml` | A `<sec>` carrying a `<label>` and **nothing else**, between a lettered point that has a body and the next titled section. The label is held as a prefix for a body line that never arrives, so it was overwritten and lost: measured on the reference standard that is exactly one `x)`, two characters of 1 283 395, ratio 0.999998. An exact invariant does not get to be 0.999998. |
|
||||
| `sts-identity.xml` | A document that **states who it is**: exactly one `<std-ident>` with a `<doc-number>` and a `<year>`, one `<title-wrap>` whose `<full>` carries a **comma** (as the reference standard's does, which is why that title cannot be written into a `sources` flow mapping verbatim), and a `<std-ref type="dated">`. Its body carries the `sec-type="spec"` shape the `description` rule reads: a titled `<sec>` whose first spec point has one `<p>`, a second spec point that must never become the description, a titled child with no spec point of its own, and a spec point with **two** `<p>` of which only the first counts. `sts-mini.xml` is the half identity (a `<title-wrap>`, no `<doc-number>`) and `sts-empty-label.xml` the absent one. |
|
||||
| `generic-feed.xml` | Known-negative: XML that is **not** STS. It must produce text and ONE plan — never zero, never a crash, and never element names promoted to headings. |
|
||||
| `xml-doctype-bomb.xml` | Known-negative, security: a `<!DOCTYPE` with a small nested-entity expansion. It must be refused by `code`, and the test asserts the expansion appears in **no** output, including the error text. Small on purpose — the point is that it is never parsed, not that it detonates. |
|
||||
| `xml-malformed.xml` | Known-negative: an unterminated tag must raise a typed `ExtractionError`, not leak `ParseError` and not yield zero concepts in silence. |
|
||||
|
|
@ -208,13 +208,13 @@ python3 tests/fixtures/accounting/make_accounting_fixtures.py
|
|||
|
||||
| Fixture | What it carries that nothing else did |
|
||||
|---|---|
|
||||
| `topptekst-og-kommentar.docx` | A header, a footer, a comment, an endnote and a **text box** -- and a footnote, a table and a heading, three types the only other docx has at 0. The header says "Utkast - gjelder ikke etter 2026-01-01" and the comment says the requirement does NOT apply in tunnels: two statements that reverse the document's meaning and that the build carries none of. |
|
||||
| `topptekst-og-kommentar.docx` | A header, a footer, a comment, an endnote and a **text box** -- and a footnote, a table and a heading, three types the only other docx has at 0. The header says "Utkast - gjelder ikke etter 2026-01-01" and the comment says the requirement does NOT apply in basements: two statements that reverse the document's meaning and that the build carries none of. |
|
||||
| `notater-og-skjult.pptx` | A **speaker note** and a **hidden slide** (`show="0"`), plus a table and paragraphs. A hidden slide counted as an ordinary one is indistinguishable from one that is shown. |
|
||||
| `skjult-ark-og-formel.xlsx` | A **hidden sheet**, a **formula** (`<f>B2*2</f>`) and a **picture**. The picture is what makes the operator's `.xlsx image` exception exercisable at all: the old fixture had none. |
|
||||
| `liste-og-bilde.odt` | A **header and footer** (they live in `styles.xml`, so a reader of `content.xml` cannot see them), an **annotation**, a list and a picture. |
|
||||
| `bilde.rtf` | A `\pict` picture: the rtf witness's image count was 0 in its only fixture. |
|
||||
| `figur.html` | A picture and a table under `.html`; `side.htm` gained one too, so `.htm` and `.html` each exercise `image`. |
|
||||
| `sts-rikt.xml` | A **`mixed-citation`**, an **`mml:math`**, a **`fig` with a caption**, a table with a label, cells, a list item and a footnote -- six STS roles the R761 delivery does not contain at all, which is why the gate's only real corpus could not see the hole in the role map. |
|
||||
| `sts-rikt.xml` | A **`mixed-citation`**, an **`mml:math`**, a **`fig` with a caption**, a table with a label, cells, a list item and a footnote -- six STS roles a plain section-and-paragraph document does not carry, so each one of them reaches the role map. |
|
||||
|
||||
### The hand counts
|
||||
|
||||
|
|
@ -227,9 +227,7 @@ fixture's own bytes -- the XML parts of a zip, the control words of the rtf,
|
|||
the objects of the PDF -- never by running the witness and writing down what
|
||||
it said.
|
||||
|
||||
`witness/prosess-84-sts.twin.json` is the STS document written by hand in the
|
||||
publisher's JSON node form (`standardContent`, nodes with `e`/`t`/`x`), so the
|
||||
two STS witnesses can be compared on a fixture as well as on R761. Eight of
|
||||
Eight of
|
||||
the thirteen documents are byte copies of fixtures documented above
|
||||
(`image-inbox/`, `k2-office/`, `prisark.xlsx`); the other five
|
||||
(`notat.md`, `logg.txt`, `mengder.csv`, `parametre.json`, `side.htm`) are
|
||||
|
|
@ -238,7 +236,7 @@ heading.
|
|||
|
||||
## What these fixtures do not cover
|
||||
|
||||
Structured table recovery. Measured on real Vegnormalene, only 45 of 196
|
||||
Structured table recovery. Measured on a real regulatory reference corpus, only 45 of 196
|
||||
detected table objects are clean enough to hand to `render_table` unchanged;
|
||||
two independent parsers return the same wrong shape, because the breakage is in
|
||||
the documents' ruling geometry rather than in either library. PDFs enter this
|
||||
|
|
|
|||
4
tests/fixtures/accounting/corpus/figur.html
vendored
4
tests/fixtures/accounting/corpus/figur.html
vendored
|
|
@ -3,9 +3,9 @@
|
|||
<head><title>Figur 84-1</title></head>
|
||||
<body>
|
||||
<h1>Figur 84-1</h1>
|
||||
<p>Prinsippet for toleranseklasser.</p>
|
||||
<p>Prinsippet for hevetidsklasser.</p>
|
||||
<img src="graphics/figur-84-1.png" alt="Prinsippskisse">
|
||||
<table><tr><th>Klasse</th><th>Avvik</th></tr><tr><td>A</td><td>5 mm</td></tr></table>
|
||||
<table><tr><th>Klasse</th><th>Avvik</th></tr><tr><td>A</td><td>5 min</td></tr></table>
|
||||
<ul><li>Klasse A</li><li>Klasse B</li></ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<standard xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<front><std-ident><doc-number>R761</doc-number></std-ident></front>
|
||||
<front><std-ident><doc-number>P761</doc-number></std-ident></front>
|
||||
<body>
|
||||
<sec>
|
||||
<label>84</label>
|
||||
<title>Konstruksjoner av betong</title>
|
||||
<title>Brød og boller</title>
|
||||
<sec>
|
||||
<label>84.1</label>
|
||||
<title>Toleranser</title>
|
||||
<p>Toleranseklasse er gitt i tabell 84-2.</p>
|
||||
<title>Hevetider</title>
|
||||
<p>Hevetidsklasse er gitt i tabell 84-2.</p>
|
||||
<graphic xlink:href="graphics/tabell-84-2.png"/>
|
||||
<p>Figur 84-1 viser prinsippet.</p>
|
||||
<graphic xlink:href="figur-84-1.png"/>
|
||||
Binary file not shown.
|
|
@ -1,9 +1,9 @@
|
|||
<!doctype html>
|
||||
<html><head><title>Prosess 84</title></head>
|
||||
<html><head><title>Kapittel 84</title></head>
|
||||
<body>
|
||||
<h1>84 Konstruksjoner av betong</h1>
|
||||
<p>Toleranseklasse for de enkelte konstruksjonsdeler er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Toleranseklasser">
|
||||
<h1>84 Brød og boller</h1>
|
||||
<p>Hevetidsklasse for de enkelte deigtyper er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Hevetidsklasser">
|
||||
<p>Figuren under viser prinsippet.</p>
|
||||
<figure>
|
||||
<img src="graphics/figur-84-1.png" alt="Figur 84-1 Prinsippskisse">
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b\fs32 Kravspesifikasjon for tunnelbelysning\b0\fs24\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i vegtunneler over 500 meter.\par
|
||||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b\fs32 Kravspesifikasjon for kj\u248 ?kkenbelysning\b0\fs24\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i storkj\u248 ?kken over 500 kvadratmeter.\par
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Dokumentnummer:\cell \pard\intbl SVV-2026-0417\cell \row
|
||||
\pard\intbl Dokumentnummer:\cell \pard\intbl EKS-2026-0417\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Tittel:\cell \pard\intbl Tunnelbelysning i hovedl\u248 ?pet\cell \row
|
||||
\pard\intbl Tittel:\cell \pard\intbl Kj\u248 ?kkenbelysning i hovedsalen\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Ansvarlig avdeling:\cell \pard\intbl Utbyggingsdivisjonen\cell \row
|
||||
\pard\intbl Ansvarlig avdeling:\cell \pard\intbl Kj\u248 ?kkendivisjonen\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Fagomr\u229 ?de:\cell \pard\intbl Elektro og belysning\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
|
|
@ -13,21 +13,21 @@
|
|||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Gyldig fra:\cell \pard\intbl 01.03.2026\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Erstatter:\cell \pard\intbl SVV-2024-0188\cell \row
|
||||
\pard\intbl Erstatter:\cell \pard\intbl EKS-2024-0188\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Tunnellengde:\cell \pard\intbl 1240 meter\cell \row
|
||||
\pard\intbl Salens lengde:\cell \pard\intbl 42 meter\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Dimensjonerende fart:\cell \pard\intbl 80 km/t\cell \row
|
||||
\pard\intbl Dimensjonerende gjester:\cell \pard\intbl 80 kuverter\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl \u197 ?rsd\u248 ?gntrafikk:\cell \pard\intbl 12400 kj\u248 ?ret\u248 ?y\cell \row
|
||||
\pard\intbl \u197 ?rsproduksjon:\cell \pard\intbl 12400 porsjoner\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Terskelluminans:\cell \pard\intbl 145 candela\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Overgangssone:\cell \pard\intbl Tre trinn nedtrapping\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Innerstrekning:\cell \pard\intbl 3,0 candela\cell \row
|
||||
\pard\intbl Innerste sone:\cell \pard\intbl 3,0 candela\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Utkj\u248 ?ringssone:\cell \pard\intbl Ingen forsterkning\cell \row
|
||||
\pard\intbl Utgangssone:\cell \pard\intbl Ingen forsterkning\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Fargetemperatur:\cell \pard\intbl 4000 kelvin\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
\pard\intbl M\u229 ?lemetode:\cell \pard\intbl M\u229 ?ling med luminanskamera\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Avviksh\u229 ?ndtering:\cell \pard\intbl S\u248 ?knad om fravik\cell \row
|
||||
\pard\sa180 Luminansmatrise per trafikklasse\par
|
||||
\pard\sa180 Luminansmatrise per romklasse\par
|
||||
\trowd\trgaph108\cellx3000\cellx6000\cellx9000\cellx12000
|
||||
\pard\intbl Sone\cell \pard\intbl Klasse A\cell \pard\intbl Klasse B\cell \pard\intbl Klasse C\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000\cellx9000\cellx12000
|
||||
|
|
|
|||
Binary file not shown.
BIN
tests/fixtures/accounting/corpus/liste-og-bilde.odt
vendored
BIN
tests/fixtures/accounting/corpus/liste-og-bilde.odt
vendored
Binary file not shown.
2
tests/fixtures/accounting/corpus/logg.txt
vendored
2
tests/fixtures/accounting/corpus/logg.txt
vendored
|
|
@ -1,4 +1,4 @@
|
|||
Driftslogg for tunnelen.
|
||||
Driftslogg for bakerovnen.
|
||||
|
||||
Vask utført i mars.
|
||||
Lys kontrollert i april.
|
||||
|
|
|
|||
10
tests/fixtures/accounting/corpus/notat.md
vendored
10
tests/fixtures/accounting/corpus/notat.md
vendored
|
|
@ -1,15 +1,15 @@
|
|||
# Drift av tunneler
|
||||
# Stell av bakerovner
|
||||
|
||||
Tunnelen driftes etter håndboka.
|
||||
Ovnen stelles etter håndboka.
|
||||
|
||||
## Vask
|
||||
|
||||
Vask skjer to ganger i året.
|
||||
|
||||
| Sone | Intervall |
|
||||
| Hylle | Intervall |
|
||||
| --- | --- |
|
||||
| Inngang | 6 mnd |
|
||||
| Hovedløp | 12 mnd |
|
||||
| Øverst | 6 mnd |
|
||||
| Nederst | 12 mnd |
|
||||
|
||||

|
||||
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
{"tunnel": "Eksempeltunnelen", "lengde_m": 1240, "soner": ["inngang", "hovedlop"], "belysning": {"terskel_cd": 145, "fart_kmt": 80}}
|
||||
{"ovn": "Eksempelovnen", "hoyde_cm": 124, "hyller": ["overst", "nederst"], "varme": {"grader_c": 145, "minutter": 80}}
|
||||
|
|
|
|||
12
tests/fixtures/accounting/corpus/side.htm
vendored
12
tests/fixtures/accounting/corpus/side.htm
vendored
|
|
@ -1,10 +1,10 @@
|
|||
<!doctype html>
|
||||
<html><head><title>Side</title></head>
|
||||
<body>
|
||||
<h1>Belysning</h1>
|
||||
<p>Terskelluminansen er 145 candela.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Sonekart">
|
||||
<h2>Soner</h2>
|
||||
<ul><li>Inngang</li><li>Hovedløp</li></ul>
|
||||
<table><tr><th>Sone</th><th>Lengde</th></tr><tr><td>Inngang</td><td>120 m</td></tr></table>
|
||||
<h1>Ovnen</h1>
|
||||
<p>Steketemperaturen er 145 grader.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Hyllekart">
|
||||
<h2>Hyller</h2>
|
||||
<ul><li>Øverst</li><li>Nederst</li></ul>
|
||||
<table><tr><th>Hylle</th><th>Temperatur</th></tr><tr><td>Øverst</td><td>180 C</td></tr></table>
|
||||
</body></html>
|
||||
|
|
|
|||
16
tests/fixtures/accounting/corpus/sts-rikt.xml
vendored
16
tests/fixtures/accounting/corpus/sts-rikt.xml
vendored
|
|
@ -1,16 +1,16 @@
|
|||
<standard>
|
||||
<front><std-ident><doc-number>R762</doc-number><year>2025</year></std-ident></front>
|
||||
<front><std-ident><doc-number>P762</doc-number><year>2025</year></std-ident></front>
|
||||
<body>
|
||||
<sec><label>85</label><title>Vegdekker</title>
|
||||
<p>Dekket skal ha jevnhet etter <mixed-citation>NS-EN 13036-1:2010</mixed-citation>.</p>
|
||||
<p>Kravet regnes som <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>IRI</mml:mi><mml:mo><</mml:mo><mml:mn>2</mml:mn></mml:math>.</p>
|
||||
<fig><label>Figur 85-1</label><caption><p>Maalepunkter langs vegbanen.</p></caption>
|
||||
<sec><label>85</label><title>Bakeplater</title>
|
||||
<p>Platen skal ha jevn varme etter <mixed-citation>EKS 1234-1:2030</mixed-citation>.</p>
|
||||
<p>Kravet regnes som <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>T</mml:mi><mml:mo><</mml:mo><mml:mn>2</mml:mn></mml:math>.</p>
|
||||
<fig><label>Figur 85-1</label><caption><p>Maalepunkter langs bakeplaten.</p></caption>
|
||||
<graphic xlink:href="figur-84-1.png" xmlns:xlink="http://www.w3.org/1999/xlink"/></fig>
|
||||
<table-wrap><label>Tabell 85-1</label>
|
||||
<table><tr><th>Klasse</th><th>IRI</th></tr><tr><td>1</td><td>1,5</td></tr></table>
|
||||
<table><tr><th>Klasse</th><th>T</th></tr><tr><td>1</td><td>1,5</td></tr></table>
|
||||
</table-wrap>
|
||||
<list><list-item><p>Maales hvert 20. meter.</p></list-item></list>
|
||||
<fn><p>Gjelder ikke gang- og sykkelveger.</p></fn>
|
||||
<list><list-item><p>Maales hver 20. centimeter.</p></list-item></list>
|
||||
<fn><p>Gjelder ikke steinovner.</p></fn>
|
||||
</sec>
|
||||
</body>
|
||||
</standard>
|
||||
|
|
|
|||
Binary file not shown.
796
tests/fixtures/accounting/inventory.json
vendored
796
tests/fixtures/accounting/inventory.json
vendored
File diff suppressed because it is too large
Load diff
|
|
@ -51,14 +51,14 @@ def build_zip(parts: dict[str, str | bytes]) -> bytes:
|
|||
|
||||
_DOCX_BODY = (
|
||||
'<w:p><w:pPr><w:pStyle w:val="Heading1"/></w:pPr>'
|
||||
"<w:r><w:t>Krav til gangbruer</w:t></w:r></w:p>"
|
||||
"<w:p><w:r><w:t>Gangbruer skal ha rekkverk paa begge sider.</w:t></w:r></w:p>"
|
||||
"<w:r><w:t>Krav til bakebrett</w:t></w:r></w:p>"
|
||||
"<w:p><w:r><w:t>Bakebrett skal ha kant paa begge sider.</w:t></w:r></w:p>"
|
||||
"<w:tbl><w:tr>"
|
||||
"<w:tc><w:p><w:r><w:t>Bredde</w:t></w:r></w:p></w:tc>"
|
||||
"<w:tc><w:p><w:r><w:t>3,0 m</w:t></w:r></w:p></w:tc>"
|
||||
"<w:tc><w:p><w:r><w:t>0,4 m</w:t></w:r></w:p></w:tc>"
|
||||
"</w:tr></w:tbl>"
|
||||
"<w:p><w:r><w:pict><w:txbxContent>"
|
||||
"<w:p><w:r><w:t>Merk: kravet gjelder ikke midlertidige bruer.</w:t></w:r></w:p>"
|
||||
"<w:p><w:r><w:t>Merk: kravet gjelder ikke engangsbrett.</w:t></w:r></w:p>"
|
||||
"</w:txbxContent></w:pict></w:r></w:p>"
|
||||
)
|
||||
|
||||
|
|
@ -90,15 +90,15 @@ _DOCX_PARTS: dict[str, str | bytes] = {
|
|||
+ f"<w:hdr {_W}><w:p><w:r><w:t>Utkast - gjelder ikke etter 2026-01-01</w:t></w:r></w:p>"
|
||||
+ "</w:hdr>",
|
||||
"word/footer1.xml": _XML
|
||||
+ f"<w:ftr {_W}><w:p><w:r><w:t>Statens vegvesen, side 1</w:t></w:r></w:p></w:ftr>",
|
||||
+ f"<w:ftr {_W}><w:p><w:r><w:t>Eksempelforlaget, side 1</w:t></w:r></w:p></w:ftr>",
|
||||
"word/comments.xml": _XML
|
||||
+ f"<w:comments {_W}>"
|
||||
+ '<w:comment w:id="1"><w:p><w:r><w:t>Unntak: gjelder IKKE gangbruer i tunnel.'
|
||||
+ '<w:comment w:id="1"><w:p><w:r><w:t>Unntak: gjelder IKKE bakebrett i kjeller.'
|
||||
+ "</w:t></w:r></w:p></w:comment></w:comments>",
|
||||
"word/footnotes.xml": _XML
|
||||
+ f"<w:footnotes {_W}>"
|
||||
+ '<w:footnote w:id="0"><w:p><w:r><w:t>separator</w:t></w:r></w:p></w:footnote>'
|
||||
+ '<w:footnote w:id="2"><w:p><w:r><w:t>Se haandbok N400 kapittel 5.</w:t></w:r></w:p>'
|
||||
+ '<w:footnote w:id="2"><w:p><w:r><w:t>Se kokebok Q400 kapittel 5.</w:t></w:r></w:p>'
|
||||
+ "</w:footnote></w:footnotes>",
|
||||
"word/endnotes.xml": _XML
|
||||
+ f"<w:endnotes {_W}>"
|
||||
|
|
@ -164,11 +164,11 @@ _PPTX_PARTS: dict[str, str | bytes] = {
|
|||
+ f"<p:presentation {_P}><p:sldIdLst>"
|
||||
+ '<p:sldId id="256" r:id="rId1"/><p:sldId id="257" r:id="rId2"/>'
|
||||
+ "</p:sldIdLst></p:presentation>",
|
||||
"ppt/slides/slide1.xml": _slide("Prosess 84 Konstruksjoner", "Toleranser er gitt i tabell."),
|
||||
"ppt/slides/slide1.xml": _slide("Kapittel 84 Boller", "Hevetider er gitt i tabell."),
|
||||
"ppt/slides/slide2.xml": _slide("Utgaatt lysbilde", "Ikke vis dette.", hidden=True),
|
||||
"ppt/notesSlides/notesSlide1.xml": _XML
|
||||
+ f"<p:notes {_P} {_A}><p:cSld><p:spTree><p:sp><p:txBody>"
|
||||
+ "<a:p><a:r><a:t>Husk aa nevne at toleranseklassen er skjerpet.</a:t></a:r></a:p>"
|
||||
+ "<a:p><a:r><a:t>Husk aa nevne at hevetidsklassen er skjerpet.</a:t></a:r></a:p>"
|
||||
+ "</p:txBody></p:sp></p:spTree></p:cSld></p:notes>",
|
||||
}
|
||||
|
||||
|
|
@ -267,17 +267,17 @@ _ODT_PARTS: dict[str, str | bytes] = {
|
|||
"content.xml": _XML
|
||||
+ f'<office:document-content {_ODT_NS} office:version="1.3">'
|
||||
+ "<office:body><office:text>"
|
||||
+ '<text:h text:outline-level="1">Drift av gangbruer</text:h>'
|
||||
+ "<text:p>Gangbruer inspiseres hvert aar.</text:p>"
|
||||
+ "<text:list><text:list-item><text:p>Rekkverk</text:p></text:list-item>"
|
||||
+ "<text:list-item><text:p>Dekke</text:p></text:list-item></text:list>"
|
||||
+ '<text:h text:outline-level="1">Stell av bakebrett</text:h>'
|
||||
+ "<text:p>Bakebrett vaskes hver uke.</text:p>"
|
||||
+ "<text:list><text:list-item><text:p>Kant</text:p></text:list-item>"
|
||||
+ "<text:list-item><text:p>Flate</text:p></text:list-item></text:list>"
|
||||
+ "<text:p>Se figuren under."
|
||||
+ '<draw:frame><draw:image xlink:href="graphics/figur-84-1.png"/></draw:frame></text:p>'
|
||||
+ "<office:annotation><text:p>Sjekk denne mot N400 foer utsendelse.</text:p>"
|
||||
+ "<office:annotation><text:p>Sjekk denne mot Q400 foer utsendelse.</text:p>"
|
||||
+ "</office:annotation>"
|
||||
+ "<table:table><table:table-row>"
|
||||
+ "<table:table-cell><text:p>Type</text:p></table:table-cell>"
|
||||
+ "<table:table-cell><text:p>Gangbru</text:p></table:table-cell>"
|
||||
+ "<table:table-cell><text:p>Bakebrett</text:p></table:table-cell>"
|
||||
+ "</table:table-row></table:table>"
|
||||
+ "</office:text></office:body></office:document-content>",
|
||||
"styles.xml": _XML
|
||||
|
|
@ -285,7 +285,7 @@ _ODT_PARTS: dict[str, str | bytes] = {
|
|||
+ "<office:styles/><office:master-styles>"
|
||||
+ '<style:master-page style:name="Standard">'
|
||||
+ "<style:header><text:p>Intern arbeidsversjon</text:p></style:header>"
|
||||
+ "<style:footer><text:p>Vegdirektoratet</text:p></style:footer>"
|
||||
+ "<style:footer><text:p>Eksempelforlaget</text:p></style:footer>"
|
||||
+ "</style:master-page></office:master-styles></office:document-styles>",
|
||||
}
|
||||
|
||||
|
|
@ -307,9 +307,9 @@ _HTML = """<!DOCTYPE html>
|
|||
<head><title>Figur 84-1</title></head>
|
||||
<body>
|
||||
<h1>Figur 84-1</h1>
|
||||
<p>Prinsippet for toleranseklasser.</p>
|
||||
<p>Prinsippet for hevetidsklasser.</p>
|
||||
<img src="graphics/figur-84-1.png" alt="Prinsippskisse">
|
||||
<table><tr><th>Klasse</th><th>Avvik</th></tr><tr><td>A</td><td>5 mm</td></tr></table>
|
||||
<table><tr><th>Klasse</th><th>Avvik</th></tr><tr><td>A</td><td>5 min</td></tr></table>
|
||||
<ul><li>Klasse A</li><li>Klasse B</li></ul>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -319,18 +319,18 @@ _HTML = """<!DOCTYPE html>
|
|||
# --- sts: a citation, a formula, a figure with a caption, a table, a footnote -
|
||||
|
||||
_STS = """<standard>
|
||||
<front><std-ident><doc-number>R762</doc-number><year>2025</year></std-ident></front>
|
||||
<front><std-ident><doc-number>P762</doc-number><year>2025</year></std-ident></front>
|
||||
<body>
|
||||
<sec><label>85</label><title>Vegdekker</title>
|
||||
<p>Dekket skal ha jevnhet etter <mixed-citation>NS-EN 13036-1:2010</mixed-citation>.</p>
|
||||
<p>Kravet regnes som <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>IRI</mml:mi><mml:mo><</mml:mo><mml:mn>2</mml:mn></mml:math>.</p>
|
||||
<fig><label>Figur 85-1</label><caption><p>Maalepunkter langs vegbanen.</p></caption>
|
||||
<sec><label>85</label><title>Bakeplater</title>
|
||||
<p>Platen skal ha jevn varme etter <mixed-citation>EKS 1234-1:2030</mixed-citation>.</p>
|
||||
<p>Kravet regnes som <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML"><mml:mi>T</mml:mi><mml:mo><</mml:mo><mml:mn>2</mml:mn></mml:math>.</p>
|
||||
<fig><label>Figur 85-1</label><caption><p>Maalepunkter langs bakeplaten.</p></caption>
|
||||
<graphic xlink:href="figur-84-1.png" xmlns:xlink="http://www.w3.org/1999/xlink"/></fig>
|
||||
<table-wrap><label>Tabell 85-1</label>
|
||||
<table><tr><th>Klasse</th><th>IRI</th></tr><tr><td>1</td><td>1,5</td></tr></table>
|
||||
<table><tr><th>Klasse</th><th>T</th></tr><tr><td>1</td><td>1,5</td></tr></table>
|
||||
</table-wrap>
|
||||
<list><list-item><p>Maales hvert 20. meter.</p></list-item></list>
|
||||
<fn><p>Gjelder ikke gang- og sykkelveger.</p></fn>
|
||||
<list><list-item><p>Maales hver 20. centimeter.</p></list-item></list>
|
||||
<fn><p>Gjelder ikke steinovner.</p></fn>
|
||||
</sec>
|
||||
</body>
|
||||
</standard>
|
||||
|
|
|
|||
|
|
@ -1,216 +0,0 @@
|
|||
{
|
||||
"productInfo": {
|
||||
"meta": {
|
||||
"productTitle": "R761 fixture twin"
|
||||
}
|
||||
},
|
||||
"standardContent": {
|
||||
"id": null,
|
||||
"tag": "#document",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "standard",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "front",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "std-ident",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "doc-number",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "R761",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "body",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "sec",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "label",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "84",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "title",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "Konstruksjoner av betong",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "sec",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "label",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "84.1",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "title",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "Toleranser",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "p",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "Toleranseklasse er gitt i tabell 84-2.",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "graphic",
|
||||
"a": {
|
||||
"xlink:href": "graphic_0001.png"
|
||||
},
|
||||
"c": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "p",
|
||||
"a": {},
|
||||
"c": [
|
||||
{
|
||||
"e": 2,
|
||||
"t": "Figur 84-1 viser prinsippet.",
|
||||
"x": null
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"e": 1,
|
||||
"t": null,
|
||||
"x": {
|
||||
"id": null,
|
||||
"tag": "graphic",
|
||||
"a": {
|
||||
"xlink:href": "graphic_0002.png"
|
||||
},
|
||||
"c": []
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
{
|
||||
"productInfo": {"meta": {"productTitle": "Label inside title"}},
|
||||
"standardContent": {
|
||||
"id": null, "tag": "#document", "a": {},
|
||||
"c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "standard", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "body", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "sec", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "title", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "label", "a": {}, "c": [
|
||||
{"e": 2, "t": "84.1", "x": null}
|
||||
]}},
|
||||
{"e": 2, "t": "Toleranser", "x": null}
|
||||
]}},
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "p", "a": {}, "c": [
|
||||
{"e": 2, "t": "Toleranseklasse er gitt i tabell 84-2.", "x": null}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
{
|
||||
"productInfo": {"meta": {"productTitle": "Formula and figure caption"}},
|
||||
"standardContent": {
|
||||
"id": null, "tag": "#document", "a": {},
|
||||
"c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "standard", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "body", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "sec", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "title", "a": {}, "c": [
|
||||
{"e": 2, "t": "Vegdekker", "x": null}
|
||||
]}},
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "p", "a": {}, "c": [
|
||||
{"e": 2, "t": "Kravet regnes som ", "x": null},
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "inline-formula", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "mml:math", "a": {}, "c": [
|
||||
{"e": 2, "t": "IRI < 2", "x": null}
|
||||
]}}
|
||||
]}}
|
||||
]}},
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "fig", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "graphic", "a": {"href": "figur-85-1.png"}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "figcaption", "a": {}, "c": [
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "graphic-caption-label", "a": {}, "c": [
|
||||
{"e": 2, "t": "Figur 85-1", "x": null}
|
||||
]}},
|
||||
{"e": 1, "t": null, "x": {"id": null, "tag": "graphic-caption-title", "a": {}, "c": [
|
||||
{"e": 2, "t": "Maalepunkter langs vegbanen.", "x": null}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]}}
|
||||
]
|
||||
}
|
||||
}
|
||||
4
tests/fixtures/font-heading-krav.pdf
vendored
4
tests/fixtures/font-heading-krav.pdf
vendored
|
|
@ -12,9 +12,9 @@ endobj
|
|||
<< /Length 221 >>
|
||||
stream
|
||||
BT /F2 20 Tf 50 700 Td (Generelle tekniske krav) Tj ET
|
||||
BT /F1 10 Tf 50 670 Td (Utkilingen skal ha helning 1:15.) Tj ET
|
||||
BT /F1 10 Tf 50 670 Td (Deigkulene skal ha hevetid 1:15.) Tj ET
|
||||
BT /F2 14 Tf 50 640 Td (Merking) Tj ET
|
||||
BT /F1 10 Tf 50 610 Td (Kravet gjelder alle veiklasser.) Tj ET
|
||||
BT /F1 10 Tf 50 610 Td (Kravet gjelder alle bakeformer.) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
5 0 obj
|
||||
|
|
|
|||
8
tests/fixtures/generic-feed.xml
vendored
8
tests/fixtures/generic-feed.xml
vendored
|
|
@ -3,12 +3,12 @@
|
|||
<title>Driftsmeldinger</title>
|
||||
<description>Meldinger om drift og vedlikehold.</description>
|
||||
<item>
|
||||
<title>Stengt tunnel</title>
|
||||
<description>Tunnelen er stengt for vedlikehold natt til fredag.</description>
|
||||
<title>Stengt kantine</title>
|
||||
<description>Kantinen er stengt for vedlikehold natt til fredag.</description>
|
||||
</item>
|
||||
<item>
|
||||
<title>Redusert framkommelighet</title>
|
||||
<description>Ett felt er stengt i anleggsperioden.</description>
|
||||
<title>Redusert åpningstid</title>
|
||||
<description>Ett kjøkken er stengt i ombyggingsperioden.</description>
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1,14 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<standard xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<front><std-ident><doc-number>R761</doc-number></std-ident></front>
|
||||
<front><std-ident><doc-number>P761</doc-number></std-ident></front>
|
||||
<body>
|
||||
<sec>
|
||||
<label>84</label>
|
||||
<title>Konstruksjoner av betong</title>
|
||||
<title>Brød og boller</title>
|
||||
<sec>
|
||||
<label>84.1</label>
|
||||
<title>Toleranser</title>
|
||||
<p>Toleranseklasse er gitt i tabell 84-2.</p>
|
||||
<title>Hevetider</title>
|
||||
<p>Hevetidsklasse er gitt i tabell 84-2.</p>
|
||||
<graphic xlink:href="graphics/tabell-84-2.png"/>
|
||||
<p>Figur 84-1 viser prinsippet.</p>
|
||||
<graphic xlink:href="figur-84-1.png"/>
|
||||
Binary file not shown.
|
|
@ -1,9 +1,9 @@
|
|||
<!doctype html>
|
||||
<html><head><title>Prosess 84</title></head>
|
||||
<html><head><title>Kapittel 84</title></head>
|
||||
<body>
|
||||
<h1>84 Konstruksjoner av betong</h1>
|
||||
<p>Toleranseklasse for de enkelte konstruksjonsdeler er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Toleranseklasser">
|
||||
<h1>84 Brød og boller</h1>
|
||||
<p>Hevetidsklasse for de enkelte deigtyper er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Hevetidsklasser">
|
||||
<p>Figuren under viser prinsippet.</p>
|
||||
<figure>
|
||||
<img src="graphics/figur-84-1.png" alt="Figur 84-1 Prinsippskisse">
|
||||
12
tests/fixtures/k2-office-fasit.json
vendored
12
tests/fixtures/k2-office-fasit.json
vendored
|
|
@ -55,7 +55,7 @@
|
|||
"krav-rikt-tekstformat.rtf": {
|
||||
"authored_titles": 1,
|
||||
"titles": [
|
||||
"Kravspesifikasjon for tunnelbelysning"
|
||||
"Kravspesifikasjon for kjøkkenbelysning"
|
||||
],
|
||||
"bold_runs_that_are_not_titles": 0,
|
||||
"declares_heading_style": false,
|
||||
|
|
@ -64,8 +64,8 @@
|
|||
"krav-rikt-tekstformat-fet-alene.rtf": {
|
||||
"authored_titles": 2,
|
||||
"titles": [
|
||||
"Kravspesifikasjon for tunnelbelysning",
|
||||
"Luminanskrav per trafikklasse"
|
||||
"Kravspesifikasjon for kjøkkenbelysning",
|
||||
"Luminanskrav per romklasse"
|
||||
],
|
||||
"bold_runs_that_are_not_titles": 0,
|
||||
"declares_heading_style": false,
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
"krav-rikt-tekstformat-fet-i-avsnitt.rtf": {
|
||||
"authored_titles": 1,
|
||||
"titles": [
|
||||
"Kravspesifikasjon for tunnelbelysning"
|
||||
"Kravspesifikasjon for kjøkkenbelysning"
|
||||
],
|
||||
"bold_runs_that_are_not_titles": 1,
|
||||
"declares_heading_style": false,
|
||||
|
|
@ -83,8 +83,8 @@
|
|||
"krav-rikt-tekstformat-stil.rtf": {
|
||||
"authored_titles": 2,
|
||||
"titles": [
|
||||
"Kravspesifikasjon for tunnelbelysning",
|
||||
"Luminanskrav per trafikklasse"
|
||||
"Kravspesifikasjon for kjøkkenbelysning",
|
||||
"Luminanskrav per romklasse"
|
||||
],
|
||||
"bold_runs_that_are_not_titles": 0,
|
||||
"declares_heading_style": true,
|
||||
|
|
|
|||
BIN
tests/fixtures/k2-office/krav-presentasjon.pptx
vendored
BIN
tests/fixtures/k2-office/krav-presentasjon.pptx
vendored
Binary file not shown.
|
|
@ -1,11 +1,11 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b\fs32 Kravspesifikasjon for tunnelbelysning\b0\fs24\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i vegtunneler over 500 meter.\par
|
||||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b\fs32 Kravspesifikasjon for kj\u248 ?kkenbelysning\b0\fs24\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i storkj\u248 ?kken over 500 kvadratmeter.\par
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Dokumentnummer:\cell \pard\intbl SVV-2026-0417\cell \row
|
||||
\pard\intbl Dokumentnummer:\cell \pard\intbl EKS-2026-0417\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Tittel:\cell \pard\intbl Tunnelbelysning i hovedl\u248 ?pet\cell \row
|
||||
\pard\intbl Tittel:\cell \pard\intbl Kj\u248 ?kkenbelysning i hovedsalen\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Ansvarlig avdeling:\cell \pard\intbl Utbyggingsdivisjonen\cell \row
|
||||
\pard\intbl Ansvarlig avdeling:\cell \pard\intbl Kj\u248 ?kkendivisjonen\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Fagomr\u229 ?de:\cell \pard\intbl Elektro og belysning\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
|
|
@ -13,21 +13,21 @@
|
|||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Gyldig fra:\cell \pard\intbl 01.03.2026\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Erstatter:\cell \pard\intbl SVV-2024-0188\cell \row
|
||||
\pard\intbl Erstatter:\cell \pard\intbl EKS-2024-0188\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Tunnellengde:\cell \pard\intbl 1240 meter\cell \row
|
||||
\pard\intbl Salens lengde:\cell \pard\intbl 42 meter\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Dimensjonerende fart:\cell \pard\intbl 80 km/t\cell \row
|
||||
\pard\intbl Dimensjonerende gjester:\cell \pard\intbl 80 kuverter\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl \u197 ?rsd\u248 ?gntrafikk:\cell \pard\intbl 12400 kj\u248 ?ret\u248 ?y\cell \row
|
||||
\pard\intbl \u197 ?rsproduksjon:\cell \pard\intbl 12400 porsjoner\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Terskelluminans:\cell \pard\intbl 145 candela\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Overgangssone:\cell \pard\intbl Tre trinn nedtrapping\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Innerstrekning:\cell \pard\intbl 3,0 candela\cell \row
|
||||
\pard\intbl Innerste sone:\cell \pard\intbl 3,0 candela\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Utkj\u248 ?ringssone:\cell \pard\intbl Ingen forsterkning\cell \row
|
||||
\pard\intbl Utgangssone:\cell \pard\intbl Ingen forsterkning\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Fargetemperatur:\cell \pard\intbl 4000 kelvin\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
\pard\intbl M\u229 ?lemetode:\cell \pard\intbl M\u229 ?ling med luminanskamera\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000
|
||||
\pard\intbl Avviksh\u229 ?ndtering:\cell \pard\intbl S\u248 ?knad om fravik\cell \row
|
||||
\pard\sa180 Luminansmatrise per trafikklasse\par
|
||||
\pard\sa180 Luminansmatrise per romklasse\par
|
||||
\trowd\trgaph108\cellx3000\cellx6000\cellx9000\cellx12000
|
||||
\pard\intbl Sone\cell \pard\intbl Klasse A\cell \pard\intbl Klasse B\cell \pard\intbl Klasse C\cell \row
|
||||
\trowd\trgaph108\cellx3000\cellx6000\cellx9000\cellx12000
|
||||
|
|
|
|||
BIN
tests/fixtures/k2-office/krav-tekstdokument.odt
vendored
BIN
tests/fixtures/k2-office/krav-tekstdokument.odt
vendored
Binary file not shown.
|
|
@ -1,5 +1,5 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b Kravspesifikasjon for tunnelbelysning\b0\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i vegtunneler over 500 meter.\par
|
||||
\pard\sa180\b Luminanskrav per trafikklasse\b0\par
|
||||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b Kravspesifikasjon for kj\u248 ?kkenbelysning\b0\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i storkj\u248 ?kken over 500 kvadratmeter.\par
|
||||
\pard\sa180\b Luminanskrav per romklasse\b0\par
|
||||
\pard\sa180 Terskelluminansen er 145 candela og gjelder i hele overgangssonen.\par
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b Kravspesifikasjon for tunnelbelysning\b0\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i vegtunneler over 500 meter.\par
|
||||
\pard\sa180 Avvik fra kravene krever soknad om \b fravik\b0 fra byggherren for arbeidet starter.\par
|
||||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}\pard\sa180\b Kravspesifikasjon for kj\u248 ?kkenbelysning\b0\par
|
||||
\pard\sa180 Dokumentet samler kravene til belysning i storkj\u248 ?kken over 500 kvadratmeter.\par
|
||||
\pard\sa180 Avvik fra kravene krever soknad om \b fravik\b0 fra kjokkensjefen for arbeidet starter.\par
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}{\stylesheet{\s0 Normal;}{\s1\b\fs32 heading 1;}{\s2\b\fs28 heading 2;}}\pard\s1\b\fs32 Kravspesifikasjon for tunnelbelysning\b0\fs24\par
|
||||
\pard\s0\sa180 Dokumentet samler kravene til belysning i vegtunneler over 500 meter.\par
|
||||
\pard\s2\b\fs28 Luminanskrav per trafikklasse\b0\fs24\par
|
||||
{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\froman Times New Roman;}}{\stylesheet{\s0 Normal;}{\s1\b\fs32 heading 1;}{\s2\b\fs28 heading 2;}}\pard\s1\b\fs32 Kravspesifikasjon for kj\u248 ?kkenbelysning\b0\fs24\par
|
||||
\pard\s0\sa180 Dokumentet samler kravene til belysning i storkj\u248 ?kken over 500 kvadratmeter.\par
|
||||
\pard\s2\b\fs28 Luminanskrav per romklasse\b0\fs24\par
|
||||
\pard\s0\sa180 Terskelluminansen er 145 candela og gjelder i hele overgangssonen.\par
|
||||
}
|
||||
37
tests/fixtures/make_fixtures.py
vendored
37
tests/fixtures/make_fixtures.py
vendored
|
|
@ -23,12 +23,11 @@ from pathlib import Path
|
|||
HERE = Path(__file__).parent
|
||||
|
||||
# Two text lines: a heading, and one requirement row with label and value on
|
||||
# the SAME line. That pairing is the property the parser choice was made on
|
||||
# (see docs/2026-08-21-g2-pdf-extraction-measurement.md), so the fixture
|
||||
# fails visibly if a parser upgrade ever breaks it. Byte 0xE5 is the Norwegian
|
||||
# the SAME line. That pairing is the property the parser choice was made on,
|
||||
# so the fixture fails visibly if a parser upgrade ever breaks it. Byte 0xE5 is the Norwegian
|
||||
# 'a-ring' in WinAnsiEncoding, which the font object below declares.
|
||||
KRAV_CONTENT = (
|
||||
b"BT /F1 12 Tf 20 160 Td (Krav til helning p\xe5 utkilingen) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 160 Td (Krav til hevetid p\xe5 deigkulene) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 140 Td (60 og 70 1:15) Tj ET\n"
|
||||
)
|
||||
|
||||
|
|
@ -45,9 +44,9 @@ NO_TEXT_CONTENT = b"20 20 160 160 re S\n"
|
|||
# extractor drops empty pages, so the third page's text belongs to page 3 and
|
||||
# to no other number.
|
||||
PAGED_CONTENTS = (
|
||||
b"BT /F1 12 Tf 20 160 Td (Side en om helning) Tj ET\n",
|
||||
b"BT /F1 12 Tf 20 160 Td (Side en om hevetid) Tj ET\n",
|
||||
b"20 20 160 160 re S\n",
|
||||
b"BT /F1 12 Tf 20 160 Td (Side tre om utkiling) Tj ET\n",
|
||||
b"BT /F1 12 Tf 20 160 Td (Side tre om deigkule) Tj ET\n",
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -59,9 +58,9 @@ PAGED_CONTENTS = (
|
|||
# which is what gives the reader a body size to compare against.
|
||||
FONT_HEADING_CONTENT = (
|
||||
b"BT /F2 20 Tf 50 700 Td (Generelle tekniske krav) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 670 Td (Utkilingen skal ha helning 1:15.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 670 Td (Deigkulene skal ha hevetid 1:15.) Tj ET\n"
|
||||
b"BT /F2 14 Tf 50 640 Td (Merking) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 610 Td (Kravet gjelder alle veiklasser.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 610 Td (Kravet gjelder alle bakeformer.) Tj ET\n"
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -74,9 +73,9 @@ FONT_HEADING_CONTENT = (
|
|||
NUMBERED_FONT_CONTENT = (
|
||||
b"BT /F2 20 Tf 50 700 Td (Forord) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 670 Td (1 Generelle krav) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 640 Td (Utkilingen skal ha helning 1:15.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 640 Td (Deigkulene skal ha hevetid 1:15.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 610 Td (2 Merking) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 580 Td (Kravet gjelder alle veiklasser.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 580 Td (Kravet gjelder alle bakeformer.) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 550 Td (3 Vedlegg) Tj ET\n"
|
||||
b"BT /F1 10 Tf 50 520 Td (Vedlegget er eget oppslag.) Tj ET\n"
|
||||
)
|
||||
|
|
@ -113,25 +112,25 @@ OUTLINED_TREE = (
|
|||
("1.2.1 Materialer", 3, 2, 150),
|
||||
)
|
||||
|
||||
#: TWO bookmarks whose destinations resolve to the SAME line, mirroring what
|
||||
#: R761 carries: its tree's root node `R761 Prosesskoden` and the node
|
||||
#: `SVV - Forside` both land on line 0. Measured on that document, 2 763 nodes
|
||||
#: TWO bookmarks whose destinations resolve to the SAME line, mirroring what a
|
||||
#: 701-page reference standard carries: its tree's root node and its front-matter
|
||||
#: node both land on line 0. Measured on that document, 2 763 nodes
|
||||
#: entered the bridge and 2 762 marks came out with `unresolved` at 0 -- the
|
||||
#: difference was a dict keyed on the line index, dropping the second node with
|
||||
#: nothing counting it. A one-bookmark-per-line fixture cannot see that.
|
||||
COLLISION_CONTENTS = (
|
||||
b"BT /F1 12 Tf 20 170 Td (R761 Prosesskoden) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 170 Td (P761 Oppskriftsboka) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 150 Td (Innledende tekst om grunnlaget.) Tj ET\n",
|
||||
)
|
||||
|
||||
#: Both point at `/XYZ 20 185`, which is above the page's first line.
|
||||
COLLISION_TREE = (
|
||||
("R761 Prosesskoden", 1, 0, 185),
|
||||
("SVV - Forside", 2, 0, 185),
|
||||
("P761 Oppskriftsboka", 1, 0, 185),
|
||||
("EKS - Forside", 2, 0, 185),
|
||||
)
|
||||
|
||||
#: One resolvable bookmark and one whose `/Dest` names an object that is not a
|
||||
#: page. A PDF in the wild carries these; R761 carries none of them, so
|
||||
#: page. A PDF in the wild carries these; the reference standard carries none, so
|
||||
#: without this fixture the "drop it, count it, do not fabricate a boundary"
|
||||
#: branch would ship having never run.
|
||||
BROKEN_DEST_CONTENT = (
|
||||
|
|
@ -391,7 +390,7 @@ _DOCX_PARTS = {
|
|||
+ "</w:styles>",
|
||||
"word/document.xml": _XML
|
||||
+ '<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:body>'
|
||||
+ '<w:p><w:pPr><w:pStyle w:val="Heading1"/></w:pPr><w:r><w:t>Krav til helning</w:t></w:r></w:p>'
|
||||
+ '<w:p><w:pPr><w:pStyle w:val="Heading1"/></w:pPr><w:r><w:t>Krav til hevetid</w:t></w:r></w:p>'
|
||||
+ "<w:p><w:r><w:t>60 og 70 1:15</w:t></w:r></w:p>"
|
||||
+ "</w:body></w:document>",
|
||||
}
|
||||
|
|
@ -444,7 +443,7 @@ _XLSX_PARTS = {
|
|||
+ '<sheets><sheet name="Krav" sheetId="1" r:id="rId1"/></sheets></workbook>',
|
||||
"xl/sharedStrings.xml": _XML
|
||||
+ '<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="3" uniqueCount="3">'
|
||||
+ "<si><t>Krav til helning</t></si><si><t>60 og 70</t></si><si><t>1:15</t></si></sst>",
|
||||
+ "<si><t>Krav til hevetid</t></si><si><t>60 og 70</t></si><si><t>1:15</t></si></sst>",
|
||||
"xl/worksheets/sheet1.xml": _XML
|
||||
+ '<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">'
|
||||
+ '<dimension ref="A1:B2"/><sheetData>'
|
||||
|
|
|
|||
48
tests/fixtures/make_image_fixtures.py
vendored
48
tests/fixtures/make_image_fixtures.py
vendored
|
|
@ -58,8 +58,8 @@ def jpeg_header(width: int, height: int) -> bytes:
|
|||
|
||||
Not a decodable photograph, and that is the point of it. The `pdf` reader
|
||||
passes `DCTDecode` bytes through untouched and reads only the frame header
|
||||
for the size, which is precisely what R761's own table images need -- 29 of
|
||||
its 50 image objects are `DCTDecode`. A fixture that also carried entropy
|
||||
for the size, which is precisely what a real reference PDF's table images
|
||||
need -- 29 of its 50 image objects are `DCTDecode`. A fixture that also carried entropy
|
||||
data would exercise no additional line of this package and could not be read
|
||||
byte by byte by a person.
|
||||
"""
|
||||
|
|
@ -77,7 +77,7 @@ def jpeg_header(width: int, height: int) -> bytes:
|
|||
# --- pdf ---------------------------------------------------------------------
|
||||
#
|
||||
# TWO images on one page, and they are deliberately of the two kinds the
|
||||
# measurement on R761 found: 29 `DCTDecode` objects, which arrive as a finished
|
||||
# measurement on a reference PDF found: 29 `DCTDecode` objects, which arrive as a finished
|
||||
# JPEG file, and 21 `FlateDecode` ones, which arrive as raw samples with the
|
||||
# colour model in the dictionary beside them and have to be encoded to be
|
||||
# carried at all. A fixture with only one kind would leave half the reader
|
||||
|
|
@ -88,7 +88,7 @@ PDF_GRAY_SAMPLES = bytes([0, 60, 120, 180, 20, 80, 140, 200, 40, 100, 160, 255])
|
|||
PDF_JPEG_WIDTH, PDF_JPEG_HEIGHT = 360, 269
|
||||
|
||||
PDF_CONTENT = (
|
||||
b"BT /F1 12 Tf 20 170 Td (Toleranseklasse er gitt i tabell 84-2) Tj ET\n"
|
||||
b"BT /F1 12 Tf 20 170 Td (Hevetidsklasse er gitt i tabell 84-2) Tj ET\n"
|
||||
b"q 80 0 0 60 20 90 cm /ImFlate Do Q\n"
|
||||
b"q 80 0 0 60 20 20 cm /ImJpeg Do Q\n"
|
||||
)
|
||||
|
|
@ -153,11 +153,11 @@ def build_image_pdf() -> bytes:
|
|||
# the gate counts it as found-and-not-carried rather than as absent.
|
||||
|
||||
HTML_DOCUMENT = """<!doctype html>
|
||||
<html><head><title>Prosess 84</title></head>
|
||||
<html><head><title>Kapittel 84</title></head>
|
||||
<body>
|
||||
<h1>84 Konstruksjoner av betong</h1>
|
||||
<p>Toleranseklasse for de enkelte konstruksjonsdeler er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Toleranseklasser">
|
||||
<h1>84 Brød og boller</h1>
|
||||
<p>Hevetidsklasse for de enkelte deigtyper er gitt i tabell 84-2.</p>
|
||||
<img src="graphics/tabell-84-2.png" alt="Tabell 84-2 Hevetidsklasser">
|
||||
<p>Figuren under viser prinsippet.</p>
|
||||
<figure>
|
||||
<img src="graphics/figur-84-1.png" alt="Figur 84-1 Prinsippskisse">
|
||||
|
|
@ -170,7 +170,7 @@ HTML_DOCUMENT = """<!doctype html>
|
|||
|
||||
# --- niso-sts ----------------------------------------------------------------
|
||||
#
|
||||
# The shape the R761 delivery actually has, measured 2026-09-16: 50 `<graphic>`
|
||||
# The shape a real NISO-STS delivery has, measured 2026-09-16: 50 `<graphic>`
|
||||
# elements, every one a direct child of a `<sec>`, none inside a `<table-wrap>`,
|
||||
# each carrying a bare file name in `xlink:href` that resolves against a sibling
|
||||
# `graphics/` directory. No `<caption>` anywhere near them -- the caption a
|
||||
|
|
@ -178,15 +178,15 @@ HTML_DOCUMENT = """<!doctype html>
|
|||
|
||||
STS_DOCUMENT = """<?xml version="1.0" encoding="UTF-8"?>
|
||||
<standard xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<front><std-ident><doc-number>R761</doc-number></std-ident></front>
|
||||
<front><std-ident><doc-number>P761</doc-number></std-ident></front>
|
||||
<body>
|
||||
<sec>
|
||||
<label>84</label>
|
||||
<title>Konstruksjoner av betong</title>
|
||||
<title>Brød og boller</title>
|
||||
<sec>
|
||||
<label>84.1</label>
|
||||
<title>Toleranser</title>
|
||||
<p>Toleranseklasse er gitt i tabell 84-2.</p>
|
||||
<title>Hevetider</title>
|
||||
<p>Hevetidsklasse er gitt i tabell 84-2.</p>
|
||||
<graphic xlink:href="graphics/tabell-84-2.png"/>
|
||||
<p>Figur 84-1 viser prinsippet.</p>
|
||||
<graphic xlink:href="figur-84-1.png"/>
|
||||
|
|
@ -225,18 +225,18 @@ def build_docx() -> bytes:
|
|||
+ ' xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"'
|
||||
+ ' xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"'
|
||||
+ ' xmlns:pic="http://schemas.openxmlformats.org/drawingml/2006/picture"><w:body>'
|
||||
+ "<w:p><w:r><w:t>Toleranseklasse er gitt i tabell 84-2.</w:t></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Hevetidsklasse er gitt i tabell 84-2.</w:t></w:r></w:p>"
|
||||
+ '<w:p><w:r><w:drawing><wp:inline><wp:extent cx="381000" cy="285750"/>'
|
||||
+ '<wp:docPr id="1" name="Bilde 1" descr="Tabell 84-2 Toleranseklasser"/>'
|
||||
+ '<wp:docPr id="1" name="Bilde 1" descr="Tabell 84-2 Hevetidsklasser"/>'
|
||||
+ '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006'
|
||||
+ '/picture"><pic:pic><pic:nvPicPr><pic:cNvPr id="1" name="tabell-84-2.png"'
|
||||
+ ' descr="Tabell 84-2 Toleranseklasser"/><pic:cNvPicPr/></pic:nvPicPr>'
|
||||
+ ' descr="Tabell 84-2 Hevetidsklasser"/><pic:cNvPicPr/></pic:nvPicPr>'
|
||||
+ '<pic:blipFill><a:blip r:embed="rIdImg"/><a:stretch><a:fillRect/></a:stretch>'
|
||||
+ '</pic:blipFill><pic:spPr><a:xfrm><a:off x="0" y="0"/>'
|
||||
+ '<a:ext cx="381000" cy="285750"/></a:xfrm>'
|
||||
+ '<a:prstGeom prst="rect"><a:avLst/></a:prstGeom></pic:spPr></pic:pic>'
|
||||
+ "</a:graphicData></a:graphic></wp:inline></w:drawing></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Etter tabellen gjelder NS-EN 13670.</w:t></w:r></w:p>"
|
||||
+ "<w:p><w:r><w:t>Etter tabellen kommer steketidene.</w:t></w:r></w:p>"
|
||||
+ "</w:body></w:document>",
|
||||
}
|
||||
return build_container(parts)
|
||||
|
|
@ -283,7 +283,7 @@ def build_pptx() -> bytes:
|
|||
+ "<p:grpSpPr/>"
|
||||
+ '<p:sp><p:nvSpPr><p:cNvPr id="2" name="Tittel 1"/><p:cNvSpPr/>'
|
||||
+ '<p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr/>'
|
||||
+ "<p:txBody><a:bodyPr/><a:p><a:r><a:t>Toleranser</a:t></a:r></a:p></p:txBody></p:sp>"
|
||||
+ "<p:txBody><a:bodyPr/><a:p><a:r><a:t>Hevetider</a:t></a:r></a:p></p:txBody></p:sp>"
|
||||
+ '<p:pic><p:nvPicPr><p:cNvPr id="3" name="skisse.png" descr="Prinsippskisse"/>'
|
||||
+ "<p:cNvPicPr/><p:nvPr/></p:nvPicPr>"
|
||||
+ '<p:blipFill><a:blip r:embed="rIdImg"/><a:stretch><a:fillRect/></a:stretch>'
|
||||
|
|
@ -310,17 +310,17 @@ if __name__ == "__main__":
|
|||
|
||||
# FIVE DISTINCT STEMS. One stem across five extensions is refused by the
|
||||
# door's own SS 3 collision rule -- measured while building this fixture:
|
||||
# `prosess-84.{pdf,docx,pptx}` gave `inbox_slug_collision: 2/7` and two of
|
||||
# `kapittel-84.{pdf,docx,pptx}` gave `inbox_slug_collision: 2/7` and two of
|
||||
# the five readers were never exercised at all, with the gate reporting a
|
||||
# carrying defect that was really a fixture defect.
|
||||
written: list[tuple[str, bytes]] = [
|
||||
("graphics/tabell-84-2.png", png(120, 90, value=0x20)),
|
||||
("graphics/figur-84-1.png", png(64, 48, value=0x80)),
|
||||
("prosess-84-web.html", HTML_DOCUMENT.encode("utf-8")),
|
||||
("prosess-84-sts.xml", STS_DOCUMENT.encode("utf-8")),
|
||||
("prosess-84-tabell.pdf", build_image_pdf()),
|
||||
("prosess-84-notat.docx", build_docx()),
|
||||
("prosess-84-presentasjon.pptx", build_pptx()),
|
||||
("kapittel-84-web.html", HTML_DOCUMENT.encode("utf-8")),
|
||||
("kapittel-84-sts.xml", STS_DOCUMENT.encode("utf-8")),
|
||||
("kapittel-84-tabell.pdf", build_image_pdf()),
|
||||
("kapittel-84-notat.docx", build_docx()),
|
||||
("kapittel-84-presentasjon.pptx", build_pptx()),
|
||||
]
|
||||
for name, payload in written:
|
||||
(IMAGES / name).write_bytes(payload)
|
||||
|
|
|
|||
34
tests/fixtures/make_k2_office.py
vendored
34
tests/fixtures/make_k2_office.py
vendored
|
|
@ -32,28 +32,28 @@ OUT = HERE / "k2-office"
|
|||
#: containers would enter that run and the denominator would stop being three.
|
||||
RTF_OUT = HERE / "k2-rtf-variants"
|
||||
|
||||
TITLE = "Kravspesifikasjon for tunnelbelysning"
|
||||
INTRO = "Dokumentet samler kravene til belysning i vegtunneler over 500 meter."
|
||||
TITLE = "Kravspesifikasjon for kjøkkenbelysning"
|
||||
INTRO = "Dokumentet samler kravene til belysning i storkjøkken over 500 kvadratmeter."
|
||||
|
||||
# The pairing table. Every label ends in a colon, which is the rule
|
||||
# `okf_fidelity.label_value_rows` selects on -- so these twenty rows ARE the
|
||||
# pairable denominator, and a converter that drops a value or breaks a row over
|
||||
# two output lines shows up as a fall from 20.
|
||||
PAIRS: tuple[tuple[str, str], ...] = (
|
||||
("Dokumentnummer:", "SVV-2026-0417"),
|
||||
("Tittel:", "Tunnelbelysning i hovedløpet"),
|
||||
("Ansvarlig avdeling:", "Utbyggingsdivisjonen"),
|
||||
("Dokumentnummer:", "EKS-2026-0417"),
|
||||
("Tittel:", "Kjøkkenbelysning i hovedsalen"),
|
||||
("Ansvarlig avdeling:", "Kjøkkendivisjonen"),
|
||||
("Fagområde:", "Elektro og belysning"),
|
||||
("Versjon:", "2.3 godkjent"),
|
||||
("Gyldig fra:", "01.03.2026"),
|
||||
("Erstatter:", "SVV-2024-0188"),
|
||||
("Tunnellengde:", "1240 meter"),
|
||||
("Dimensjonerende fart:", "80 km/t"),
|
||||
("Årsdøgntrafikk:", "12400 kjøretøy"),
|
||||
("Erstatter:", "EKS-2024-0188"),
|
||||
("Salens lengde:", "42 meter"),
|
||||
("Dimensjonerende gjester:", "80 kuverter"),
|
||||
("Årsproduksjon:", "12400 porsjoner"),
|
||||
("Terskelluminans:", "145 candela"),
|
||||
("Overgangssone:", "Tre trinn nedtrapping"),
|
||||
("Innerstrekning:", "3,0 candela"),
|
||||
("Utkjøringssone:", "Ingen forsterkning"),
|
||||
("Innerste sone:", "3,0 candela"),
|
||||
("Utgangssone:", "Ingen forsterkning"),
|
||||
("Fargetemperatur:", "4000 kelvin"),
|
||||
("Fargegjengivelse:", "Ra større enn 70"),
|
||||
("Nødbelysning:", "60 minutter drift"),
|
||||
|
|
@ -70,7 +70,7 @@ PAIRS: tuple[tuple[str, str], ...] = (
|
|||
# empty `\\pard\\par` left the converter joining the 2-column rows and the
|
||||
# 4-column rows into a single four-column table, so the grid stopped being a
|
||||
# second table at all.
|
||||
GRID_CAPTION = "Luminansmatrise per trafikklasse"
|
||||
GRID_CAPTION = "Luminansmatrise per romklasse"
|
||||
|
||||
GRID: tuple[tuple[str, ...], ...] = (
|
||||
("Sone", "Klasse A", "Klasse B", "Klasse C"),
|
||||
|
|
@ -342,9 +342,11 @@ def _rtf_row(row: tuple[str, ...]) -> str:
|
|||
# is, not how much text survives -- variant A already carries the coverage and
|
||||
# fidelity counts for the container.
|
||||
|
||||
RTF_VARIANT_TITLE = "Kravspesifikasjon for tunnelbelysning"
|
||||
RTF_VARIANT_SECTION = "Luminanskrav per trafikklasse"
|
||||
RTF_VARIANT_BODY_ONE = "Dokumentet samler kravene til belysning i vegtunneler over 500 meter."
|
||||
RTF_VARIANT_TITLE = "Kravspesifikasjon for kjøkkenbelysning"
|
||||
RTF_VARIANT_SECTION = "Luminanskrav per romklasse"
|
||||
RTF_VARIANT_BODY_ONE = (
|
||||
"Dokumentet samler kravene til belysning i storkjøkken over 500 kvadratmeter."
|
||||
)
|
||||
RTF_VARIANT_BODY_TWO = "Terskelluminansen er 145 candela og gjelder i hele overgangssonen."
|
||||
#: The bold RUN in `-fet-i-avsnitt`, set inside a sentence that continues past
|
||||
#: it. Authored as emphasis, never as a title.
|
||||
|
|
@ -376,7 +378,7 @@ def rtf_bold_inside_paragraph_bytes() -> bytes:
|
|||
+ "\\b "
|
||||
+ _rtf_escape(RTF_VARIANT_EMPHASIS)
|
||||
+ "\\b0 "
|
||||
+ " fra byggherren for arbeidet starter."
|
||||
+ " fra kjokkensjefen for arbeidet starter."
|
||||
)
|
||||
return _rtf_document(
|
||||
[
|
||||
|
|
|
|||
BIN
tests/fixtures/no-styles-krav.docx
vendored
BIN
tests/fixtures/no-styles-krav.docx
vendored
Binary file not shown.
4
tests/fixtures/numbered-font-krav.pdf
vendored
4
tests/fixtures/numbered-font-krav.pdf
vendored
|
|
@ -13,9 +13,9 @@ endobj
|
|||
stream
|
||||
BT /F2 20 Tf 50 700 Td (Forord) Tj ET
|
||||
BT /F1 10 Tf 50 670 Td (1 Generelle krav) Tj ET
|
||||
BT /F1 10 Tf 50 640 Td (Utkilingen skal ha helning 1:15.) Tj ET
|
||||
BT /F1 10 Tf 50 640 Td (Deigkulene skal ha hevetid 1:15.) Tj ET
|
||||
BT /F1 10 Tf 50 610 Td (2 Merking) Tj ET
|
||||
BT /F1 10 Tf 50 580 Td (Kravet gjelder alle veiklasser.) Tj ET
|
||||
BT /F1 10 Tf 50 580 Td (Kravet gjelder alle bakeformer.) Tj ET
|
||||
BT /F1 10 Tf 50 550 Td (3 Vedlegg) Tj ET
|
||||
BT /F1 10 Tf 50 520 Td (Vedlegget er eget oppslag.) Tj ET
|
||||
endstream
|
||||
|
|
|
|||
18
tests/fixtures/outline-collision.pdf
vendored
18
tests/fixtures/outline-collision.pdf
vendored
|
|
@ -9,9 +9,9 @@ endobj
|
|||
<< /Type /Page /Parent 2 0 R /MediaBox [0 0 200 200] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>
|
||||
endobj
|
||||
4 0 obj
|
||||
<< /Length 112 >>
|
||||
<< /Length 114 >>
|
||||
stream
|
||||
BT /F1 12 Tf 20 170 Td (R761 Prosesskoden) Tj ET
|
||||
BT /F1 12 Tf 20 170 Td (P761 Oppskriftsboka) Tj ET
|
||||
BT /F1 12 Tf 20 150 Td (Innledende tekst om grunnlaget.) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
|
|
@ -22,10 +22,10 @@ endobj
|
|||
<< /Type /Outlines /First 7 0 R /Last 7 0 R /Count 2 >>
|
||||
endobj
|
||||
7 0 obj
|
||||
<< /Title (R761 Prosesskoden) /Parent 6 0 R /First 8 0 R /Last 8 0 R /Count 1 /Dest [3 0 R /XYZ 20 185 0] >>
|
||||
<< /Title (P761 Oppskriftsboka) /Parent 6 0 R /First 8 0 R /Last 8 0 R /Count 1 /Dest [3 0 R /XYZ 20 185 0] >>
|
||||
endobj
|
||||
8 0 obj
|
||||
<< /Title (SVV - Forside) /Parent 7 0 R /Dest [3 0 R /XYZ 20 185 0] >>
|
||||
<< /Title (EKS - Forside) /Parent 7 0 R /Dest [3 0 R /XYZ 20 185 0] >>
|
||||
endobj
|
||||
xref
|
||||
0 9
|
||||
|
|
@ -34,12 +34,12 @@ xref
|
|||
0000000074 00000 n
|
||||
0000000131 00000 n
|
||||
0000000257 00000 n
|
||||
0000000419 00000 n
|
||||
0000000516 00000 n
|
||||
0000000587 00000 n
|
||||
0000000711 00000 n
|
||||
0000000421 00000 n
|
||||
0000000518 00000 n
|
||||
0000000589 00000 n
|
||||
0000000715 00000 n
|
||||
trailer
|
||||
<< /Size 9 /Root 1 0 R >>
|
||||
startxref
|
||||
797
|
||||
801
|
||||
%%EOF
|
||||
|
|
|
|||
14
tests/fixtures/sts-identity.xml
vendored
14
tests/fixtures/sts-identity.xml
vendored
|
|
@ -2,21 +2,21 @@
|
|||
<standard>
|
||||
<front>
|
||||
<std-doc-meta>
|
||||
<title-wrap xml:lang="nb"><intro></intro><main></main><compl></compl><full>R900 Testnormalen Standard for fiksturer, tester og kontroll</full></title-wrap>
|
||||
<std-ident><originator>TST</originator><doc-type>Innledning</doc-type><doc-number>R900 Testnormalen</doc-number><isbn>000-00-0000-000-0</isbn><year>2024</year></std-ident>
|
||||
<std-ref type="dated">R900 Testnormalen:2024</std-ref>
|
||||
<title-wrap xml:lang="nb"><intro></intro><main></main><compl></compl><full>P900 Testnormalen Standard for fiksturer, tester og kontroll</full></title-wrap>
|
||||
<std-ident><originator>TST</originator><doc-type>Innledning</doc-type><doc-number>P900 Testnormalen</doc-number><isbn>000-00-0000-000-0</isbn><year>2024</year></std-ident>
|
||||
<std-ref type="dated">P900 Testnormalen:2024</std-ref>
|
||||
</std-doc-meta>
|
||||
</front>
|
||||
<body>
|
||||
<sec id="s-88" sec-type="procedure">
|
||||
<label>88</label>
|
||||
<title>Rekkverk</title>
|
||||
<title>Gelender</title>
|
||||
<sec id="s-88-612" sec-type="procedure">
|
||||
<label>88.612</label>
|
||||
<title>Utskifting av enkeltkomponenter</title>
|
||||
<sec id="s-88-612-a" sec-type="spec">
|
||||
<label>a)</label>
|
||||
<p>Omfatter utskifting av skadde enkeltkomponenter i rekkverk.</p>
|
||||
<p>Omfatter utskifting av skadde enkeltkomponenter i gelender.</p>
|
||||
</sec>
|
||||
<sec id="s-88-612-b" sec-type="spec">
|
||||
<label>b)</label>
|
||||
|
|
@ -29,10 +29,10 @@
|
|||
</sec>
|
||||
<sec id="s-88-613" sec-type="procedure">
|
||||
<label>88.613</label>
|
||||
<title>Maling av rekkverk</title>
|
||||
<title>Maling av gelender</title>
|
||||
<sec id="s-88-613-a" sec-type="spec">
|
||||
<label>a)</label>
|
||||
<p>Omfatter maling av rekkverk.</p>
|
||||
<p>Omfatter maling av gelender.</p>
|
||||
<p>Et andre avsnitt i samme punkt blir ikke med.</p>
|
||||
</sec>
|
||||
</sec>
|
||||
|
|
|
|||
6
tests/fixtures/sts-inherit.xml
vendored
6
tests/fixtures/sts-inherit.xml
vendored
|
|
@ -7,11 +7,11 @@
|
|||
</front>
|
||||
<body>
|
||||
<sec sec-type="procedure" id="s7"><label>7</label><title>Vedlikehold av utstyr</title>
|
||||
<sec sec-type="spec"><label>a)</label><p>Omfatter vedlikehold av alt utstyr langs vegen.</p></sec>
|
||||
<sec sec-type="procedure" id="s7-6"><label>7.6</label><title>Rekkverk</title>
|
||||
<sec sec-type="spec"><label>a)</label><p>Omfatter vedlikehold av alt utstyr i kjøkkenet.</p></sec>
|
||||
<sec sec-type="procedure" id="s7-6"><label>7.6</label><title>Gelender</title>
|
||||
<sec sec-type="procedure" id="s7-61"><label>7.61</label><title>Utskifting</title>
|
||||
<sec sec-type="procedure" id="s7-612"><label>7.612</label><title>Utskifting av enkeltdeler</title>
|
||||
<sec sec-type="spec"><label>a)</label><p>Omfatter utskifting av skadde enkeltdeler i rekkverk.</p></sec>
|
||||
<sec sec-type="spec"><label>a)</label><p>Omfatter utskifting av skadde enkeltdeler i gelender.</p></sec>
|
||||
<sec sec-type="procedure" id="s7-6121"><label>7.6121</label><title>Utskifting av list</title></sec>
|
||||
<sec sec-type="procedure" id="s7-6122"><label>7.6122</label><title>Utskifting av stolpe</title></sec>
|
||||
</sec>
|
||||
|
|
|
|||
4
tests/fixtures/three-page-krav.pdf
vendored
4
tests/fixtures/three-page-krav.pdf
vendored
|
|
@ -11,7 +11,7 @@ endobj
|
|||
4 0 obj
|
||||
<< /Length 50 >>
|
||||
stream
|
||||
BT /F1 12 Tf 20 160 Td (Side en om helning) Tj ET
|
||||
BT /F1 12 Tf 20 160 Td (Side en om hevetid) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
5 0 obj
|
||||
|
|
@ -29,7 +29,7 @@ endobj
|
|||
8 0 obj
|
||||
<< /Length 52 >>
|
||||
stream
|
||||
BT /F1 12 Tf 20 160 Td (Side tre om utkiling) Tj ET
|
||||
BT /F1 12 Tf 20 160 Td (Side tre om deigkule) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
9 0 obj
|
||||
|
|
|
|||
BIN
tests/fixtures/two-line-krav.docx
vendored
BIN
tests/fixtures/two-line-krav.docx
vendored
Binary file not shown.
2
tests/fixtures/two-line-krav.pdf
vendored
2
tests/fixtures/two-line-krav.pdf
vendored
|
|
@ -11,7 +11,7 @@ endobj
|
|||
4 0 obj
|
||||
<< /Length 107 >>
|
||||
stream
|
||||
BT /F1 12 Tf 20 160 Td (Krav til helning på utkilingen) Tj ET
|
||||
BT /F1 12 Tf 20 160 Td (Krav til hevetid på deigkulene) Tj ET
|
||||
BT /F1 12 Tf 20 140 Td (60 og 70 1:15) Tj ET
|
||||
endstream
|
||||
endobj
|
||||
|
|
|
|||
BIN
tests/fixtures/two-line-krav.xlsx
vendored
BIN
tests/fixtures/two-line-krav.xlsx
vendored
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue