OVAPortableText 0.1.3__tar.gz → 0.2.0__tar.gz

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.
Files changed (101) hide show
  1. ovaportabletext-0.2.0/CHANGELOG.md +107 -0
  2. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/PKG-INFO +1 -1
  3. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/API_REFERENCE.md +140 -103
  4. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/EXAMPLES.md +2 -0
  5. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/PROTOCOL_ALIGNMENT.md +2 -2
  6. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/QUICKSTART.md +3 -3
  7. ovaportabletext-0.2.0/docs/protocol/v1.1.md +3623 -0
  8. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/extended_registries_demo.py +7 -7
  9. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/full_report_workflow_demo.py +3 -3
  10. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/image_sources_demo.py +14 -3
  11. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/inline_objects_report.py +1 -1
  12. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/patent_valuation_style_report.py +2 -2
  13. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/references_and_marks_demo.py +6 -10
  14. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/registry_blocks_report.py +1 -1
  15. ovaportabletext-0.2.0/examples/sample_outputs/generate_patent_report_sample_1.py +662 -0
  16. ovaportabletext-0.2.0/examples/sample_outputs/patent_report_sample_1.json +2903 -0
  17. ovaportabletext-0.2.0/examples/v11_layout_and_cell_image_demo.py +84 -0
  18. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/validation_report.py +1 -1
  19. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/pyproject.toml +1 -1
  20. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/__init__.py +27 -15
  21. ovaportabletext-0.2.0/src/ova_portable_text/block_objects.py +62 -0
  22. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/content.py +0 -5
  23. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/document.py +7 -71
  24. ovaportabletext-0.2.0/src/ova_portable_text/helpers.py +370 -0
  25. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/inline.py +16 -1
  26. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/registry.py +152 -55
  27. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/resolver.py +6 -2
  28. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/section.py +7 -4
  29. ovaportabletext-0.2.0/src/ova_portable_text/text.py +200 -0
  30. ovaportabletext-0.2.0/src/ova_portable_text/theme.py +44 -0
  31. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/validator.py +197 -130
  32. ovaportabletext-0.2.0/src/ova_portable_text/version.py +5 -0
  33. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_extended_registries_and_resolver.py +8 -7
  34. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_inline_objects.py +2 -0
  35. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_minimal_report.py +1 -1
  36. ovaportabletext-0.2.0/tests/test_v11_grid_cell_image.py +64 -0
  37. ovaportabletext-0.2.0/tests/test_v11_image_block_optional_id.py +20 -0
  38. ovaportabletext-0.2.0/tests/test_v11_table_layout.py +46 -0
  39. ovaportabletext-0.2.0/tests/test_v11_theme_layout.py +44 -0
  40. ovaportabletext-0.1.3/CHANGELOG.md +0 -48
  41. ovaportabletext-0.1.3/docs/dev/ova/CHANGELOG.md +0 -48
  42. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_1.md +0 -62
  43. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_10.md +0 -168
  44. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_2.md +0 -45
  45. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_3.md +0 -85
  46. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_4.md +0 -69
  47. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_5.md +0 -261
  48. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_6.md +0 -196
  49. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_7.md +0 -271
  50. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_8.md +0 -210
  51. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_9.md +0 -169
  52. ovaportabletext-0.1.3/docs/dev/ova/report_profile_v1_draft.md +0 -2704
  53. ovaportabletext-0.1.3/examples/sample_outputs/patent_report_sample_1.json +0 -3289
  54. ovaportabletext-0.1.3/src/ova_portable_text/block_objects.py +0 -139
  55. ovaportabletext-0.1.3/src/ova_portable_text/helpers.py +0 -308
  56. ovaportabletext-0.1.3/src/ova_portable_text/text.py +0 -452
  57. ovaportabletext-0.1.3/src/ova_portable_text/theme.py +0 -46
  58. ovaportabletext-0.1.3/src/ova_portable_text/version.py +0 -9
  59. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/.gitignore +0 -0
  60. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/LICENSE +0 -0
  61. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/README.md +0 -0
  62. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/PUBLISHING_CHECKLIST.md +0 -0
  63. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/REAL_WORLD_RECIPES.md +0 -0
  64. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/TEST_MATRIX.md +0 -0
  65. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/USER_TESTING_CHECKLIST.md +0 -0
  66. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/docs/VALIDATION_AND_RESOLVER.md +0 -0
  67. {ovaportabletext-0.1.3/docs/dev → ovaportabletext-0.2.0/docs}/native/portable_text_basics.md +0 -0
  68. /ovaportabletext-0.1.3/docs/dev/ova/report_profile_v1.0.md → /ovaportabletext-0.2.0/docs/protocol/v1.0.md +0 -0
  69. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/builder_numbering_roundtrip_demo.py +0 -0
  70. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/grid_table_demo.py +0 -0
  71. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/marks_and_lists_report.py +0 -0
  72. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/minimal_report.py +0 -0
  73. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/save_and_load_json_demo.py +0 -0
  74. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/examples/validation_context_demo.py +0 -0
  75. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/base.py +0 -0
  76. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/exceptions.py +0 -0
  77. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/numbering.py +0 -0
  78. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/src/ova_portable_text/py.typed +0 -0
  79. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_blocks_and_registry.py +0 -0
  80. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_builder_roundtrip_and_theme.py +0 -0
  81. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_content_flow_helpers.py +0 -0
  82. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_document_validation_error_rendering.py +0 -0
  83. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_examples_smoke.py +0 -0
  84. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_file_io_roundtrip.py +0 -0
  85. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_image_asset_sources.py +0 -0
  86. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_mark_validation.py +0 -0
  87. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_marks_and_lists.py +0 -0
  88. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_numbering.py +0 -0
  89. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_pie_chart_parallel_arrays.py +0 -0
  90. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_resolver_debug_summary.py +0 -0
  91. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_resolver_semantic_figure_alias.py +0 -0
  92. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_roundtrip_and_runtime_version.py +0 -0
  93. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_section_batch_helpers.py +0 -0
  94. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_strict_ids.py +0 -0
  95. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_style_validation.py +0 -0
  96. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_table_dataset_validation.py +0 -0
  97. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_validation_context_output.py +0 -0
  98. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_validation_failures.py +0 -0
  99. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_validation_report_python_alias.py +0 -0
  100. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_validation_success.py +0 -0
  101. {ovaportabletext-0.1.3 → ovaportabletext-0.2.0}/tests/test_validator_extended_rules.py +0 -0
