idml 0.4.7 → 0.4.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83554bfc44e2eb23732f64f5283c221965a70823f48db100abdcb953306681e2
4
- data.tar.gz: c3a13c6b72cd20fb5280f863db1712c10df2e636adbb777dd0d393a3042fe5cb
3
+ metadata.gz: bfe99408096a550d69277aae9bf709c0dcb0257f17756fcef498c9ea3982a603
4
+ data.tar.gz: 83fc58f40dccb82324b6098aab6665765cd0e1a08b12ade7e08f6d600c6e69c3
5
5
  SHA512:
6
- metadata.gz: 798716bc9426f8ad558255e8cdca0130bc9fbc4df0b982bf052108c8ad985d8512acc478fe420c629a6823e9b474864dd6570942a95db95ecd91277dba60a36a
7
- data.tar.gz: c3e14713c820726f1bc07ebbad6186a4f9d5f3e8a163a175f3b2905ca4183be595f5ccadf219647859fa172e754407f11fa137a6cea64074156d209ad3a31d36
6
+ metadata.gz: 8b9646bd611f3618e6a7c3c689a402b368b231f66f6f06430098f9357179d4b79ae0884058b20c92df03dce6e65aa7cf74c245bb8100a772a9454c37f310b4bd
7
+ data.tar.gz: 7b639edc906f60c9e82128bf599966cd37e2fb0458e06e62158d14767d2293d918bed5fe75163cd2caa2cb20fed7174a0c18a709ac722a673b9099532e8f5b33
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- idml (0.4.7)
4
+ idml (0.4.8)
5
5
  bigdecimal
6
6
  lutaml-model (~> 0.8.18)
7
7
  pdfrb
@@ -183,7 +183,7 @@ CHECKSUMS
183
183
  ffi (1.17.4-x86_64-darwin) sha256=aa70390523cf3235096cf64962b709b4cfbd5c082a2cb2ae714eb0fe2ccda496
184
184
  ffi (1.17.4-x86_64-linux-gnu) sha256=9d3db14c2eae074b382fa9c083fe95aec6e0a1451da249eab096c34002bc752d
185
185
  ffi (1.17.4-x86_64-linux-musl) sha256=3fdf9888483de005f8ef8d1cf2d3b20d86626af206cbf780f6a6a12439a9c49e
186
- idml (0.4.7)
186
+ idml (0.4.8)
187
187
  json (2.21.2) sha256=1f1d3b7cf2b3ba1a69beca0bb6db13d5438b80bff3cd54cdaaa620b9b07c1c6a
188
188
  language_server-protocol (3.17.0.6) sha256=5ef2c0c138f8267e1bc631d3328347d354f96724b0af22f2c79516120443b7f0
189
189
  lint_roller (1.1.0) sha256=2c0c845b632a7d172cb849cc90c1bce937a28c5c8ccccb50dfd46a485003cc87
@@ -48,15 +48,21 @@ The existing `Elements::Table`/`TableRow`/`TableCell` classes
48
48
  `table_renderer_spec.rb` test. They are not removed because no
49
49
  real IDML uses them and removing them would break the existing test.
50
50
 
51
- ## Future work
52
-
53
- - Migrate `TableRenderer` to use the schema-faithful `cell`/`row`
54
- collections instead of legacy `table_row`. The renderer is the
55
- last consumer of the legacy structure.
56
- - Render Tables discovered in Stories (currently only Spread-level
57
- tables are dispatched to TableRenderer; CSR-embedded Tables are
58
- skipped they need TextFrameRenderer integration to render in
59
- place).
51
+ ## What was completed in this round
52
+
53
+ - `TableRenderer` migrated to auto-detect schema-faithful
54
+ (`cell`/`row` siblings) vs legacy (`table_row`/`table_cell`
55
+ nested) layout. New `SchemaLayout` Struct computes per-cell rects
56
+ from `Row#single_row_height` and `Cell#col_row` max col + 1.
57
+ - `TextFrameRenderer` discovers inline Tables via
58
+ `Story > PSR > CSR > Table` and renders each within the frame's
59
+ bounds via `TableRenderer.render_in_box`. This is the path that
60
+ real IDML fixtures use (Tables live in Stories, not Spreads).
61
+ - New `TableRenderer.render_in_box(canvas, table, box, context)`
62
+ API accepts caller-supplied bounds (real Tables have no own
63
+ geometry).
64
+ - The sample-with-table-more fixture's Table now renders 83 cell
65
+ rectangles end-to-end (verified by spec).
60
66
 
61
67
  ## Current state vs schema
62
68
 
@@ -30,6 +30,17 @@ module Idml
30
30
  box = Placement.box(table, context.page_height)
31
31
  return unless box
32
32
 
33
+ render_in_box(canvas, table, box, context)
34
+ end
35
+
36
+ # Renders a Table using caller-supplied bounds (no
37
+ # Placement.box lookup). Used by TextFrameRenderer to
38
+ # render Tables inlined in a story — real IDML Tables
39
+ # have no own geometry, so the containing TextFrame's
40
+ # bounds stand in for the Table's bounds.
41
+ def self.render_in_box(canvas, table, box, context)
42
+ return if table.visible == false
43
+
33
44
  canvas.save_graphics_state do
34
45
  if schema_faithful?(table)
35
46
  render_schema_faithful(canvas, table, box, context)
@@ -20,13 +20,41 @@ module Idml
20
20
  story = context.package&.story_by_id(frame.parent_story)
21
21
  return unless story
22
22
 
23
+ box = frame_box(frame, context.page_height)
24
+ render_inline_tables(canvas, story, box, context)
25
+
23
26
  runs = StyleResolver.extract_runs(story)
24
27
  return if runs.empty?
25
28
 
26
- box = frame_box(frame, context.page_height)
27
29
  render_text(canvas, runs, context, box)
28
30
  end
29
31
 
32
+ # Discovers Tables inlined in the story (Story > PSR > CSR >
33
+ # Table — the real IDML structure) and renders each within
34
+ # the frame's bounds. Real IDML Tables have no own geometry,
35
+ # so the containing TextFrame's box stands in. Synthetic
36
+ # spread-level Tables dispatch separately via
37
+ # PageItemRenderer.
38
+ def self.render_inline_tables(canvas, story, box, context)
39
+ tables = tables_in_story(story)
40
+ return if tables.empty?
41
+
42
+ tables.each do |table|
43
+ TableRenderer.render_in_box(canvas, table, box, context)
44
+ end
45
+ end
46
+ private_class_method :render_inline_tables
47
+
48
+ def self.tables_in_story(story)
49
+ inner = story&.inner
50
+ return [] unless inner
51
+
52
+ inner.paragraph_style_range.flat_map do |psr|
53
+ psr.character_style_range.flat_map(&:table)
54
+ end.compact
55
+ end
56
+ private_class_method :tables_in_story
57
+
30
58
  def self.render_text(canvas, runs, context, box)
31
59
  font = context.font_metrics
32
60
  if font
data/lib/idml/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Idml
4
- VERSION = "0.4.7"
4
+ VERSION = "0.4.8"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.7
4
+ version: 0.4.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose