Inserted text over several text runs is written as a child of its
paragraph range, or of the story when it spans paragraph ranges, with
the ranges split at its ends, instead of one Change per character range.
A character-level hyperlink source whose whole extent is inserted text
is written inside the Change. Changes over tables, anchored items or
XML markers, and changes that do not nest with a paragraph-level
source, keep the per-range form.
compare.py, trustworthy pairs: 3,960 of the 3,962 reference Change
elements have an equal one in the output (3,969 written);
HyperlinkTextSource/Change extras fall from 220 values in 10 documents
to 0; 13 more text range starts. Only stories with tracked changes or
sources in changes differ in the output.
Where an inserted change run starts at a hyperlink source's first
character and ends before the source does, IDML writes an empty Change
before the source and the first character without one; a paragraph-level
source gets a character range of its own for the deleted text and the
empty Change. The converter now writes the same 1,681 empty changes as
the trustworthy references (385 of 385 in stale pairs).
Deleted text owned by a table cell's terminating return is written as
the cell's last child. All 1,889 deleted-text changes of the trustworthy
pairs are now written.
compare.py (trustworthy pairs), together with the form fields that
follow: TextRange (element not produced) 6,062 -> 758 values,
TextRange (story text differs) 8,417 -> 3,979.
- Footnotes: text owned by a footnote (class 0x24F) is read into the
footnote and written as a Footnote element in place of its U+0004;
hyperlink sources inside footnotes are placed like the others.
- FootnoteOption from preferences chunk 0x2820 (styles, numbering,
marker, spacing, strings, splitting, straddling, both rules); without
the chunk, the text style and straddling every IDML has. The value
file reader decodes numeric character references, which fixes the
SeparatorText tab.
- EndnoteOption from chunk 0x2261E; default marker and text styles
without it. IsEndnoteStory from DOM 13 instead of 15.
- Endnotes: the endnote story (class 0x2801) is converted, references
(class 0x2805) become Endnote elements, ranges (class 0x2804, in the
range tree) EndnoteRange, and its frames EndnoteTextFrame, as InDesign
writes them.
- compare.py accepts the schema errors of that endnote markup when the
reference IDML of the pair has the same errors (docs/measurement.md).
Trustworthy pairs: reproduced 10,579,111 -> 10,650,374 (91.92 % ->
92.54 %); stories with identical text 18,565 -> 18,574 (0 missing);
documents >= 99 % 20 -> 21; TextRange +62,059, FootnoteOption and
IsEndnoteStory complete, EndnoteOption +1,356, hyperlinks in footnotes
+271. Extra values 26,179 -> 26,107. No key reproduces fewer values.
Schema validation: 0 failures; 1 pair accepted by the endnote rule; 11
files without a reference fail only on endnote markup.
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.