@@ -0,0 +1,107 @@
1
+ # Changelog
2
+
3
+ **All notable changes to this project will be documented in this file.** ** **本项目的重要变更会记录在此文件中。
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.2.0] - 2026-04-01
8
+
9
+ ### Added
10
+
11
+ * aligned the package with `report.v1.1`
12
+ * added `theme.blockStyleDefaults` models and helpers
13
+ * added block-level `layout` support for `TextBlock` and paragraph helpers
14
+ * added table-level `layout.columnSpecs[]` with `auto | weight` width modes
15
+ * added helper functions: `block_layout`, `length_em`, `length_pt`, `table_column_spec_auto`, `table_column_spec_weight`, `table_layout`
16
+ * added support for `_type="image"` inside `GridTableCell.blocks`
17
+ * added validation coverage for grid-cell image refs and v1.1 table/theme features
18
+ * added `examples/v11_layout_and_cell_image_demo.py`
19
+
20
+ ### Changed
21
+
22
+ * default `schemaVersion` is now `report.v1.1`
23
+ * `ImageBlock.id` and `ImageBlock.anchor` are now optional
24
+ * `image_block(...)` and `Section.append_image(...)` now accept optional instance ids
25
+ * `record` and `grid` table datasets both accept table-level `layout`
26
+ * API docs and quickstart examples now reflect the v1.1 contract
27
+
28
+ ### Fixed
29
+
30
+ * fixed the protocol mismatch where image instances incorrectly required `id`
31
+ * fixed the protocol mismatch where grid-cell `blocks` only accepted text blocks
32
+ * fixed the validation gap where grid-cell `imageRef` values were not resolved
33
+
34
+ ## [0.1.4] - 2026-03-25
35
+
36
+ ### Added
37
+
38
+ * **bilingual end-user and developer documentation, including a restructured **`README.md`
39
+ * **protocol-aligned table authoring helpers for both **`record` and `grid` table modes
40
+ * **generic chart registry support so non-**`pie` chart entries can remain in `datasets.charts[]` without pretending to follow the `pie` schema
41
+ * **richer example coverage for image sources, grid tables, references, marks, and end-to-end report generation**
42
+ * **resolver support for the generic **`asset` target alias in cross-references
43
+
44
+ ### Changed
45
+
46
+ * **synchronized the package with the latest **`report.v1.0` protocol wording and data contracts
47
+ * **standardized document schema version handling to **`report.v1.0`
48
+ * **aligned **`meta` handling with the latest protocol field set, including stronger enum / format validation where the protocol now defines it
49
+ * **aligned bibliography generation with the latest protocol by treating **`displayText` as the primary display field
50
+ * **aligned image registries (**`images`, `logos`, `backgrounds`, `icons`) around the current `imageSource` model and helper flow
51
+ * **aligned inline reference models around **`targetId`
52
+ * **expanded validator coverage for **`grid` tables, protocol-native image sources, and newer registry / reference rules
53
+ * **refreshed examples and tests to use the current protocol instead of older transitional shapes**
54
+
55
+ ### Fixed
56
+
57
+ * **corrected remaining mismatches between protocol examples and package-generated JSON structures**
58
+ * **corrected resolver / validator gaps around newer reference and asset resolution behaviors**
59
+ * **corrected helper / example inconsistencies that could force manual post-processing for some protocol features**
60
+
61
+ ## [0.1.3]
62
+
63
+ ### Added
64
+
65
+ * **formal image-source helpers: **`image_asset_url(...)`, `image_asset_embedded(...)`, and `image_asset_from_file(...)`
66
+ * **typed image source models: **`ImageSourceUrl`, `ImageSourceEmbedded`, and discriminated `ImageSource`
67
+
68
+ ### Changed
69
+
70
+ * `assets.images` now follows the pure `imageSource` protocol and no longer depends on legacy `src`
71
+ * **image-related examples, tests, and docs now use the new protocol-native image helpers**
72
+
73
+ ## [0.1.2]
74
+
75
+ ### Added
76
+
77
+ * **optional **`strict_ids=True` fail-early duplicate-ID checks for common authoring paths
78
+ * **continuous-content helpers on **`Section`:
79
+ * `append_to_last_content()`
80
+ * `append_blocks_to_last_content()`
81
+ * `append_text_block_to_last_content()`
82
+ * `append_paragraph_to_last_content()`
83
+ * **release-facing docs now explain the implemented v1.0 protocol subset more explicitly**
84
+
85
+ ### Changed
86
+
87
+ * **packaging and release metadata were aligned for a cleaner publication flow**
88
+ * `Section.numbering` now accepts only protocol-approved values: `auto`, `none`, and `manual`
89
+ * **publishing checklist now includes changelog layout and sdist verification guidance**
90
+
91
+ ## [0.1.1]
92
+
93
+ ### Added
94
+
95
+ * **improved authoring ergonomics for local save/load and batch section writing**
96
+ * **more release-prep docs and smoke-test coverage**
97
+
98
+ ## [0.1.0]
99
+
100
+ ### Added
101
+
102
+ * **document / section tree builder**
103
+ * **text blocks, spans, marks, markDefs, and list semantics**
104
+ * **inline refs: **`xref`, `citation_ref`, `footnote_ref`, `glossary_term`, `hard_break`
105
+ * **block objects: **`image`, `chart`, `table`, `math_block`, `callout`
106
+ * **registries: assets, datasets, bibliography, footnotes, glossary**
107
+ * **numbering helpers, resolver, validator, and round-trip helpers**
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: OVAPortableText
3
- Version: 0.1.3
3
+ Version: 0.2.0
4
4
  Summary: Python builder for generating OVAPortableText / Report Profile v1 JSON documents
5
5
  Author: FENG QU
6
6
  License-Expression: MIT
@@ -1,10 +1,7 @@
1
1
  # API Reference / API 参考
2
2
 
3
- This page is a practical API map for the public surface of OVAPortableText.
4
- 本文档是 OVAPortableText 公开接口的实用型 API 地图。
5
-
6
- It is intentionally not a generated full symbol dump.
7
- 它刻意不是自动生成的“全量符号索引”。
3
+ This page is a practical map of the public API in OVAPortableText `v0.2.0`, aligned to `report.v1.1`.
4
+ 本文档是 OVAPortableText `v0.2.0` 的实用 API 地图,对齐 `report.v1.1`。
8
5
 
9
6
  ---
10
7
 
@@ -13,19 +10,21 @@ It is intentionally not a generated full symbol dump.
13
10
  ### Document creation / 文档创建
14
11
 
15
12
  - `create_document(...)`
16
- - `document(...)`
17
- Alias of `create_document`. / `create_document` 的别名。
13
+ - `document(...)` — alias of `create_document`
18
14
  - `Document.from_dict(...)`
19
15
  - `Document.from_json(...)`
20
16
  - `Document.load_json(...)`
21
17
 
22
- Typical arguments / 常用参数:
18
+ Default schema version:
19
+
20
+ - `Document.schemaVersion == "report.v1.1"`
21
+
22
+ Common arguments / 常用参数:
23
23
 
