idml 0.8.9 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,9 @@
3
3
  module Idml
4
4
  module Elements
5
5
  # `<Table>` — a table page item. Carries geometry, body/header
6
- # row counts, column layout, and border styling. Two child
6
+ # row counts, column layout, and border styling. Declares every
7
+ # attribute of Table_Object in Stories/Story.rnc (171 schema
8
+ # attributes). Two child
7
9
  # collections hold the table's content:
8
10
  #
9
11
  # - `row` — schema-faithful `<Row>` siblings (real IDML).
@@ -43,6 +45,167 @@ module Idml
43
45
  attribute :right_border_stroke_weight, :float
44
46
  attribute :right_border_stroke_color, :string
45
47
 
48
+ # The remaining Table_Object attributes (border tints/gaps/
49
+ # overprints, default row/column strokes, alternating fills,
50
+ # cell insets, diagonal lines, caption settings, …) in schema
51
+ # order — generated by `scripts/rnc_to_lutaml.rb` from
52
+ # reference-docs/schemas/package/Stories/Story.rnc.
53
+ attribute :top_border_stroke_type, :string
54
+ attribute :top_border_stroke_tint, :float
55
+ attribute :top_border_stroke_overprint, :boolean
56
+ attribute :top_border_stroke_gap_color, :string
57
+ attribute :top_border_stroke_gap_tint, :float
58
+ attribute :top_border_stroke_gap_overprint, :boolean
59
+ attribute :left_border_stroke_type, :string
60
+ attribute :left_border_stroke_tint, :float
61
+ attribute :left_border_stroke_overprint, :boolean
62
+ attribute :left_border_stroke_gap_color, :string
63
+ attribute :left_border_stroke_gap_tint, :float
64
+ attribute :left_border_stroke_gap_overprint, :boolean
65
+ attribute :bottom_border_stroke_type, :string
66
+ attribute :bottom_border_stroke_tint, :float
67
+ attribute :bottom_border_stroke_overprint, :boolean
68
+ attribute :bottom_border_stroke_gap_color, :string
69
+ attribute :bottom_border_stroke_gap_tint, :float
70
+ attribute :bottom_border_stroke_gap_overprint, :boolean
71
+ attribute :right_border_stroke_type, :string
72
+ attribute :right_border_stroke_tint, :float
73
+ attribute :right_border_stroke_overprint, :boolean
74
+ attribute :right_border_stroke_gap_color, :string
75
+ attribute :right_border_stroke_gap_tint, :float
76
+ attribute :right_border_stroke_gap_overprint, :boolean
77
+ attribute :space_before, :float
78
+ attribute :space_after, :float
79
+ attribute :skip_first_alternating_stroke_rows, :integer
80
+ attribute :skip_last_alternating_stroke_rows, :integer
81
+ attribute :start_row_stroke_count, :integer
82
+ attribute :start_row_stroke_color, :string
83
+ attribute :start_row_stroke_weight, :float
84
+ attribute :start_row_stroke_type, :string
85
+ attribute :start_row_stroke_tint, :float
86
+ attribute :start_row_stroke_gap_overprint, :boolean
87
+ attribute :start_row_stroke_gap_color, :string
88
+ attribute :start_row_stroke_gap_tint, :float
89
+ attribute :start_row_stroke_overprint, :boolean
90
+ attribute :end_row_stroke_count, :integer
91
+ attribute :end_row_stroke_color, :string
92
+ attribute :end_row_stroke_weight, :float
93
+ attribute :end_row_stroke_type, :string
94
+ attribute :end_row_stroke_tint, :float
95
+ attribute :end_row_stroke_overprint, :boolean
96
+ attribute :end_row_stroke_gap_color, :string
97
+ attribute :end_row_stroke_gap_tint, :float
98
+ attribute :end_row_stroke_gap_overprint, :boolean
99
+ attribute :skip_first_alternating_stroke_columns, :integer
100
+ attribute :skip_last_alternating_stroke_columns, :integer
101
+ attribute :start_column_stroke_count, :integer
102
+ attribute :start_column_stroke_color, :string
103
+ attribute :start_column_stroke_weight, :float
104
+ attribute :start_column_stroke_type, :string
105
+ attribute :start_column_stroke_tint, :float
106
+ attribute :start_column_stroke_overprint, :boolean
107
+ attribute :start_column_stroke_gap_color, :string
108
+ attribute :start_column_stroke_gap_tint, :float
109
+ attribute :start_column_stroke_gap_overprint, :boolean
110
+ attribute :end_column_stroke_count, :integer
111
+ attribute :end_column_stroke_color, :string
112
+ attribute :end_column_stroke_weight, :float
113
+ attribute :end_column_line_style, :string
114
+ attribute :end_column_stroke_tint, :float
115
+ attribute :end_column_stroke_overprint, :boolean
116
+ attribute :end_column_stroke_gap_color, :string
117
+ attribute :end_column_stroke_gap_tint, :float
118
+ attribute :end_column_stroke_gap_overprint, :boolean
119
+ attribute :column_fills_priority, :boolean
120
+ attribute :skip_first_alternating_fill_rows, :integer
121
+ attribute :skip_last_alternating_fill_rows, :integer
122
+ attribute :start_row_fill_color, :string
123
+ attribute :start_row_fill_count, :integer
124
+ attribute :start_row_fill_tint, :float
125
+ attribute :start_row_fill_overprint, :boolean
126
+ attribute :end_row_fill_count, :integer
127
+ attribute :end_row_fill_color, :string
128
+ attribute :end_row_fill_tint, :float
129
+ attribute :end_row_fill_overprint, :boolean
130
+ attribute :skip_first_alternating_fill_columns, :integer
131
+ attribute :skip_last_alternating_fill_columns, :integer
132
+ attribute :start_column_fill_count, :integer
133
+ attribute :start_column_fill_color, :string
134
+ attribute :start_column_fill_tint, :float
135
+ attribute :start_column_fill_overprint, :boolean
136
+ attribute :end_column_fill_count, :integer
137
+ attribute :end_column_fill_color, :string
138
+ attribute :end_column_fill_tint, :float
139
+ attribute :end_column_fill_overprint, :boolean
140
+ attribute :break_headers, :string
141
+ attribute :break_footers, :string
142
+ attribute :skip_first_header, :boolean
143
+ attribute :skip_last_footer, :boolean
144
+ attribute :stroke_order, :string
145
+ attribute :default_row_stroke_weight, :float
146
+ attribute :default_row_stroke_type, :string
147
+ attribute :default_row_stroke_color, :string
148
+ attribute :default_row_stroke_tint, :float
149
+ attribute :default_row_stroke_overprint, :boolean
150
+ attribute :default_row_stroke_gap_color, :string
151
+ attribute :default_row_stroke_gap_tint, :float
152
+ attribute :default_row_stroke_gap_overprint, :boolean
153
+ attribute :default_column_stroke_weight, :float
154
+ attribute :default_column_stroke_type, :string
155
+ attribute :default_column_stroke_color, :string
156
+ attribute :default_column_stroke_tint, :float
157
+ attribute :default_column_stroke_overprint, :boolean
158
+ attribute :default_column_stroke_gap_color, :string
159
+ attribute :default_column_stroke_gap_tint, :float
160
+ attribute :default_column_stroke_gap_overprint, :boolean
161
+ attribute :top_inset, :float
162
+ attribute :left_inset, :float
163
+ attribute :bottom_inset, :float
164
+ attribute :right_inset, :float
165
+ attribute :fill_tint, :float
166
+ attribute :overprint_fill, :boolean
167
+ attribute :top_left_diagonal_line, :boolean
168
+ attribute :top_right_diagonal_line, :boolean
169
+ attribute :diagonal_line_in_front, :boolean
170
+ attribute :diagonal_line_stroke_weight, :float
171
+ attribute :diagonal_line_stroke_type, :string
172
+ attribute :diagonal_line_stroke_color, :string
173
+ attribute :diagonal_line_stroke_tint, :float
174
+ attribute :diagonal_line_stroke_overprint, :boolean
175
+ attribute :diagonal_line_stroke_gap_color, :string
176
+ attribute :diagonal_line_stroke_gap_tint, :float
177
+ attribute :diagonal_line_stroke_gap_overprint, :boolean
178
+ attribute :clip_content_to_cell, :boolean
179
+ attribute :first_baseline_offset, :string
180
+ attribute :vertical_justification, :string
181
+ attribute :paragraph_spacing_limit, :float
182
+ attribute :minimum_first_baseline_offset, :float
183
+ attribute :rotation_angle, :float
184
+ attribute :writing_direction, :boolean
185
+ attribute :minimum_height, :float
186
+ attribute :maximum_height, :float
187
+ attribute :keep_with_next_row, :boolean
188
+ attribute :start_row, :string
189
+ attribute :auto_grow, :boolean
190
+ attribute :num_header_columns, :integer
191
+ attribute :header_columns_position, :string
192
+ attribute :caption_paragraph_count, :integer
193
+ attribute :caption_position, :string
194
+ attribute :graphic_left_inset, :float
195
+ attribute :graphic_top_inset, :float
196
+ attribute :graphic_right_inset, :float
197
+ attribute :graphic_bottom_inset, :float
198
+ attribute :clip_content_to_graphic_cell, :boolean
199
+ attribute :text_top_inset, :float
200
+ attribute :text_left_inset, :float
201
+ attribute :text_bottom_inset, :float
202
+ attribute :text_right_inset, :float
203
+ attribute :clip_content_to_text_cell, :boolean
204
+ attribute :single_row_height, :float
205
+ attribute :applied_table_style, :string
206
+ attribute :display_collapsed, :boolean
207
+ attribute :display_order, :string
208
+
46
209
  attribute :table_row, Idml::Elements::TableRow, collection: true
