InDesign 5.0 destinations have no key, hyperlinks name their destination
by UID, text destination owners use chunk 0x1351E, and text sources are
placed by start and end markers owned by the story (chunk 0x13524)
instead of a range tree. These are read by version; keys are left out
where there are none.
No 5.0 file has an IDML. Over the 17 5.0 files with hyperlinks: 121
hyperlinks, 118 text sources, 7 text destinations and 45 bookmarks are
now written, the 116 warnings about their destination objects are gone,
and every output validates. Pair results unchanged (91.92 %, extra
values 26,516). Schema validation: 0 failures.
Class 0x13552 objects are written as HyperlinkExternalPageDestination:
hidden and key from chunk 0x13580, page index from chunk 0x1B8, view
from chunk 0x13527, and the name IDML derives from the linked
document's file name. DocumentPath is left out (it starts with a volume
name the INDD does not hold). Hyperlinks of kind 2004 and bookmarks now
find them.
Trustworthy pairs: reproduced 10,566,138 -> 10,578,767 (91.81 % ->
91.92 %); 643 of 643 external page destinations with all values but
DocumentPath, 576 more hyperlinks, bookmarks 452 -> 1,027 of 1,027.
Extra values unchanged (26,516); no key reproduces fewer values. Schema
validation: 0 failures.
- A text source over several character ranges of one paragraph range is
written as a child of the ParagraphStyleRange: the ranges at its ends
are split and the parts inside become its CharacterStyleRange
children. Sources across paragraph ranges, or holding an XML marker,
are left out with a warning.
- Text sources with chunk 0x135A0 are written as CrossReferenceSource
with AppliedFormat. One that holds more than a text variable instance
is written at paragraph level, since the schema allows no Content in
it.
Trustworthy pairs: reproduced 10,530,141 -> 10,566,138 (91.50 % ->
91.81 %); HyperlinkTextSource 3,449 -> 5,475, CrossReferenceSource 116,
hyperlinks 3,097 -> 5,149, all with their values. Extra values 26,634 ->
26,516: the 332 values of cross-reference sources written as hyperlink
sources go, and cross-reference sources written around a character
range add their inner ranges (one pair). No key reproduces fewer values.
"spans several text ranges" warnings over all files 9,703 -> 3,277.
Schema validation: 0 failures.
Class 0x13504 objects are read as text or paragraph destinations (kind
in chunk 0x13526). The story's owned items of class 0x1353C name them at
their U+FEFF, which is now written as an empty HyperlinkTextDestination
or ParagraphDestination element instead of the character. Hyperlinks and
bookmarks can point at them.
Trustworthy pairs: reproduced 10,513,964 -> 10,530,141 (91.36 % ->
91.50 %); stories with identical text 18,517 -> 18,565; documents at
>= 99 % 18 -> 20; HyperlinkTextDestination 685 of 685,
ParagraphDestination 119 of 119, bookmarks 373 -> 452. Extra values
unchanged (26,634); no key reproduces fewer values. Schema validation: 0
failures. The 7 text destinations of InDesign 5.0 files (no key) are
left out with a warning, like their page and URL destinations.
- Text source chunk 0x135B7 is decoded (type, anchor name, index marker,
page number string, level) and written as AlternativeDestination;
control characters in the page number become <?AID 00xx?> text.
- Page item sources (class 0x13503) are written as
HyperlinkPageItemSource when their page item is written, and their
hyperlinks with them.
Trustworthy pairs: reproduced 10,511,339 -> 10,513,964 (91.36 %);
AlternativeDestination 463 -> 1,048 of 1,048, HyperlinkPageItemSource
136 of 136, 136 more hyperlinks. Extra values unchanged (26,634); no key
reproduces fewer values. Schema validation: 0 failures.
- Hyperlink: Visible, Width, BorderStyle and BorderColor whenever chunk
0x13553 has the corpus pattern, Highlight from its byte 10, no
BorderColor for hyperlinks to a page of another document.
- Hyperlink destination: left out for hyperlinks into another document
(chunk 0x1359F) instead of a wrong local destination; `n` for kind
2000 without a destination; hyperlinks without a source are left out.
- Page destination: ViewBounds from chunk 0x13527 and NameManually.
Trustworthy pairs: reproduced 10,505,081 -> 10,511,339 (91.28 % ->
91.33 %); 22 more hyperlinks, Hyperlink appearance keys 1,982 -> 2,878
of 2,878, page destination ViewBounds and NameManually 831 of 831,
Destination wrong 0. Extra values unchanged (26,634); no key reproduces
fewer values. Schema validation: 0 failures.
- InDesign 5.0: read document chunk 0x13501 with the 3.0/4.0 layout
(four UID lists); the 6.0 layout failed on 17 files.
- Reject files that are shorter than their database pages as truncated,
and check the signature before the size so that short files of other
kinds are reported as not INDD files. The corpus tests accept both.
- Hyperlink page destinations: write view setting 0 as Fixed (567 of 567
in the pairs); leave out a zoom outside the schema's 5-4000 %.
- Leave out, with a warning, values the IDML schema does not allow: ink
neutral density -1, writing script 0xFFFFFFFF, negative drop shadow
size and other out-of-range transparency values. The IDML writer now
returns its own warnings.
- Bullet list: the font style can be followed by 1 and four bytes.
- InDesign 2.0: in-object strings start with 1, not 2.
- InDesign 2.0-5.0: XML tag names are a flag byte and a string, in
either byte order.
- InDesign 3.0 and 4.0: the document's hyperlink lists start at offset
0 and include page destinations.
- XMP: the packet can be shorter than its object; take its length.
- InDesign 1.x files (no signature, DOCUMENT at 0x5C) are reported as
not supported; files whose page directory lies beyond the database
pages as having no object database.
- Schema: leave out hyperlink sources that hold an anchored object, and
the characters U+FFFE and U+FFFF, which XML does not allow.
tests/corpus.rs accepts the two rejections above and skips the paths
listed in the local corpus/exclude.txt.
Read hyperlinks (class 0x13501), text sources (0x13502) with their text
ranges from the story's range tree, page and URL destinations and
bookmarks, and write them to designmap and the stories. Evidence is in
docs/format/hyperlinks.md.