24
24
  - `title`
25
- - `language` → current package validation: `"zh"` or `"en"`
26
- 当前包校验:`"zh"` `"en"`
27
- - `documentType` → current package validation: `"valuationReport"`
28
- 当前包校验:`"valuationReport"`
25
+ - `language`
26
+ - `documentType`
27
+ - `theme`
29
28
  - `strict_ids=False`
30
29
 
31
30
  ---
@@ -47,9 +46,56 @@ Body block objects / 正文块对象:
47
46
  - `MathBlock`
48
47
  - `CalloutBlock`
49
48
 
49
+ Important v1.1 note / v1.1 重点:
50
+
51
+ - `ImageBlock(imageRef="...")` is valid
52
+ - `ImageBlock.id` and `ImageBlock.anchor` are optional
53
+ - `imageRef` is required
54
+
50
55
  ---
51
56
 
52
- ## 3. Text helpers / 文本层 helper
57
+ ## 3. Theme and block layout / theme 与块级 layout
58
+
59
+ ### Theme models / theme 模型
60
+
61
+ - `ThemeConfig`
62
+ - `BlockStyleDefault`
63
+ - `BlockLayout`
64
+ - `LengthValue`
65
+
66
+ ### Theme helpers / theme helper
67
+
68
+ - `block_layout(...)`
69
+ - `length_em(value)`
70
+ - `length_pt(value)`
71
+
72
+ ### v1.1 formal fields / v1.1 正式字段
73
+
74
+ - `theme.blockStyleDefaults`
75
+ - `TextBlock.layout`
76
+
77
+ Supported `BlockLayout` fields:
78
+
79
+ - `textAlign`
80
+ - `firstLineIndent`
81
+ - `spaceBefore`
82
+ - `spaceAfter`
83
+
84
+ Supported `textAlign` values:
85
+
86
+ - `left`
87
+ - `center`
88
+ - `right`
89
+ - `justify`
90
+
91
+ Supported length units:
92
+
93
+ - `em`
94
+ - `pt`
95
+
96
+ ---
97
+
98
+ ## 4. Text helpers / 文本层 helper
53
99
 
54
100
  ### Inline text constructors / 行内文本构造
55
101
 
@@ -63,16 +109,11 @@ Body block objects / 正文块对象:
63
109
  ### Mark-definition helpers / markDef helper
64
110
 
65
111
  - `link_def(key=..., href=...)`
66
- - `xref_def(key=..., target_id=..., target_type=...)`
67
- - `citation_ref_def(key=..., target_id=...)`
68
- - `footnote_ref_def(key=..., target_id=...)`
69
- - `glossary_term_def(key=..., target_id=...)`
70
- - `inline_math_def(key=..., latex=...)`
71
112
  - `annotation_def(key=..., type=..., data=...)`
72
113
 
73
114
  ### Block constructors / 文本块构造
74
115
 
75
- - `paragraph(*parts, style="normal", mark_defs=None, list_item=None, level=None)`
116
+ - `paragraph(*parts, style="normal", mark_defs=None, list_item=None, level=None, layout=None)`
76
117
  - `bullet_item(*parts, level=1, mark_defs=None)`
77
118
  - `number_item(*parts, level=1, mark_defs=None)`
78
119
  - `blocks_from_items(...)`
@@ -80,7 +121,7 @@ Body block objects / 正文块对象:
80
121
  ### Inline object helpers / 行内对象 helper
81
122
 
82
123
  - `hard_break()`
