OVAPortableText 0.1.4__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.
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/CHANGELOG.md +27 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/PKG-INFO +1 -1
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/API_REFERENCE.md +140 -103
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/EXAMPLES.md +2 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/PROTOCOL_ALIGNMENT.md +2 -2
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/QUICKSTART.md +3 -3
- ovaportabletext-0.2.0/docs/protocol/v1.1.md +3623 -0
- ovaportabletext-0.2.0/examples/v11_layout_and_cell_image_demo.py +84 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/pyproject.toml +1 -1
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/__init__.py +10 -1
- ovaportabletext-0.2.0/src/ova_portable_text/block_objects.py +62 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/document.py +2 -2
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/helpers.py +64 -11
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/registry.py +67 -8
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/resolver.py +2 -1
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/section.py +7 -4
- ovaportabletext-0.2.0/src/ova_portable_text/text.py +200 -0
- ovaportabletext-0.2.0/src/ova_portable_text/theme.py +44 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/validator.py +165 -46
- ovaportabletext-0.2.0/src/ova_portable_text/version.py +5 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_minimal_report.py +1 -1
- ovaportabletext-0.2.0/tests/test_v11_grid_cell_image.py +64 -0
- ovaportabletext-0.2.0/tests/test_v11_image_block_optional_id.py +20 -0
- ovaportabletext-0.2.0/tests/test_v11_table_layout.py +46 -0
- ovaportabletext-0.2.0/tests/test_v11_theme_layout.py +44 -0
- ovaportabletext-0.1.4/src/ova_portable_text/block_objects.py +0 -139
- ovaportabletext-0.1.4/src/ova_portable_text/text.py +0 -426
- ovaportabletext-0.1.4/src/ova_portable_text/theme.py +0 -46
- ovaportabletext-0.1.4/src/ova_portable_text/version.py +0 -9
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/.gitignore +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/LICENSE +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/README.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/PUBLISHING_CHECKLIST.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/REAL_WORLD_RECIPES.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/TEST_MATRIX.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/USER_TESTING_CHECKLIST.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/VALIDATION_AND_RESOLVER.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/native/portable_text_basics.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/docs/protocol/v1.0.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/builder_numbering_roundtrip_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/extended_registries_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/full_report_workflow_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/grid_table_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/image_sources_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/inline_objects_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/marks_and_lists_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/minimal_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/patent_valuation_style_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/references_and_marks_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/registry_blocks_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/sample_outputs/generate_patent_report_sample_1.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/sample_outputs/patent_report_sample_1.json +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/save_and_load_json_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/validation_context_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/examples/validation_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/base.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/content.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/exceptions.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/inline.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/numbering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/src/ova_portable_text/py.typed +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_blocks_and_registry.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_builder_roundtrip_and_theme.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_content_flow_helpers.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_document_validation_error_rendering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_examples_smoke.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_extended_registries_and_resolver.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_file_io_roundtrip.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_image_asset_sources.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_inline_objects.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_mark_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_marks_and_lists.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_numbering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_pie_chart_parallel_arrays.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_resolver_debug_summary.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_resolver_semantic_figure_alias.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_roundtrip_and_runtime_version.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_section_batch_helpers.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_strict_ids.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_style_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_table_dataset_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_validation_context_output.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_validation_failures.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_validation_report_python_alias.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_validation_success.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.2.0}/tests/test_validator_extended_rules.py +0 -0
|
@@ -4,6 +4,33 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
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
|
+
|
|
7
34
|
## [0.1.4] - 2026-03-25
|
|
8
35
|
|
|
9
36
|
### Added
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
# API Reference / API 参考
|
|
2
2
|
|
|
3
|
-
This page is a practical
|
|
4
|
-
本文档是 OVAPortableText
|
|
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
|
-
|
|
18
|
+
Default schema version:
|
|
19
|
+
|
|
20
|
+
- `Document.schemaVersion == "report.v1.1"`
|
|
21
|
+
|
|
22
|
+
Common arguments / 常用参数:
|
|
23
23
|
|
|
24
24
|
- `title`
|
|
25
|
-
- `language`
|
|
26
|
-
|
|
27
|
-
- `
|
|
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.
|
|
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(
|
|
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
|
-
##
|
|
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.
|
|
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.
|
|
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
|
-
##
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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
|
-
##
|
|
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.
|
|
24
|
-
`schemaVersion` 默认值为 `report.v1.
|
|
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(
|
|
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()
|