chore: regenerate the element values from the larger corpus

Regenerate src/idml/element_values.xml from the 827 distinct IDML files
of the corpus (683 before). Values that now vary across the IDML files
drop out:

- Story AppliedNamedGrid, StoryPreference FrameType and
  StoryOrientation (stories with named grids, frame grids or vertical
  text)
- Page GridStartingPoint (28 pages of DOM 18)
- TOCStyle SetStoryDirection (3 styles are Vertical)
- 9 TextDefault, 2 CjkGridPreference and 1 IndexOptions preference values

element_values.py now collects ClippingPathSettings only for
ClippingType="None", the only case in which the converter writes the
element, and leaves user-named trap presets out of the TrapPreset list.
Without these two rules a DOM 12 file with its own trap preset and 8
images with a clipping path would have removed the values for every
document.

root_values.py read the text attribute table from src/idml/mod.rs,
which moved to attrs.rs; it now runs again. Its files stay pinned and
are not regenerated (idml-values.md says why).

compare.py --exclude own/ (803 pairs, 606 trustworthy):
- trustworthy coverage 97.95% -> 97.55% (12,036,295 -> 11,986,627 of
  12,287,602); all pairs 96.12% -> 95.72%
- the loss is the dropped Story AppliedNamedGrid (19,416), FrameType
  (19,368), Page GridStartingPoint (10,052), TOCStyle
  SetStoryDirection (618) and StoryOrientation (214)
- extra values 26,257 -> 26,256 (all pairs 305,366 -> 303,866)
- conversion failures 0 of 803
This commit is contained in:
aiongg committed 2026-10-08 13:04:04 +00:00
1 parent f38be0d160
commit d34e22bea2
4 files changed
+80 -49

No files matched your search