83
- - `xref(target_id=..., target_type=None)`
124
+ - `xref(target_type=..., target_id=...)`
84
125
  - `citation_ref(target_id)`
85
126
  - `footnote_ref(target_id)`
86
127
  - `glossary_term(target_id)`
@@ -88,7 +129,7 @@ Body block objects / 正文块对象:
88
129
 
89
130
  ---
90
131
 
91
- ## 4. Section helpers / Section 级 helper
132
+ ## 5. Section helpers / Section 级 helper
92
133
 
93
134
  ### Create sections / 创建章节
94
135
 
@@ -100,13 +141,16 @@ Body block objects / 正文块对象:
100
141
 
101
142
  ### Append text / 追加文本
102
143
 
103
- - `Section.append_paragraph(...)`
144
+ - `Section.append_paragraph(..., layout=None)`
104
145
  - `Section.append_paragraphs(...)`
105
146
  - `Section.append_lead(...)`
106
147
  - `Section.append_blockquote(...)`
107
148
  - `Section.append_subheading(...)`
108
149
  - `Section.append_smallprint(...)`
109
- - `Section.append_quote_source(...)`
150
+ - `Section.append_caption(...)`
151
+ - `Section.append_figure_caption(...)`
152
+ - `Section.append_table_caption(...)`
153
+ - `Section.append_equation_caption(...)`
110
154
 
111
155
  ### Append lists / 追加列表
112
156
 
@@ -120,24 +164,25 @@ Body block objects / 正文块对象:
120
164
  - `Section.append_to_last_content(block)`
121
165
  - `Section.append_blocks_to_last_content(*blocks)`
122
166
  - `Section.append_text_block_to_last_content(block)`
123
- - `Section.append_paragraph_to_last_content(...)`
124
-
125
- Use these when multiple blocks should remain in the same protocol `content` item.
126
- 当多段内容应继续停留在同一个协议 `content` item 中时,使用这组 helper。
167
+ - `Section.append_paragraph_to_last_content(..., layout=None)`
127
168
 
128
169
  ### Append block objects / 追加块对象
129
170
 
130
171
  - `Section.append_block(...)`
131
172
  - `Section.append_blocks(...)`
132
173
  - `Section.append_callout(...)`
133
- - `Section.append_image_with_caption(...)`
174
+ - `Section.append_image(image_ref=..., id=None, anchor=None)`
175
+ - `Section.append_chart(...)`
176
+ - `Section.append_table(...)`
177
+ - `Section.append_math(...)`
178
+ - `Section.append_image_with_caption(image_ref=..., id=None, caption=...)`
134
179
  - `Section.append_chart_with_caption(...)`
135
180
  - `Section.append_table_with_caption(...)`
136
181
  - `Section.append_math_with_caption(...)`
137
182
 
138
183
  ---
139
184
 
140
- ## 5. Registry helpers / registry helper
185
+ ## 6. Registry helpers / registry helper
141
186
 
142
187
  ### Assets / 资源
143
188
 
@@ -153,25 +198,27 @@ Use these when multiple blocks should remain in the same protocol `content` item
153
198
  ### Datasets / 数据集
154
199
 
155
200
  - `table_column(...)`
156
- - `table_dataset(...)` → returns `RecordTableDataset`
157
- 返回 `RecordTableDataset`
201
+ - `table_dataset(...)` → returns `RecordTableDataset`
202
+ - `record_table_dataset(...)`
158
203
  - `grid_table_cell(...)`
159
204
  - `grid_table_row(...)`
160
- - `grid_table_dataset(...)` → returns `GridTableDataset`
161
- 返回 `GridTableDataset`
205
+ - `grid_table_dataset(...)` → returns `GridTableDataset`
206
+ - `table_column_spec_auto()`
207
+ - `table_column_spec_weight(value)`
208
+ - `table_layout(*column_specs)`
162
209
  - `pie_slice(...)`
163
210
  - `pie_chart_dataset(...)`
164
211
  - `pie_chart_from_parallel_arrays(...)`
165
212
  - `metric_value(...)`
166
213
  - `metric_dataset(...)`
167
214
 
168
- ### Registry content / 引用型内容
215
+ ### Registry-backed block instances / 正文引用实例
169
216
 