47
210
  attribute :cell, Idml::Elements::Cell, collection: true
48
211
  attribute :row, Idml::Elements::Row, collection: true
@@ -75,6 +238,211 @@ module Idml
75
238
  to: :bottom_border_stroke_color
76
239
  map_attribute "RightBorderStrokeWeight", to: :right_border_stroke_weight
77
240
  map_attribute "RightBorderStrokeColor", to: :right_border_stroke_color
241
+ map_attribute "TopBorderStrokeType", to: :top_border_stroke_type
242
+ map_attribute "TopBorderStrokeTint", to: :top_border_stroke_tint
243
+ map_attribute "TopBorderStrokeOverprint",
244
+ to: :top_border_stroke_overprint
245
+ map_attribute "TopBorderStrokeGapColor",
246
+ to: :top_border_stroke_gap_color
247
+ map_attribute "TopBorderStrokeGapTint", to: :top_border_stroke_gap_tint
248
+ map_attribute "TopBorderStrokeGapOverprint",
249
+ to: :top_border_stroke_gap_overprint
250
+ map_attribute "LeftBorderStrokeType", to: :left_border_stroke_type
251
+ map_attribute "LeftBorderStrokeTint", to: :left_border_stroke_tint
252
+ map_attribute "LeftBorderStrokeOverprint",
253
+ to: :left_border_stroke_overprint
254
+ map_attribute "LeftBorderStrokeGapColor",
255
+ to: :left_border_stroke_gap_color
256
+ map_attribute "LeftBorderStrokeGapTint",
257
+ to: :left_border_stroke_gap_tint
258
+ map_attribute "LeftBorderStrokeGapOverprint",
259
+ to: :left_border_stroke_gap_overprint
260
+ map_attribute "BottomBorderStrokeType", to: :bottom_border_stroke_type
261
+ map_attribute "BottomBorderStrokeTint", to: :bottom_border_stroke_tint
262
+ map_attribute "BottomBorderStrokeOverprint",
263
+ to: :bottom_border_stroke_overprint
264
+ map_attribute "BottomBorderStrokeGapColor",
265
+ to: :bottom_border_stroke_gap_color
266
+ map_attribute "BottomBorderStrokeGapTint",
267
+ to: :bottom_border_stroke_gap_tint
268
+ map_attribute "BottomBorderStrokeGapOverprint",
269
+ to: :bottom_border_stroke_gap_overprint
270
+ map_attribute "RightBorderStrokeType", to: :right_border_stroke_type
271
+ map_attribute "RightBorderStrokeTint", to: :right_border_stroke_tint
272
+ map_attribute "RightBorderStrokeOverprint",
273
+ to: :right_border_stroke_overprint
274
+ map_attribute "RightBorderStrokeGapColor",
275
+ to: :right_border_stroke_gap_color
276
+ map_attribute "RightBorderStrokeGapTint",
277
+ to: :right_border_stroke_gap_tint
278
+ map_attribute "RightBorderStrokeGapOverprint",
279
+ to: :right_border_stroke_gap_overprint
280
+ map_attribute "SpaceBefore", to: :space_before
281
+ map_attribute "SpaceAfter", to: :space_after
282
+ map_attribute "SkipFirstAlternatingStrokeRows",
283
+ to: :skip_first_alternating_stroke_rows
284
+ map_attribute "SkipLastAlternatingStrokeRows",
285
+ to: :skip_last_alternating_stroke_rows
286
+ map_attribute "StartRowStrokeCount", to: :start_row_stroke_count
287
+ map_attribute "StartRowStrokeColor", to: :start_row_stroke_color
288
+ map_attribute "StartRowStrokeWeight", to: :start_row_stroke_weight
289
+ map_attribute "StartRowStrokeType", to: :start_row_stroke_type
290
+ map_attribute "StartRowStrokeTint", to: :start_row_stroke_tint
291
+ map_attribute "StartRowStrokeGapOverprint",
292
+ to: :start_row_stroke_gap_overprint
293
+ map_attribute "StartRowStrokeGapColor", to: :start_row_stroke_gap_color
294
+ map_attribute "StartRowStrokeGapTint", to: :start_row_stroke_gap_tint
295
+ map_attribute "StartRowStrokeOverprint", to: :start_row_stroke_overprint
296
+ map_attribute "EndRowStrokeCount", to: :end_row_stroke_count
297
+ map_attribute "EndRowStrokeColor", to: :end_row_stroke_color
298
+ map_attribute "EndRowStrokeWeight", to: :end_row_stroke_weight
299
+ map_attribute "EndRowStrokeType", to: :end_row_stroke_type
300
+ map_attribute "EndRowStrokeTint", to: :end_row_stroke_tint
301
+ map_attribute "EndRowStrokeOverprint", to: :end_row_stroke_overprint
302
+ map_attribute "EndRowStrokeGapColor", to: :end_row_stroke_gap_color
303
+ map_attribute "EndRowStrokeGapTint", to: :end_row_stroke_gap_tint
304
+ map_attribute "EndRowStrokeGapOverprint",
305
+ to: :end_row_stroke_gap_overprint
306
+ map_attribute "SkipFirstAlternatingStrokeColumns",
307
+ to: :skip_first_alternating_stroke_columns
308
+ map_attribute "SkipLastAlternatingStrokeColumns",
309
+ to: :skip_last_alternating_stroke_columns
310
+ map_attribute "StartColumnStrokeCount", to: :start_column_stroke_count
311
+ map_attribute "StartColumnStrokeColor", to: :start_column_stroke_color
312
+ map_attribute "StartColumnStrokeWeight", to: :start_column_stroke_weight
313
+ map_attribute "StartColumnStrokeType", to: :start_column_stroke_type
314
+ map_attribute "StartColumnStrokeTint", to: :start_column_stroke_tint
315
+ map_attribute "StartColumnStrokeOverprint",
316
+ to: :start_column_stroke_overprint
317
+ map_attribute "StartColumnStrokeGapColor",
318
+ to: :start_column_stroke_gap_color
319
+ map_attribute "StartColumnStrokeGapTint",
320
+ to: :start_column_stroke_gap_tint
321
+ map_attribute "StartColumnStrokeGapOverprint",
322
+ to: :start_column_stroke_gap_overprint
323
+ map_attribute "EndColumnStrokeCount", to: :end_column_stroke_count
324
+ map_attribute "EndColumnStrokeColor", to: :end_column_stroke_color
325
+ map_attribute "EndColumnStrokeWeight", to: :end_column_stroke_weight
326
+ map_attribute "EndColumnLineStyle", to: :end_column_line_style
327
+ map_attribute "EndColumnStrokeTint", to: :end_column_stroke_tint
328
+ map_attribute "EndColumnStrokeOverprint",
329
+ to: :end_column_stroke_overprint
330
+ map_attribute "EndColumnStrokeGapColor",
331
+ to: :end_column_stroke_gap_color
332
+ map_attribute "EndColumnStrokeGapTint", to: :end_column_stroke_gap_tint
333
+ map_attribute "EndColumnStrokeGapOverprint",
334
+ to: :end_column_stroke_gap_overprint
335
+ map_attribute "ColumnFillsPriority", to: :column_fills_priority
336
+ map_attribute "SkipFirstAlternatingFillRows",
337
+ to: :skip_first_alternating_fill_rows
338
+ map_attribute "SkipLastAlternatingFillRows",
339
+ to: :skip_last_alternating_fill_rows
340
+ map_attribute "StartRowFillColor", to: :start_row_fill_color
341
+ map_attribute "StartRowFillCount", to: :start_row_fill_count
342
+ map_attribute "StartRowFillTint", to: :start_row_fill_tint
343
+ map_attribute "StartRowFillOverprint", to: :start_row_fill_overprint
344
+ map_attribute "EndRowFillCount", to: :end_row_fill_count
345
+ map_attribute "EndRowFillColor", to: :end_row_fill_color
346
+ map_attribute "EndRowFillTint", to: :end_row_fill_tint
347
+ map_attribute "EndRowFillOverprint", to: :end_row_fill_overprint
348
+ map_attribute "SkipFirstAlternatingFillColumns",
349
+ to: :skip_first_alternating_fill_columns
350
+ map_attribute "SkipLastAlternatingFillColumns",
351
+ to: :skip_last_alternating_fill_columns
352
+ map_attribute "StartColumnFillCount", to: :start_column_fill_count
353
+ map_attribute "StartColumnFillColor", to: :start_column_fill_color
354
+ map_attribute "StartColumnFillTint", to: :start_column_fill_tint
355
+ map_attribute "StartColumnFillOverprint",
356
+ to: :start_column_fill_overprint
357
+ map_attribute "EndColumnFillCount", to: :end_column_fill_count
358
+ map_attribute "EndColumnFillColor", to: :end_column_fill_color
359
+ map_attribute "EndColumnFillTint", to: :end_column_fill_tint
360
+ map_attribute "EndColumnFillOverprint", to: :end_column_fill_overprint
361
+ map_attribute "BreakHeaders", to: :break_headers
362
+ map_attribute "BreakFooters", to: :break_footers
363
+ map_attribute "SkipFirstHeader", to: :skip_first_header
364
+ map_attribute "SkipLastFooter", to: :skip_last_footer
365
+ map_attribute "StrokeOrder", to: :stroke_order
366
+ map_attribute "DefaultRowStrokeWeight", to: :default_row_stroke_weight
367
+ map_attribute "DefaultRowStrokeType", to: :default_row_stroke_type
368
+ map_attribute "DefaultRowStrokeColor", to: :default_row_stroke_color
369
+ map_attribute "DefaultRowStrokeTint", to: :default_row_stroke_tint
370
+ map_attribute "DefaultRowStrokeOverprint",
371
+ to: :default_row_stroke_overprint
372
+ map_attribute "DefaultRowStrokeGapColor",
373
+ to: :default_row_stroke_gap_color
374
+ map_attribute "DefaultRowStrokeGapTint",
375
+ to: :default_row_stroke_gap_tint
376
+ map_attribute "DefaultRowStrokeGapOverprint",
377
+ to: :default_row_stroke_gap_overprint
378
+ map_attribute "DefaultColumnStrokeWeight",
379
+ to: :default_column_stroke_weight
380
+ map_attribute "DefaultColumnStrokeType", to: :default_column_stroke_type
381
+ map_attribute "DefaultColumnStrokeColor",
382
+ to: :default_column_stroke_color
383
+ map_attribute "DefaultColumnStrokeTint", to: :default_column_stroke_tint
384
+ map_attribute "DefaultColumnStrokeOverprint",
385
+ to: :default_column_stroke_overprint
386
+ map_attribute "DefaultColumnStrokeGapColor",
387
+ to: :default_column_stroke_gap_color
388
+ map_attribute "DefaultColumnStrokeGapTint",
389
+ to: :default_column_stroke_gap_tint
390
+ map_attribute "DefaultColumnStrokeGapOverprint",
391
+ to: :default_column_stroke_gap_overprint
392
+ map_attribute "TopInset", to: :top_inset
393
+ map_attribute "LeftInset", to: :left_inset
394
+ map_attribute "BottomInset", to: :bottom_inset
395
+ map_attribute "RightInset", to: :right_inset
396
+ map_attribute "FillTint", to: :fill_tint
397
+ map_attribute "OverprintFill", to: :overprint_fill
398
+ map_attribute "TopLeftDiagonalLine", to: :top_left_diagonal_line
399
+ map_attribute "TopRightDiagonalLine", to: :top_right_diagonal_line
400
+ map_attribute "DiagonalLineInFront", to: :diagonal_line_in_front
401
+ map_attribute "DiagonalLineStrokeWeight",
402
+ to: :diagonal_line_stroke_weight
403
+ map_attribute "DiagonalLineStrokeType", to: :diagonal_line_stroke_type
404
+ map_attribute "DiagonalLineStrokeColor", to: :diagonal_line_stroke_color
405
+ map_attribute "DiagonalLineStrokeTint", to: :diagonal_line_stroke_tint
406
+ map_attribute "DiagonalLineStrokeOverprint",
407
+ to: :diagonal_line_stroke_overprint
408
+ map_attribute "DiagonalLineStrokeGapColor",
409
+ to: :diagonal_line_stroke_gap_color
410
+ map_attribute "DiagonalLineStrokeGapTint",
411
+ to: :diagonal_line_stroke_gap_tint
412
+ map_attribute "DiagonalLineStrokeGapOverprint",
413
+ to: :diagonal_line_stroke_gap_overprint
414
+ map_attribute "ClipContentToCell", to: :clip_content_to_cell
415
+ map_attribute "FirstBaselineOffset", to: :first_baseline_offset
416
+ map_attribute "VerticalJustification", to: :vertical_justification
417
+ map_attribute "ParagraphSpacingLimit", to: :paragraph_spacing_limit
418
+ map_attribute "MinimumFirstBaselineOffset",
419
+ to: :minimum_first_baseline_offset
420
+ map_attribute "RotationAngle", to: :rotation_angle
421
+ map_attribute "WritingDirection", to: :writing_direction
422
+ map_attribute "MinimumHeight", to: :minimum_height
423
+ map_attribute "MaximumHeight", to: :maximum_height
424
+ map_attribute "KeepWithNextRow", to: :keep_with_next_row
425
+ map_attribute "StartRow", to: :start_row
426
+ map_attribute "AutoGrow", to: :auto_grow
427
+ map_attribute "NumHeaderColumns", to: :num_header_columns
428
+ map_attribute "HeaderColumnsPosition", to: :header_columns_position
429
+ map_attribute "CaptionParagraphCount", to: :caption_paragraph_count
430
+ map_attribute "CaptionPosition", to: :caption_position
431
+ map_attribute "GraphicLeftInset", to: :graphic_left_inset
432
+ map_attribute "GraphicTopInset", to: :graphic_top_inset
433
+ map_attribute "GraphicRightInset", to: :graphic_right_inset
434
+ map_attribute "GraphicBottomInset", to: :graphic_bottom_inset
435
+ map_attribute "ClipContentToGraphicCell",
436
+ to: :clip_content_to_graphic_cell
437
+ map_attribute "TextTopInset", to: :text_top_inset
438
+ map_attribute "TextLeftInset", to: :text_left_inset
439
+ map_attribute "TextBottomInset", to: :text_bottom_inset
440
+ map_attribute "TextRightInset", to: :text_right_inset
441
+ map_attribute "ClipContentToTextCell", to: :clip_content_to_text_cell
442
+ map_attribute "SingleRowHeight", to: :single_row_height
443
+ map_attribute "AppliedTableStyle", to: :applied_table_style
444
+ map_attribute "DisplayCollapsed", to: :display_collapsed
445
+ map_attribute "DisplayOrder", to: :display_order
78
446
  map_element "TableRow", to: :table_row
