mirror of
https://github.com/storytold/indd-utils.git
synced 2026-11-28 17:19:28 +01:00
feat: write the index, its topics and the page reference topics
The index object (class 0x13004) lists its sections (class 0x13005); chunk 0x13007 of a section holds its topic records depth first, with their level, name, sort order and page references. The converter writes the Index element in designmap.xml with its nested Topic elements, and gives each PageReference its ReferencedTopic and PageReferenceType. Evidence: docs/format/index.md. compare.py --exclude own/: - trustworthy value coverage 97.17% -> 97.36% (+21,617 values); all pairs 95.21% -> 95.35% (+21,808) - Topic 2,185 of 2,185 with Name and SortOrder; Index 16 of 16; PageReference ReferencedTopic and PageReferenceType 7,523 of 7,523 - extra values +15: the 3 topics and 3 page references one INDD has and its earlier IDML lacks - compare.py --all with schemas: 0 schema failures on pairs; files without a reference as before. One of them (DOM 19) has topic records of another length; its sections are left out with a warning (21 warnings).
This commit is contained in:
1 parent
450fd1f5ac
commit
f7fe41e65d
9 files changed
+399
-18
No files matched your search
@@ -0,0 +1,95 @@
|
||||
# Index
|
||||
|
||||
The index of a document: the index object, its sections and topics, and
|
||||
the page references in the text. Little-endian files; no big-endian
|
||||
sample has an index. A "u32 string" is a u32 length in UTF-16 units,
|
||||
then text segments.
|
||||
|
||||
## Index object (class 0x13004)
|
||||
|
||||
A document with an index has one object of class 0x13004. IDML writes
|
||||
an `Index` element in `designmap.xml` with `Self` `u` and the UID in
|
||||
hexadecimal, after the `CrossReferenceFormat` elements and before
|
||||
`idPkg:BackingStory`. Evidence: 17 of 17 pairs with an index (16
|
||||
trustworthy); no other pair has either.
|
||||
|
||||
Chunk 0x13005: u16 0, u16 *n*, *n* UIDs of section objects (class
|
||||
0x13005), u16 0. *n* is 27 in most pairs and 60 in a pair with a
|
||||
Cyrillic group. Chunk 0x1300E holds the index's own copy of the header
|
||||
groups; IDML takes the header list from the preferences
|
||||
(`preferences.md`, index header setting).
|
||||
|
||||
## Sections (class 0x13005) and topics
|
||||
|
||||
Chunk 0x13006 of a section is a u32, the index UID. Chunk 0x13007 holds
|
||||
the section's topics; sections without topics do not have it:
|
||||
|
||||
| Field | Contents |
|
||||
|---|---|
|
||||
| u32 | Number of level-1 topics |
|
||||
| u16 | 0 |
|
||||
| u32 | Number of topic records that follow (all levels) |
|
||||
| records | Depth first: each topic is followed by its subtopics |
|
||||
|
||||
Topic record:
|
||||
|
||||
| Field | Contents | IDML `Topic` |
|
||||
|---|---|---|
|
||||
| u8, u8 | 0, 1 | |
|
||||
| u16 | Level: 1 for a top topic, 2 for its subtopic, … | nesting |
|
||||
| u32 | Number of direct subtopics | |
|
||||
| u32 string | Topic text | `Name` |
|
||||
| u32 string | Sort order (empty in every sample) | `SortOrder` |
|
||||
| u32 *m*, *m* UIDs | The page references (class 0x13006) of this topic | their `ReferencedTopic` |
|
||||
| 8 bytes | 0 in every sample | |
|
||||
|
||||
- IDML writes the topics as `Topic` children of `Index`, a subtopic as a
|
||||
child of its topic: sections in the order of chunk 0x13005, records in
|
||||
stored order.
|
||||
- `Self` is the parent's `Self`, `Topicn` and the topic text, so a
|
||||
level-2 topic has `u<index>Topicn<parent text>Topicn<own text>`.
|
||||
- Evidence: every chunk of the pairs is read to its end. The topics
|
||||
(`Self`, `Name`, `SortOrder`, nesting) equal the IDML in 2,185 of
|
||||
2,185 IDML topics of the trustworthy pairs (2,223 in all pairs). In
|
||||
one trustworthy pair the INDD has 3 more topics, and 3 more page
|
||||
references, than its IDML (below).
|
||||
|
||||
## Page references (class 0x13006)
|
||||
|
||||
A page reference is owned by a U+FEFF in the story text (owned items,
|
||||
`objects.md`). IDML writes a `PageReference` in place of the character.
|
||||
|
||||
| Chunk | Contents |
|
||||
|---|---|
|
||||
| 0x13053 | u32: the owned-items strand that holds the marker |
|
||||
| 0x13008 | u16 1, u32 the section that holds the topic |
|
||||
| 0x13009 | 30 bytes (26 in InDesign 8.0): below |
|
||||
|
||||
Chunk 0x13009:
|
||||
|
||||
| Offset | Contents | IDML |
|
||||
|---|---|---|
|
||||
| 0–13 | u32 1, u16 0, u32 1, u32 0 in every sample | `PageReferenceType="CurrentPage"` (every IDML page reference) |
|
||||
| 14, 18 | two equal u32 (0 to 8, or 0xFFFFFFFF) | not written |
|
||||
| 22 | u32 (1 or 9) | not written |
|
||||
| 26 | u32, only in a 30-byte chunk | `Id` |
|
||||
|
||||
- `Self` is `u` and the UID in hexadecimal.
|
||||
- `ReferencedTopic` is the `Self` of the topic whose record lists the
|
||||
page reference.
|
||||
- The 3 page references of the one InDesign 8.0 pair have the 26-byte
|
||||
chunk, and their IDML has no `Id`.
|
||||
|
||||
Evidence: all four attributes equal the IDML for 7,523 of 7,523 page
|
||||
references of the trustworthy pairs (7,561 in all pairs; `Id` for 7,520
|
||||
and 7,558, the others have the 26-byte chunk). The converter writes
|
||||
`PageReferenceType` only when the first 14 bytes are those of the
|
||||
samples.
|
||||
|
||||
## Topics missing from the IDML
|
||||
|
||||
In one trustworthy pair (DOM 14) the INDD has 3 topics and 3 page
|
||||
references that its IDML lacks; the IDML text also lacks their 3
|
||||
U+FEFF characters. Their `Id`s are the 3 highest of the document. The
|
||||
IDML was most likely exported before these entries were made. The
|
||||
converter writes them.
|
||||
@@ -1227,14 +1227,7 @@ only.
|
||||
|
||||
**Index markers (class 0x13006).** An index marker is owned by a U+FEFF,
|
||||
which is not text in IDML: IDML writes a `PageReference` in its place.
|
||||
`Self` is `u` and the UID in hexadecimal (7,495 of 7,495 in the
|
||||
research run). `Id` is the u32 at offset 26 of chunk 0x13009 when the
|
||||
chunk has 30 bytes (7,558 of 7,558 over all pairs); the IDML has no
|
||||
`Id` for the 3 markers whose chunk has 26 bytes. `PageReferenceType`
|
||||
(`CurrentPage` in all) has no located field, and `ReferencedTopic` names
|
||||
an index topic, which the converter does not write yet; both are left
|
||||
out (the schema allows that). Chunk 0x13008 is u16 1 and the topic UID
|
||||
(class 0x13005).
|
||||
Its layout and attributes are in `index.md`.
|
||||
|
||||
**Anchored object settings (chunk 0x2800).** The anchor object (class
|
||||
0x262) and object styles have a 62-byte chunk 0x2800:
|
||||
|
||||
Reference in new issue
Block a user