170
- - `image_block(...)`
171
- - `chart_block(...)`
172
- - `table_block(...)`
173
- - `math_block(...)`
174
- - `callout(...)`
217
+ - `image_block(image_ref=..., id=None, anchor=None)`
218
+ - `chart_block(id=..., chart_ref=..., anchor=None)`
219
+ - `table_block(id=..., table_ref=..., anchor=None)`
220
+ - `math_block(id=..., latex=..., anchor=None)`
221
+ - `callout(id=..., blocks=None, anchor=None)`
175
222
 
176
223
  ### Bibliography / footnotes / glossary
177
224
 
@@ -181,7 +228,7 @@ Use these when multiple blocks should remain in the same protocol `content` item
181
228
 
182
229
  ---
183
230
 
184
- ## 6. Main registry models / 主要 registry 模型
231
+ ## 7. Main registry models / 主要 registry 模型
185
232
 
186
233
  ### Assets / 资源模型
187
234
 
@@ -201,9 +248,11 @@ Use these when multiple blocks should remain in the same protocol `content` item
201
248
  - `GridTableDataset`
202
249
  - `GridTableRow`
203
250
  - `GridTableCell`
204
- - `TableDataset`
205
- Discriminated union of `record | grid`. / `record | grid` 判别联合类型。
251
+ - `TableDataset`
206
252
  - `TableColumn`
253
+ - `TableLayout`
254
+ - `TableColumnSpec`
255
+ - `TableColumnWidth`
207
256
  - `PieChartDataset`
208
257
  - `PieSlice`
209
258
  - `MetricDataset`
@@ -218,7 +267,44 @@ Use these when multiple blocks should remain in the same protocol `content` item
218
267
 
219
268
  ---
220
269
 
221
- ## 7. Validation / 校验
270
+ ## 8. v1.1 table notes / v1.1 表格说明
271
+
272
+ ### Table-level layout / 表级 layout
273
+
274
+ Both record and grid tables now support:
275
+
276
+ - `layout.columnSpecs[]`
277
+
278
+ Width modes:
279
+
280
+ - `auto`
281
+ - `weight`
282
+
283
+ Rules:
284
+
285
+ - `mode="auto"` → no `value`
286
+ - `mode="weight"` → `value > 0`
287
+ - `weight` is relative weight, not percent
288
+
289
+ ### Grid cell blocks / grid 单元格 blocks
290
+
291
+ `GridTableCell.blocks` is now a restricted block array.
292
+
293
+ Currently supported block types:
294
+
295
+ - `_type="block"`
296
+ - `_type="image"`
297
+
298
+ Not supported in cell blocks:
299
+
300
+ - `chart`
301
+ - `table`
302
+ - `math_block`
303
+ - `callout`
304
+
305
+ ---
306
+
307
+ ## 9. Validation / 校验
222
308
 
223
309
  - `Document.validate()`
224
310
  - `Document.assert_valid()`
@@ -236,81 +322,32 @@ print(validation.to_text())
236
322
  report.assert_valid()