79
447
  map_element "Cell", to: :cell
80
448
  map_element "Row", to: :row
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Idml
4
+ module Elements
5
+ # Typed value child element — IDML's `(object_type, xsd:string) |
6
+ # (string_type, xsd:string)` wrapper used inside Properties for
7
+ # values like RuleAboveColor and ParagraphShadingColor: a `type`
8
+ # attribute plus the value as text content.
9
+ class TypedValue < Lutaml::Model::Serializable
10
+ attribute :type, :string
11
+ attribute :value, :string
12
+
13
+ xml do
14
+ root "TypedValue"
15
+ map_attribute "type", to: :type
16
+ map_content to: :value
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/idml/elements.rb CHANGED
@@ -43,6 +43,8 @@ module Idml
43
43
  autoload :DocumentPreference, "idml/elements/pref_document_preference"
44
44
  autoload :DottedStrokeStyle, "idml/elements/dotted_stroke_style"
45
45
  autoload :DropShadowSetting, "idml/elements/drop_shadow_setting"
46
+ autoload :Endnote, "idml/elements/endnote"
47
+ autoload :EndnoteRange, "idml/elements/endnote_range"
46
48
  autoload :EPubExportPreference, "idml/elements/pref_e_pub_export_preference"
47
49
  autoload :EPubFixedLayoutExportPreference,
