Skip to content

Commit 15ad7c2

Browse files
Add labels
1 parent d152939 commit 15ad7c2

3 files changed

Lines changed: 7261 additions & 23 deletions

File tree

src/main/abstract/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,42 @@ hand-written list. Pairing rules, content extraction, abstract authoring, and
5353
collection cutover remain incremental implementation stages; the registry
5454
does not pretend that unpaired legacy pages have already been migrated.
5555

56+
## Rendering language pages from Q315
57+
58+
Three tools drive the content round-trip from Q315, reading the canonical label
59+
store at `src/main/abstract/data/labels-wikibase.csv` (the default `--data-dir`).
60+
61+
1. `fetch_wikibase_labels.py` rebuilds that label store directly from the
62+
Wikibase `wbgetentities` API. This replaces the SPARQL export
63+
(`all-multilingual-labels.rq`), which times out on the endpoint and returns
64+
partial, value-misaligned rows — it dropped bound items and shuffled labels
65+
between entities. Re-run it whenever Wikibase labels change:
66+
67+
```bash
68+
python3 src/main/abstract/fetch_wikibase_labels.py
69+
```
70+
71+
2. `render_page.py` rewrites each bound `data-content`/`data-entity` text slot in
72+
the language pages to the entity's label, in place, and adds a `Q315 renderer`
73+
generator meta so ownership becomes `abstract`. A slot is only rewritten when
74+
the page holds the same number of same-signature elements as the template.
75+
76+
3. `repair_structure.py` inserts template-defined bound children a language page
77+
omits (e.g. a gallery-card's `card-description`), mapped positionally, only
78+
where the parent container count matches. Container-divergent pages (large
79+
index pages missing whole entries) are skipped for regeneration.
80+
81+
```bash
82+
python3 src/main/abstract/render_page.py --check # dry run
83+
python3 src/main/abstract/render_page.py
84+
python3 src/main/abstract/repair_structure.py
85+
python3 src/main/abstract/verify_content_roundtrip.py
86+
```
87+
88+
Both renderers take `--page QID` to scope to a single page. `verify_content_roundtrip.py`
89+
is the completion gate; residual mismatches are structural (index pages that need
90+
regeneration), not missing translations.
91+
5692
## Direct Wikibase bot
5793

5894
The generated QuickStatements can be validated and written directly through

0 commit comments

Comments
 (0)