+58 -37
View File
@@ -41,7 +41,14 @@ documents of that InDesign version or later (`MinimumVersion` in the
file). The corpus has grown since; the later pairs are evidence for the
values of other elements (below). Regenerating these files from all pairs
would drop some values that the larger corpus shows to vary between
documents, such as table style stroke weights.
documents, such as table style stroke weights. With the 828 distinct
IDML files of the corpus in 2026-10, 19 values of `[No paragraph
style]`, 41 of the object style `[None]` and 19 of `[No table style]`
vary, and DOM 7 files differ from later ones in many values. The files
also predate most of the text attributes the converter now reads from
the INDD; the tool leaves those out, so regenerating them would also
remove values that the INDD supplies only for some styles. Regenerating
them is a change of its own, with its own measurement.
| Root style | Values | Same in | Written for version |
|---|---|---|---|
@@ -116,14 +123,13 @@ element in the package.
`tools/element_values.py` collects the values of `Story`, `XmlStory`
and their `StoryPreference` and `InCopyExportOption` children from the
683 corpus IDML files (`element_values.xml`); the converter writes them
827 corpus IDML files (`element_values.xml`); the converter writes them
where the INDD gives no value:
| Element | Values kept | Versions |
|---|---|---|
| `Story` | `TrackChanges="false"`, `AppliedNamedGrid="n"` | 7 on |
| `Story` | `TrackChanges="false"` | 7 on |
| `Story`, `XmlStory` | `UserText="true"` where written | 11 on; IDML has it from version 11.2 (none of the 3,184 stories of DOM 10.0 to 11.0, every story from 11.2), and the converter writes it from INDD version 11.2 |
| `StoryPreference` | `FrameType="TextFrameType"`, `StoryOrientation="Horizontal"` | 7 on |
| `InCopyExportOption` of stories | `IncludeGraphicProxies="true"`, `IncludeAllResources="false"` | 7 on |
The other story values are read from the INDD: `StoryTitle`,
@@ -133,18 +139,29 @@ story settings); `IsEndnoteStory` from the story class (`footnotes.md`);
`AppliedTOCStyle` from chunk 0x8C40.
`StoryOrientation` is read from the story's frames when they agree
(`objects.md`, text orientation); the observed `Horizontal` is written
only for other stories. For a sample typeset vertically, no field was
found that sets `FrameType` apart from horizontal samples, so it keeps
the observed value there too.
(`objects.md`, text orientation).
Left out because they vary: `Story` `AppliedNamedGrid` (106 of 27,816
stories name a grid, all in DOM 12 files), `StoryPreference`
`FrameType` (57 stories have `FrameGridType`, in DOM 12, 13 and 18
files) and `StoryOrientation` (100 stories are `Vertical`). Before the
corpus had samples typeset in Japanese, every IDML had `n`,
`TextFrameType` and `Horizontal`.
## Graphic settings without an INDD field
`element_values.xml` holds the `ClippingPathSettings` values of every
`Image`, `PDF` and `EPS` element in the 683 corpus IDML files:
`Image`, `PDF` and `EPS` element with `ClippingType="None"` in the 827
corpus IDML files:
`ClippingType="None"`, `InvertPath="false"`, `IncludeInsideEdges="false"`,
`RestrictToFrame="false"` and `AppliedPathName="$ID/"` (and for PDF and
EPS also the values the converter reads for images). EPS graphics occur
EPS also the values the converter reads for images). The converter writes
the element only for clipping type 0 in chunk 0x2C1A, which IDML writes
as `None` (`objects.md`), so `tools/element_values.py` collects only those
elements (`WRITTEN_FOR`). The 8 images with another `ClippingType` (7
with `AppliedPathName` set, 1 with `InvertPath` and `RestrictToFrame`
`true`) are the only elements with other values; all 7,698 elements with
`None` have the values above. EPS graphics occur
only up to DOM 20, so a DOM 21 EPS gets only the values read from the
INDD. Every `ImageIOPreference` has `AllowAutoEmbedding="true"`. The
converter writes the values read from the INDD first (`objects.md`,
@@ -224,7 +241,7 @@ version; the converter writes it from 13.1.
## Composite font entries
The converter writes only the built-in composite font `[No composite
font]`. All 5,159 of its `CompositeFontEntry` elements in the 683 corpus
font]`. All 5,231 of its `CompositeFontEntry` elements in the corpus
IDML files have `Locked="true"`, `RelativeSize="100"`,
`BaselineShift="0"`, `HorizontalScale="100"` and `VerticalScale="100"`.
No INDD field for `Locked` is identified; the converter writes it on
@@ -234,7 +251,7 @@ have other values.
## Inks
Every `Ink` element of the 683 corpus IDML files has `InkType="Normal"`
Every `Ink` element of the 827 corpus IDML files has `InkType="Normal"`
and `PrintInk="true"` (`element_values.xml`); the converter writes them
on every ink. `ConvertToProcess` is read from the INDD (`objects.md`,
inks).
@@ -242,7 +259,7 @@ inks).
## Values of other elements
`tools/element_values.py` collects the values of other elements the
converter writes from every distinct IDML of the corpus (683 files
converter writes from every distinct IDML of the corpus (827 files
exported by InDesign; one more IDML in the corpus lacks the `product` of
InDesign's `aid` processing instruction and was written by a script, so
it is left out). A value is kept for a range of DOM versions when every
@@ -254,19 +271,19 @@ each range needs 10 files. The kept values are in
`MaximumVersion`. The converter writes them after the values it reads
from the INDD and only where the element lacks the attribute.
Files per DOM version: 7: 9, 8: 67, 9: 8, 10: 52, 11: 48, 12: 39, 13: 79,
14: 74, 15: 66, 16: 42, 17: 17, 18: 48, 19: 70, 20: 31, 21: 33.
Files per DOM version: 7: 9, 8: 67, 9: 8, 10: 52, 11: 48, 12: 106, 13: 116,
14: 74, 15: 66, 16: 42, 17: 17, 18: 88, 19: 70, 20: 31, 21: 33.
### Page items
| Element | Elements | Values kept |
|---|---|---|
| `TextFrame` | 32,002 | `LocalDisplaySetting="Default"`, `GradientStrokeAngle`, `GradientStrokeHiliteLength`, `GradientStrokeHiliteAngle` (`0`) from DOM 7; `FlexItemWidthMode` and `FlexItemHeightMode` (`FlexFixed`) from 21 |
| `Rectangle` | 24,314 | `LocalDisplaySetting`, `StoryTitle="$ID/"` from 7 |
| `Oval` | 3,356 | `LocalDisplaySetting`, `StoryTitle` and the gradient highlights from 8 |
| `Polygon` | 52,774 | `LocalDisplaySetting`, `StoryTitle` and the gradient highlights from 7 |
| `GraphicLine` | 4,351 | `LocalDisplaySetting`, `LockState="None"` and the gradient highlights from 7 |
| `Group` | 9,010 | `LocalDisplaySetting`, `GradientStrokeAngle` and the gradient highlights from 7 |
| `TextFrame` | 33,580 | `LocalDisplaySetting="Default"`, `GradientStrokeAngle`, `GradientStrokeHiliteLength`, `GradientStrokeHiliteAngle` (`0`) from DOM 7; `FlexItemWidthMode` and `FlexItemHeightMode` (`FlexFixed`) from 21 |
| `Rectangle` | 24,737 | `LocalDisplaySetting`, `StoryTitle="$ID/"` from 7 |
| `Oval` | 3,393 | `LocalDisplaySetting`, `StoryTitle` and the gradient highlights from 8 |
| `Polygon` | 52,863 | `LocalDisplaySetting`, `StoryTitle` and the gradient highlights from 7 |
| `GraphicLine` | 4,413 | `LocalDisplaySetting`, `LockState="None"` and the gradient highlights from 7 |
| `Group` | 9,063 | `LocalDisplaySetting`, `GradientStrokeAngle` and the gradient highlights from 7 |
Each kind also has `FlexItemWidthMode` and `FlexItemHeightMode` from
DOM 21, and values that the converter reads from the INDD
@@ -279,16 +296,19 @@ values come from the INDD.
| Element | Elements | Values kept |
|---|---|---|
| `Spread` | 7,281 | `PageTransitionType="None"`, `PageTransitionDirection="NotApplicable"`, `PageTransitionDuration="Medium"`, `ShowMasterItems="true"`, `FlattenerOverride="Default"` from DOM 7; `SpreadHidden="false"` from 19 |
| `FlattenerPreference` of spreads | 7,281 | `ClipComplexRegions`, `ConvertAllStrokesToOutlines`, `ConvertAllTextToOutlines` (`false`) and `RasterVectorBalance` 50 from DOM 7 |
| `MasterSpread` | 1,412 | `OverriddenPageItemProps=""` from DOM 7 |
| `Page` | 12,639 | `AppliedTrapPreset="TrapPreset/$ID/kDefaultTrapStyleName"`, `GridStartingPoint="TopOutside"` from DOM 7; `SnapshotBlendingMode="IgnoreLayoutSnapshots"`, `OptionalPage="false"` from 8 |
| `Layer` | 1,546 | `ShowGuides` and `Expendable` (`true`) from DOM 7 |
| `Spread` | 7,725 | `PageTransitionType="None"`, `PageTransitionDirection="NotApplicable"`, `PageTransitionDuration="Medium"`, `ShowMasterItems="true"`, `FlattenerOverride="Default"` from DOM 7; `SpreadHidden="false"` from 19 |
| `FlattenerPreference` of spreads | 7,725 | `ClipComplexRegions`, `ConvertAllStrokesToOutlines`, `ConvertAllTextToOutlines` (`false`) and `RasterVectorBalance` 50 from DOM 7 |
| `MasterSpread` | 1,585 | `OverriddenPageItemProps=""` from DOM 7 |
| `Page` | 13,733 | `AppliedTrapPreset="TrapPreset/$ID/kDefaultTrapStyleName"` from DOM 7; `SnapshotBlendingMode="IgnoreLayoutSnapshots"`, `OptionalPage="false"` from 8 |
| `Layer` | 1,755 | `ShowGuides` and `Expendable` (`true`) from DOM 7 |
Every spread has one `FlattenerPreference`, so the converter writes the
element on every spread. For a spread without the flattener chunk
(`objects.md`, flattener settings) it also writes
`LineArtAndTextResolution="300"` and `GradientAndMeshResolution="150"`.
`GridStartingPoint` is left out: 28 pages of DOM 18 files have another
value than `TopOutside`.
These are not in every IDML: 5,045 of the 5,074 trustworthy spreads
without the chunk have them, and the other 29 (all spreads of 9
documents) have 400 and 400. No INDD field tells the two groups apart
@@ -314,7 +334,7 @@ all of them have; the converter writes it in the order of the IDML files.
| `HTMLFXLExportPreference` | 11 | both | |
| `PublishExportPreference` | 11 | 11 | `ImageExportResolution`, `PublishPdf` |
`Assignment` (683 elements, one per file): `UserName="$ID/"`,
`Assignment` (827 elements, one per file): `UserName="$ID/"`,
`ExportOptions="AssignedSpreads"`, `IncludeLinksWhenPackage="true"`,
`FilePath="$ID/"` and `FrameColor` `Nothing`, from DOM 7.
@@ -348,9 +368,9 @@ character styles in the IDML files):
| `EmitCss="true"` where written | paragraph and character | 10 on |
| `SplitDocument="false"` where written | character | 10 on |
TOC styles (707 in the IDML files) all have `RunIn="false"` and
`IncludeHidden="false"`, and `SetStoryDirection="Horizontal"` where they
have it (all but one, from DOM 7 on).
TOC styles (851 in the IDML files) all have `RunIn="false"` and
`IncludeHidden="false"`. `SetStoryDirection` is left out: 3 styles have
`Vertical`.
The paragraph styles' `SplitDocument` and `IncludeClass` are left out:
a few styles have other values, whose INDD field was not found. Keyboard
@@ -375,12 +395,13 @@ Colours have their creator and alternate colour in the INDD
### Trap presets
All 683 IDML files list the same two `TrapPreset` elements at the end of
All 827 IDML files list the same two `TrapPreset` elements at the end of
`Resources/Styles.xml`, with the same attributes: `$ID/k[No Trap
Preset]` and `$ID/kDefaultTrapStyleName`, which every page applies. The
converter writes the list (a `List` block of the values file). A
document with trap presets of its own would have more; the corpus has
none, so their INDD objects are not decoded.
converter writes the list (a `List` block of the values file). One DOM
12 file has a third preset, named by the user, after these two. Its INDD
object is not decoded, so the tool leaves presets with such names out of
the list.
### Values written where the converter writes the attribute
@@ -447,7 +468,7 @@ blocks of `element_values.xml`, `root_values.xml` and
`object_style_values.xml` are not used, because those files are keyed
by major version only.
Every `InCopyExportOption` of a rectangle, oval or polygon in the 683
Every `InCopyExportOption` of a rectangle, oval or polygon in the 827
corpus IDML files has `IncludeGraphicProxies="true"` and
`IncludeAllResources="false"` (`element_values.xml`; ovals from DOM 8,
as no DOM 7 file has one). The converter writes the element with these
@@ -526,7 +547,7 @@ For example `TextDefault` keeps 264 of its 317 values,
in a later version is kept only when at least 10 files show it.
`tools/element_values.py` also collects the preference elements from all
683 IDML files of the larger corpus (paths `Preferences/<tag>` in
827 IDML files of the larger corpus (paths `Preferences/<tag>` in
`src/idml/element_values.xml`), with its rule for other elements (per
range of DOM versions, at least 10 files). The converter adds these
values where `preference_values.xml` has none. They add, for example,
@@ -540,7 +561,7 @@ style are written only when the package has that style.
`ImportTextIntoTables="true"`, `ImportToSelected="true"`,
`RemoveUnmatchedExisting="false"`, `RepeatTextElements="true"` and
`DictionaryPreference` `MergeUserDictionary="false"` are the same in all
654 pairs. Two IDML files of the 683 differ: one in the six
803 pairs. Two IDML files of the 827 differ: one in the six
`XMLImportPreference` values, one in `MergeUserDictionary`. Both were
exported by an earlier version than their INDD was last saved with, so
they are not pairs, and the INDD cannot show which field holds the
+5 -7
View File
@@ -34,7 +34,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
</FlattenerPreference>
</Spread>
<MasterSpread OverriddenPageItemProps="" ItemTransform="1 0 0 1 0 0" />
<Page AppliedTrapPreset="TrapPreset/$ID/kDefaultTrapStyleName" GridStartingPoint="TopOutside" />
<Page AppliedTrapPreset="TrapPreset/$ID/kDefaultTrapStyleName" />
<Layer ShowGuides="true" Expendable="true" />
<Gradient ColorEditable="true" ColorRemovable="true" SwatchCreatorID="7937" />
<Swatch ColorEditable="false" ColorRemovable="false" Visible="true" SwatchCreatorID="7937" />
@@ -61,8 +61,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
<WatermarkPreference Present="true" WatermarkVisibility="false" WatermarkDoPrint="false" WatermarkDrawInBack="true" WatermarkText="" WatermarkFontPointSize="48" WatermarkOpacity="50" WatermarkRotation="0" WatermarkHorizontalPosition="WatermarkHCenter" WatermarkHorizontalOffset="0" WatermarkVerticalPosition="WatermarkVCenter" WatermarkVerticalOffset="0" />
<TaggedPDFPreference StructureOrder="UseXMLStructure" />
</Document>
<Story TrackChanges="false" AppliedNamedGrid="n">
<StoryPreference FrameType="TextFrameType" StoryOrientation="Horizontal" />
<Story TrackChanges="false">
<InCopyExportOption IncludeGraphicProxies="true" IncludeAllResources="false" />
</Story>
<XmlStory AppliedTOCStyle="n" TrackChanges="false" StoryTitle="$ID/" AppliedNamedGrid="n" />
@@ -104,7 +103,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
</Properties>
</TextFramePreference>
<TextPreference UseOpticalSize="true" HighlightKinsoku="false" AddPages="EndOfStory" />
<TextDefault KeepAllLinesTogether="false" KeepFirstLines="2" KeepLastLines="2" DesiredGlyphScaling="100" RuleAboveOverprint="false" RuleAboveGapTint="-1" RuleAboveGapOverprint="false" RuleBelowLeftIndent="0" RuleBelowRightIndent="0" RuleBelowGapTint="-1" Position="Normal" StrikeThru="false" Skew="0" StrokeTint="-1" OverprintStroke="false" OverprintFill="false" OTFOrdinal="false" OTFFraction="false" OTFDiscretionaryLigature="false" OTFTitling="false" OTFSwash="false" UnderlineGapTint="-1" UnderlineOverprint="false" UnderlineGapOverprint="false" StrikeThroughTint="-1" StrikeThroughGapTint="-1" StrikeThroughOverprint="false" StrikeThroughGapOverprint="false" StrikeThroughWeight="-9999" KeepWithPrevious="false" SplitColumnOutsideGutter="0" SpanColumnMinSpaceBefore="0" SpanColumnMinSpaceAfter="0" LastLineIndent="0" OTFSlashedZero="false" OTFHistorical="false" GradientFillLength="-1" GradientFillAngle="0" GradientStrokeLength="-1" GradientStrokeAngle="0" GradientFillStart="0 0" GradientStrokeStart="0 0" RuleBelowOverprint="false" RuleBelowGapOverprint="false" KeepRuleAboveInFrame="false" IgnoreEdgeAlignment="false" OTFMark="true" OTFLocale="true" PositionalForm="None" OTFOverlapSwash="false" OTFStylisticAlternate="false" OTFJustificationAlternate="false" OTFStretchedAlternate="false" KeyboardDirection="DefaultDirection" DigitsType="DefaultDigits" Kashidas="DefaultKashidas" XOffsetDiacritic="0" YOffsetDiacritic="0" ParagraphBreakType="Anywhere" PageNumberType="AutoPageNumber" CharacterAlignment="AlignEmCenter" Tsume="0" LeadingAki="-1" TrailingAki="-1" CharacterRotation="0" Jidori="0" ShataiMagnification="0" ShataiDegreeAngle="4500" ShataiAdjustRotation="false" ShataiAdjustTsume="true" Tatechuyoko="false" TatechuyokoXOffset="0" TatechuyokoYOffset="0" KentenTint="-1" KentenStrokeTint="-1" KentenWeight="-1" KentenOverprintFill="Auto" KentenOverprintStroke="Auto" KentenKind="None" KentenPlacement="0" KentenAlignment="AlignKentenCenter" KentenPosition="AboveRight" KentenXScale="100" KentenYScale="100" KentenCustomCharacter="" KentenCharacterSet="CharacterInput" RubyTint="-1" RubyWeight="-1" RubyOverprintFill="Auto" RubyOverprintStroke="Auto" RubyStrokeTint="-1" RubyOpenTypePro="true" RubyXScale="100" RubyYScale="100" RubyType="PerCharacterRuby" RubyAlignment="RubyJIS" RubyPosition="AboveRight" RubyXOffset="0" RubyYOffset="0" RubyParentSpacing="RubyParent121Aki" RubyAutoAlign="true" RubyOverhang="false" RubyAutoScaling="false" RubyParentScalingPercent="66" RubyParentOverhangAmount="RubyOverhangOneRuby" Warichu="false" WarichuSize="50" WarichuLines="2" WarichuLineSpacing="0" WarichuAlignment="Auto" WarichuCharsAfterBreak="2" WarichuCharsBeforeBreak="2" OTFHVKana="false" OTFRomanItalics="false" CjkGridTracking="false" GlyphForm="None" GridGyoudori="0" AutoTcyIncludeRoman="false" KinsokuHangType="None" RotateSingleByteCharacters="false" RubyAutoTcyIncludeRoman="false" RubyAutoTcyAutoScale="true" AllowArbitraryHyphenation="false" ParagraphGyoudori="false" BulletsTextAfter="^t" NumberingLevel="1" NumberingContinue="true" NumberingStartAt="1" NumberingApplyRestartPolicy="true" AppliedNamedGrid="n">
<TextDefault KeepAllLinesTogether="false" KeepFirstLines="2" KeepLastLines="2" DesiredGlyphScaling="100" RuleAboveOverprint="false" RuleAboveGapTint="-1" RuleAboveGapOverprint="false" RuleBelowLeftIndent="0" RuleBelowRightIndent="0" RuleBelowGapTint="-1" Position="Normal" StrikeThru="false" Skew="0" StrokeTint="-1" OverprintStroke="false" OverprintFill="false" OTFOrdinal="false" OTFFraction="false" OTFDiscretionaryLigature="false" OTFTitling="false" OTFSwash="false" UnderlineGapTint="-1" UnderlineOverprint="false" UnderlineGapOverprint="false" StrikeThroughTint="-1" StrikeThroughGapTint="-1" StrikeThroughOverprint="false" StrikeThroughGapOverprint="false" StrikeThroughWeight="-9999" KeepWithPrevious="false" SplitColumnOutsideGutter="0" SpanColumnMinSpaceBefore="0" SpanColumnMinSpaceAfter="0" LastLineIndent="0" OTFSlashedZero="false" OTFHistorical="false" GradientFillLength="-1" GradientFillAngle="0" GradientStrokeLength="-1" GradientStrokeAngle="0" GradientFillStart="0 0" GradientStrokeStart="0 0" RuleBelowOverprint="false" RuleBelowGapOverprint="false" KeepRuleAboveInFrame="false" IgnoreEdgeAlignment="false" OTFMark="true" OTFLocale="true" PositionalForm="None" OTFOverlapSwash="false" OTFStylisticAlternate="false" OTFJustificationAlternate="false" OTFStretchedAlternate="false" KeyboardDirection="DefaultDirection" DigitsType="DefaultDigits" Kashidas="DefaultKashidas" XOffsetDiacritic="0" YOffsetDiacritic="0" ParagraphBreakType="Anywhere" PageNumberType="AutoPageNumber" LeadingAki="-1" TrailingAki="-1" CharacterRotation="0" Jidori="0" ShataiMagnification="0" ShataiDegreeAngle="4500" ShataiAdjustRotation="false" ShataiAdjustTsume="true" Tatechuyoko="false" TatechuyokoXOffset="0" TatechuyokoYOffset="0" KentenTint="-1" KentenStrokeTint="-1" KentenWeight="-1" KentenOverprintFill="Auto" KentenOverprintStroke="Auto" KentenPlacement="0" KentenAlignment="AlignKentenCenter" KentenPosition="AboveRight" KentenXScale="100" KentenYScale="100" KentenCustomCharacter="" KentenCharacterSet="CharacterInput" RubyTint="-1" RubyWeight="-1" RubyOverprintFill="Auto" RubyOverprintStroke="Auto" RubyStrokeTint="-1" RubyOpenTypePro="true" RubyXScale="100" RubyYScale="100" RubyType="PerCharacterRuby" RubyAlignment="RubyJIS" RubyPosition="AboveRight" RubyXOffset="0" RubyYOffset="0" RubyParentSpacing="RubyParent121Aki" RubyAutoAlign="true" RubyOverhang="false" RubyAutoScaling="false" RubyParentScalingPercent="66" RubyParentOverhangAmount="RubyOverhangOneRuby" Warichu="false" WarichuSize="50" WarichuLines="2" WarichuLineSpacing="0" WarichuAlignment="Auto" WarichuCharsAfterBreak="2" WarichuCharsBeforeBreak="2" OTFHVKana="false" OTFRomanItalics="false" AutoTcyIncludeRoman="false" RubyAutoTcyIncludeRoman="false" RubyAutoTcyAutoScale="true" AllowArbitraryHyphenation="false" ParagraphGyoudori="false" BulletsTextAfter="^t" NumberingLevel="1" NumberingContinue="true" NumberingStartAt="1" NumberingApplyRestartPolicy="true" AppliedNamedGrid="n">
<Properties>
<RuleAboveGapColor type="object">Swatch/None</RuleAboveGapColor>
<RuleAboveType type="object">StrokeStyle/$ID/Solid</RuleAboveType>
@@ -160,7 +159,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
</Properties>
</XMLPreference>
<ExportForWebPreference CopyFormattedImages="false" CopyOptimizedImages="false" CopyOriginalImages="false" ImageConversion="Automatic" GIFOptionsPalette="AdaptivePalette" GIFOptionsInterlaced="false" JPEGOptionsQuality="Medium" JPEGOptionsFormat="BaselineEncoding" />
<IndexOptions IncludeBookDocuments="false" IncludeHiddenEntries="false" IndexFormat="NestedFormat" IncludeEmptyIndexSections="false" Level2Style="ParagraphStyle/$ID/[No paragraph style]" Level3Style="ParagraphStyle/$ID/[No paragraph style]" Level4Style="ParagraphStyle/$ID/[No paragraph style]" CrossReferenceStyle="CharacterStyle/$ID/[No character style]" CrossReferenceTopicStyle="CharacterStyle/$ID/[No character style]" FollowingTopicSeparator=" " PageRangeSeparator="^=" EntryEndSeparator="" />
<IndexOptions IncludeHiddenEntries="false" IndexFormat="NestedFormat" IncludeEmptyIndexSections="false" Level2Style="ParagraphStyle/$ID/[No paragraph style]" Level3Style="ParagraphStyle/$ID/[No paragraph style]" Level4Style="ParagraphStyle/$ID/[No paragraph style]" CrossReferenceStyle="CharacterStyle/$ID/[No character style]" CrossReferenceTopicStyle="CharacterStyle/$ID/[No character style]" FollowingTopicSeparator=" " PageRangeSeparator="^=" EntryEndSeparator="" />
<IndexHeaderSetting HeaderSetName="$ID/" HeaderSetLanguage="256" IndexHeaderSetGroupOptionValue="0" />
<TinDocumentDataObject>
<Properties>
@@ -178,7 +177,7 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
<TransparencyPreference GlobalLightAngle="120" GlobalLightAltitude="30" />
<LayoutGridDataInformation CharacterAki="0" HorizontalScale="100" VerticalScale="100" />
<StoryGridDataInformation CharacterAki="0" HorizontalScale="100" VerticalScale="100" LineAlignment="LeftOrTopLineJustify" GridAlignment="AlignEmCenter" CharacterAlignment="AlignEmCenter" GridView="GridViewEnum" CharacterCountLocation="BottomAlign" />
<CjkGridPreference ShowAllLayoutGrids="false" MinimumScale="50" SnapToLayoutGrid="false" ColorEveryNthCell="10" SingleLineColorMode="true" ICFMode="false" UseCircularCells="false">
<CjkGridPreference MinimumScale="50" ColorEveryNthCell="10" SingleLineColorMode="true" ICFMode="false" UseCircularCells="false">
<Properties>
<LayoutGridColorIndex type="enumeration">GridGreen</LayoutGridColorIndex>
</Properties>
@@ -397,7 +396,6 @@ tools/element_values.py; evidence in docs/format/idml-values.md.
<TextFrame>
<TextFramePreference VerticalThreshold="0" />
</TextFrame>
<TOCStyle SetStoryDirection="Horizontal" />
</WhenWritten>
<WhenWritten MinimumVersion="8">
<TextFrame>
+15 -3
View File
@@ -103,7 +103,9 @@ PREFERENCES = [
ELEMENTS += ["Preferences/" + t for t in PREFERENCES]
# Of those, the elements every IDML has one of (from some version on).
SINGLETONS = {p for p in ELEMENTS if p.startswith("Document/")}
# Elements with Self written as a whole list.
# Elements with Self written as a whole list. Elements whose Self does
# not start with "<tag>/$ID/" are named by the user; the converter does
# not decode them, so they are left out of the list.
LISTS = ["TrapPreset"]
# Values that depend only on another attribute of the element: tag ->
# (key attribute, attributes). For each key value, an attribute is kept
@@ -135,6 +137,14 @@ WHEN_WRITTEN = {
"TOCStyle": ["SetStoryDirection"],
"CharacterStyle": ["EmitCss", "SplitDocument"],
}
# Elements the converter writes only for one value of an attribute that
# it reads from the INDD: path -> (attribute, value). Elements on the
# path with another value are not collected. ClippingPathSettings is
# written only for a clipping type 0 in chunk 0x2C1A, which IDML writes
# as ClippingType="None" (docs/format/objects.md, clipping path).
WRITTEN_FOR = {
f"{t}/ClippingPathSettings": ("ClippingType", "None") for t in ("Image", "PDF", "EPS")
}
# Values that are nearly constant; the exceptions are read from the INDD.
# (path, key) -> reason, as recorded in docs/format/idml-values.md.
EXPLAINED = {}
@@ -231,7 +241,7 @@ def scan(arg):
if path in wanted:
found[path].append(flatten(el))
for el in root.iter():
if el.tag in LISTS:
if el.tag in LISTS and el.get("Self", "").startswith(el.tag + "/$ID/"):
lists[el.tag].append(prop_text(el))
if el.tag in KEYED:
lists["keyed:" + el.tag].append(dict(el.attrib))
@@ -242,7 +252,9 @@ def scan(arg):
for ch in el:
path = f"{el.tag}/{ch.tag}"
if ch.get("Self") is None and path in wanted:
found[path].append(flatten(ch))
cond = WRITTEN_FOR.get(path)
if cond is None or ch.get(cond[0]) == cond[1]:
found[path].append(flatten(ch))
return dom, idml, dict(found), dict(lists)
+2 -2
View File
@@ -8,7 +8,7 @@ Properties child and child element attribute of the root styles and of
the top-level preference elements. A value is kept when it is the same in
every IDML from some DOM version on and present in all of them; the
earliest such version is its minimum version. Attributes the converter
reads from the INDD (the TEXT_ATTRS table in src/idml/mod.rs) are left
reads from the INDD (the TEXT_ATTRS table in src/idml/attrs.rs) are left
out for the paragraph and character root styles, and the document setup
it reads is left out of the preferences. Preference values that refer to
a style other than a root style are left out, since the package need not
@@ -97,7 +97,7 @@ tools/root_values.py; evidence in docs/format/idml-values.md.
def decoded_names():
src = (ROOT / "src" / "idml" / "mod.rs").read_text()
src = (ROOT / "src" / "idml" / "attrs.rs").read_text()
table = src[src.index("const TEXT_ATTRS"):src.index("/// An attribute written as a")]
return set(re.findall(r'0x[0-9A-F]+,\s*"(\w+)"', table))