48
50
  "idml/elements/pref_e_pub_fixed_layout_export_preference"
@@ -147,6 +149,7 @@ module Idml
147
149
  autoload :TOCStyle, "idml/elements/toc_style"
148
150
  autoload :TOCStyleEntry, "idml/elements/toc_style_entry"
149
151
  autoload :Table, "idml/elements/table"
152
+ autoload :TypedValue, "idml/elements/typed_value"
150
153
  autoload :TableCell, "idml/elements/table_cell"
151
154
  autoload :TableRow, "idml/elements/table_row"
152
155
  autoload :TableStyle, "idml/elements/table_style"
@@ -128,10 +128,11 @@ module Idml
128
128
  size: size)
129
129
  lines = TextEngine::LineBreaker.break(glyphs: glyphs,
130
130
  frame_width: wrap_width)
131
- lines.each do |line|
131
+ lines.each_with_index do |line, index|
132
132
  TextEngine::Justifier.justify(
133
133
  line: line, frame_width: wrap_width,
134
- alignment: paragraph.alignment || :left
134
+ alignment: paragraph.alignment || :left,
135
+ last_line: last_line?(paragraph, run, index, lines)
135
136
  )
136
137
  end
137
138
  leading = TextEngine::VerticalLayout.leading_for(
@@ -150,6 +151,13 @@ module Idml
150
151
  end
151
152
  private_class_method :layout_paragraph
152
153
 
154
+ # True for the final line of the footnote paragraph's final
155
+ # run — kept ragged under full justification.
156
+ def self.last_line?(paragraph, run, index, lines)
157
+ run.equal?(paragraph.runs.last) && index == lines.length - 1
158
+ end
159
+ private_class_method :last_line?
160
+
153
161
  # Height to reserve at the frame bottom for the entries:
154
162
  # separator gap + the measured paragraph stack.
155
163
  def self.reserved_height(entries, font, frame, option = nil)
@@ -82,6 +82,131 @@ module Idml
82
82
  end
83
83
  private_class_method :emit_rule
84
84
 
85
+ # Emits the paragraph's shading: a fill rect behind the
86
+ # paragraph block (top_y..bottom_y within the column). The
87
+ # ParagraphShading* offsets expand the rect outward; tint
88
+ # scales the color. Color comes from Properties >
89
+ # ParagraphShadingColor (black when absent, per InDesign's
90
+ # default shading color).
91
+ def self.emit_shading(canvas, paragraph, context, top_y, bottom_y,
92
+ frame_left, frame_right)
93
+ return unless paragraph.paragraph_shading_on
94
+ return unless top_y > bottom_y
95
+
96
+ tint_value = decoration_tint(paragraph.paragraph_shading_tint)
97
+ return unless tint_value
98
+
99
+ color = resolve_color(paragraph.paragraph_shading_color,
100
+ tint_value, context)
101
+ return unless color
102
+
103
+ left, right, top, bottom = decoration_rect(
104
+ paragraph, top_y, bottom_y, frame_left, frame_right,
105
+ left_offset: paragraph.paragraph_shading_left_offset,
106
+ right_offset: paragraph.paragraph_shading_right_offset,
107
+ top_offset: paragraph.paragraph_shading_top_offset,
108
+ bottom_offset: paragraph.paragraph_shading_bottom_offset
109
+ )
110
+ canvas.fill_color(color)
111
+ canvas.rectangle(left, bottom, right - left, top - bottom)
112
+ canvas.fill
113
+ end
114
+
115
+ # Emits the paragraph's border: per-side strokes around the
116
+ # paragraph block, each side with its own line weight, drawn
117
+ # at the block rect expanded by the border offsets.
118
+ def self.emit_border(canvas, paragraph, context, top_y, bottom_y,
119
+ frame_left, frame_right)
120
+ return unless paragraph.paragraph_border_on
121
+ return unless top_y > bottom_y
122
+
123
+ tint_value = decoration_tint(paragraph.paragraph_border_tint)
124
+ return unless tint_value
125
+
126
+ color = resolve_color(paragraph.paragraph_border_color,
127
+ tint_value, context)
128
+ return unless color
129
+
130
+ left, right, top, bottom = decoration_rect(
131
+ paragraph, top_y, bottom_y, frame_left, frame_right,
132
+ left_offset: paragraph.paragraph_border_left_offset,
133
+ right_offset: paragraph.paragraph_border_right_offset,
134
+ top_offset: paragraph.paragraph_border_top_offset,
135
+ bottom_offset: paragraph.paragraph_border_bottom_offset
136
+ )
137
+ apply_rule_color(canvas, paragraph.paragraph_border_color,
138
+ tint_value, context)
139
+ stroke_border_sides(canvas, paragraph, left, right, top, bottom)
140
+ end
141
+
142
+ # Tint value for a decoration, or nil when zero/absent.
143
+ def self.decoration_tint(tint)
144
+ value = (tint || DEFAULT_TINT).to_f
145
+ value.positive? ? value : nil
146
+ end
147
+ private_class_method :decoration_tint
148
+
149
+ # The decoration rect [left, right, top, bottom]: the column
150
+ # (or text) extents expanded outward by the given offsets.
151
+ def self.decoration_rect(paragraph, top_y, bottom_y, frame_left,
152
+ frame_right, left_offset:, right_offset:,
153
+ top_offset:, bottom_offset:)
154
+ left, right = decoration_extents(paragraph, frame_left, frame_right)
155
+ [left - (left_offset || 0).to_f,
156
+ right + (right_offset || 0).to_f,
157
+ top_y + (top_offset || 0).to_f,
158
+ bottom_y - (bottom_offset || 0).to_f]
159
+ end
160
+ private_class_method :decoration_rect
161
+
162
+ def self.stroke_border_sides(canvas, paragraph, left, right,
163
+ top, bottom)
164
+ stroke_horizontal(canvas, left, right, top,
165
+ paragraph.paragraph_border_top_line_weight)
166
+ stroke_horizontal(canvas, left, right, bottom,
167
+ paragraph.paragraph_border_bottom_line_weight)
168
+ stroke_vertical(canvas, bottom, top, left,
169
+ paragraph.paragraph_border_left_line_weight)
170
+ stroke_vertical(canvas, bottom, top, right,
171
+ paragraph.paragraph_border_right_line_weight)
172
+ end
173
+ private_class_method :stroke_border_sides
174
+
175
+ def self.stroke_horizontal(canvas, x1, x2, y, weight)
176
+ thickness = weight.to_f
177
+ return unless thickness.positive?
178
+
179
+ canvas.line_width = thickness
180
+ canvas.move_to(x1, y)
181
+ canvas.line_to(x2, y)
182
+ canvas.stroke
183
+ end
184
+ private_class_method :stroke_horizontal
185
+
186
+ def self.stroke_vertical(canvas, y1, y2, x, weight)
187
+ thickness = weight.to_f
188
+ return unless thickness.positive?
189
+
190
+ canvas.line_width = thickness
191
+ canvas.move_to(x, y1)
192
+ canvas.line_to(x, y2)
193
+ canvas.stroke
194
+ end
195
+ private_class_method :stroke_vertical
196
+
197
+ # Horizontal extents for shading/border: the column width, or
198
+ # the text width (indented by the paragraph's indents) when
199
+ # the shading width mode is "TextWidth".
200
+ def self.decoration_extents(paragraph, frame_left, frame_right)
201
+ if paragraph.paragraph_shading_width == "TextWidth"
202
+ [frame_left + (paragraph.left_indent || 0).to_f,
203
+ frame_right - (paragraph.right_indent || 0).to_f]
204
+ else
205
+ [frame_left, frame_right]
206
+ end
207
+ end
208
+ private_class_method :decoration_extents
209
+
85
210
  # Returns `[x1, x2]` for the rule. Width mode "Text" indents
86
211
  # the rule by the paragraph's left/right indent (matches the
87
212
  # text bounds); "Column" (default) spans the full column.