237
323
  ```
238
324
 
325
+ Validator additions relevant to v1.1:
326
+
327
+ - checks `theme.blockStyleDefaults` keys
328
+ - checks `TextBlock.layout`
329
+ - checks table `layout.columnSpecs`
330
+ - checks grid cell image refs
331
+ - warns when image-like assets omit `alt`
332
+
239
333
  ---
240
334
 
241
- ## 8. Resolver / 解析器
335
+ ## 10. Resolver / 解析器
242
336
 
243
337
  - `Document.build_resolver()`
244
338
  - `DocumentResolver.get(...)`
245
- - `DocumentResolver.get_by_id(...)`
246
339
  - `DocumentResolver.get_by_anchor(...)`
247
340
  - `DocumentResolver.resolve_xref(...)`
248
341
  - `DocumentResolver.debug_summary()`
249
342
 
250
- Use the resolver when you need to inspect what is globally addressable in the document.
343
+ Use the resolver when you need to inspect what is globally addressable in the document.
251
344
  当你需要检查文档中哪些对象在全局可解析时,使用 resolver。
252
345
 
253
346
  ---
254
347
 
255
- ## 9. Numbering / 编号
348
+ ## 11. Numbering / 编号
256
349
 
257
350
  - `Document.build_numbering()`
258
351
  - `NumberingConfig`
259
352
  - `DocumentNumbering`
260
353
  - `NumberedTarget`
261
- - `Section.numbering`
262
- - `NumberingMode = Literal["auto", "none", "manual"]`
263
-
264
- ---
265
-
266
- ## 10. Export and round-trip / 导出与回转
267
-
268
- - `Document.to_dict(exclude_none=True)`
269
- - `Document.to_json(indent=2, exclude_none=True)`
270
- - `Document.save_json(path, indent=2, exclude_none=True)`
271
- - `Document.from_dict(data)`
272
- - `Document.from_json(text)`
273
- - `Document.load_json(path)`
274
-
275
- ---
276
-
277
- ## 11. Package-level enums and constrained values / 包内枚举与约束值
278
-
279
- ### Text styles / 文本样式
280
-
281
- - `normal`
282
- - `blockquote`
283
- - `caption`
284
- - `figure_caption`
285
- - `table_caption`
286
- - `equation_caption`
287
- - `smallprint`
288
- - `lead`
289
- - `quote_source`
290
- - `subheading`
291
-
292
- ### Decorator marks / 装饰 mark
293
-
294
- - `strong`
295
- - `em`
296
- - `underline`
297
- - `code`
298
-
299
- ### List styles / 列表类型
300
-
301
- - `bullet`
302
- - `number`
303
-
304
- ### Image source kinds / 图片来源类型
305
-
306
- - `url`
307
- - `embedded`
308
-
309
- ### Current package metadata validation / 当前包对 meta 的校验
310
-
311
- - `language` / `locale`: `"zh"` or `"en"`
312
- - `documentType`: `"valuationReport"`
313
- - `confidentiality`: `"public" | "user" | "internal" | "confidential"`
314
- - `reportType`: `"startupCompany" | "innovationTeam" | "patent" | "loan"`
315
- - `date`: `YYYY-MM-DD`
316
- - `generatedAt`: RFC 3339 / ISO 8601 datetime string
@@ -47,6 +47,8 @@ If you are new to the package, read in this order:
47
47
  URL and embedded image-source models. / URL 与内嵌 imageSource 模型。
48
48
  - `grid_table_demo.py`
49
49
  `record` and `grid` table datasets, including duplicate headers and irregular layouts. / `record` 与 `grid` 表格模式。
50
+ - `v11_layout_and_cell_image_demo.py`
51
+ Demonstrates `theme.blockStyleDefaults`, block `layout`, weighted table columns, and grid-cell images. / 演示 `theme.blockStyleDefaults`、块级 `layout`、表格列权重和单元格图片。
50
52
  - `extended_registries_demo.py`
51
53
  Logos, backgrounds, icons, attachments, and metric datasets. / logo、背景、图标、附件和指标数据集。
52
54
 
@@ -20,8 +20,8 @@ The package aligns to this top-level shape:
20
20
  - `glossary`
21
21
  - `sections`
22
22
 
23
- `schemaVersion` defaults to `report.v1.0`.
24
- `schemaVersion` 默认值为 `report.v1.0`。
23
+ `schemaVersion` defaults to `report.v1.1`.
24
+ `schemaVersion` 默认值为 `report.v1.1`。
25
25
 
26
26
  ---
27
27
 
@@ -50,8 +50,8 @@ What happens here / 这里发生了什么:
50
50
 
51
51
  ## 3. Add registry-backed content / 添加引用型内容
52
52
 
53
- The protocol separates top-level registries from body instances.
54
- 协议把“顶层 registry”与“正文实例”分开处理。
53
+ The protocol separates top-level registries from body instances. In `report.v1.1`, image instances may omit `id`, and text blocks can carry `layout`.
54
+ 协议把“顶层 registry”与“正文实例”分开处理。在 `report.v1.1` 中,图片实例可以省略 `id`,文本块还可以携带 `layout`。
55
55
 
56
56
  ### Example / 示例
57
57
 
@@ -91,7 +91,7 @@ report.add_table_dataset(
91
91
  )
92
92
 
93
93
  sec = report.new_section(id="sec-1", level=1, title="Body")
94
- sec.append_block(image_block(id="fig-cover", image_ref="img-cover"))
94
+ sec.append_block(image_block(image_ref="img-cover", id="fig-cover"))
95
95
  sec.append_block(table_block(id="tbl-summary", table_ref="table-summary"))
96
96
 
97
97
  report.assert_valid()