OVAPortableText 0.1.4__tar.gz → 0.3.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.3.0}/CHANGELOG.md +52 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/PKG-INFO +1 -1
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/API_REFERENCE.md +141 -103
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/EXAMPLES.md +2 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/PROTOCOL_ALIGNMENT.md +4 -4
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/QUICKSTART.md +3 -3
- ovaportabletext-0.3.0/docs/protocol/v1.1.md +3623 -0
- ovaportabletext-0.3.0/docs/protocol/v1.2.md +4036 -0
- ovaportabletext-0.3.0/examples/v11_layout_and_cell_image_demo.py +84 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/pyproject.toml +1 -1
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/__init__.py +20 -2
- ovaportabletext-0.3.0/src/ova_portable_text/block_objects.py +62 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/document.py +26 -4
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/helpers.py +119 -14
- ovaportabletext-0.3.0/src/ova_portable_text/py.typed +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/registry.py +108 -9
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/resolver.py +10 -5
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/section.py +40 -10
- ovaportabletext-0.3.0/src/ova_portable_text/text.py +200 -0
- ovaportabletext-0.3.0/src/ova_portable_text/theme.py +44 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/validator.py +249 -46
- ovaportabletext-0.3.0/src/ova_portable_text/version.py +5 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_minimal_report.py +1 -1
- ovaportabletext-0.3.0/tests/test_v11_grid_cell_image.py +91 -0
- ovaportabletext-0.3.0/tests/test_v11_image_block_optional_id.py +20 -0
- ovaportabletext-0.3.0/tests/test_v11_table_layout.py +46 -0
- ovaportabletext-0.3.0/tests/test_v11_theme_layout.py +44 -0
- ovaportabletext-0.3.0/tests/test_v12_section_and_doughnut.py +61 -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.3.0}/.gitignore +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/LICENSE +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/README.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/PUBLISHING_CHECKLIST.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/REAL_WORLD_RECIPES.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/TEST_MATRIX.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/USER_TESTING_CHECKLIST.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/VALIDATION_AND_RESOLVER.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/native/portable_text_basics.md +0 -0
- /ovaportabletext-0.1.4/src/ova_portable_text/py.typed → /ovaportabletext-0.3.0/docs/protocol/test +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/docs/protocol/v1.0.md +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/builder_numbering_roundtrip_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/extended_registries_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/full_report_workflow_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/grid_table_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/image_sources_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/inline_objects_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/marks_and_lists_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/minimal_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/patent_valuation_style_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/references_and_marks_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/registry_blocks_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/sample_outputs/generate_patent_report_sample_1.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/sample_outputs/patent_report_sample_1.json +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/save_and_load_json_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/validation_context_demo.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/examples/validation_report.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/base.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/content.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/exceptions.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/inline.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/src/ova_portable_text/numbering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_blocks_and_registry.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_builder_roundtrip_and_theme.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_content_flow_helpers.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_document_validation_error_rendering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_examples_smoke.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_extended_registries_and_resolver.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_file_io_roundtrip.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_image_asset_sources.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_inline_objects.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_mark_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_marks_and_lists.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_numbering.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_pie_chart_parallel_arrays.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_resolver_debug_summary.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_resolver_semantic_figure_alias.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_roundtrip_and_runtime_version.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_section_batch_helpers.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_strict_ids.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_style_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_table_dataset_validation.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_validation_context_output.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_validation_failures.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_validation_report_python_alias.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_validation_success.py +0 -0
- {ovaportabletext-0.1.4 → ovaportabletext-0.3.0}/tests/test_validator_extended_rules.py +0 -0
|
@@ -4,6 +4,58 @@
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.3.0] - 2026-04-08
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* aligned the package with `report.v1.2`
|
|
12
|
+
* added `DoughnutChartDataset` and `doughnut_chart_dataset(...)`
|
|
13
|
+
* added section-level models and helpers for `sectionRole`, `navigation`, `pagination`, and `presentation`
|
|
14
|
+
* added support for `_type="chart"` inside `GridTableCell.blocks`
|
|
15
|
+
* added validation coverage for doughnut constraints, grid-cell chart refs, and `presentation.titleBlockStyle`
|
|
16
|
+
* added tests covering v1.2 doughnut datasets, section fields, and grid-cell charts
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
* default `schemaVersion` is now `report.v1.2`
|
|
21
|
+
* `ChartBlock.id`, `TableBlock.id`, `MathBlock.id`, and `CalloutBlock.id` are now optional to match the protocol's instance-layer rules
|
|
22
|
+
* `Section`, `Document.new_section(...)`, and `section(...)` now accept v1.2 section fields
|
|
23
|
+
* chart / table / math helper functions now accept optional instance ids
|
|
24
|
+
* public exports and packaging metadata now reflect `v0.3.0` / `report.v1.2`
|
|
25
|
+
|
|
26
|
+
### Fixed
|
|
27
|
+
|
|
28
|
+
* fixed the protocol mismatch where grid-cell chart blocks were still rejected by the Python models and validator
|
|
29
|
+
* fixed the resolver mismatch where optional chart / table / math / callout instance ids could break target indexing
|
|
30
|
+
* fixed the validation gap where grid-cell `chartRef` values were not resolved
|
|
31
|
+
|
|
32
|
+
## [0.2.0] - 2026-04-01
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
* aligned the package with `report.v1.1`
|
|
37
|
+
* added `theme.blockStyleDefaults` models and helpers
|
|
38
|
+
* added block-level `layout` support for `TextBlock` and paragraph helpers
|
|
39
|
+
* added table-level `layout.columnSpecs[]` with `auto | weight` width modes
|
|
40
|
+
* added helper functions: `block_layout`, `length_em`, `length_pt`, `table_column_spec_auto`, `table_column_spec_weight`, `table_layout`
|
|
41
|
+
* added support for `_type="image"` inside `GridTableCell.blocks`
|
|
42
|
+
* added validation coverage for grid-cell image refs and v1.1 table/theme features
|
|
43
|
+
* added `examples/v11_layout_and_cell_image_demo.py`
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
* default `schemaVersion` is now `report.v1.1`
|
|
48
|
+
* `ImageBlock.id` and `ImageBlock.anchor` are now optional
|
|
49
|
+
* `image_block(...)` and `Section.append_image(...)` now accept optional instance ids
|
|
50
|
+
* `record` and `grid` table datasets both accept table-level `layout`
|
|
51
|
+
* API docs and quickstart examples now reflect the v1.1 contract
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
* fixed the protocol mismatch where image instances incorrectly required `id`
|
|
56
|
+
* fixed the protocol mismatch where grid-cell `blocks` only accepted text blocks
|
|
57
|
+
* fixed the validation gap where grid-cell `imageRef` values were not resolved
|
|
58
|
+
|
|
7
59
|
## [0.1.4] - 2026-03-25
|
|
8
60
|
|
|
9
61
|
### 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.3.0`, aligned to `report.v1.2`.
|
|
4
|
+
本文档是 OVAPortableText `v0.3.0` 的实用 API 地图,对齐 `report.v1.2`。
|
|
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.2"`
|
|
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,57 @@ Body block objects / 正文块对象:
|
|
|
47
46
|
- `MathBlock`
|
|
48
47
|
- `CalloutBlock`
|
|
49
48
|
|
|
49
|
+
Important v1.2 note / v1.2 重点:
|
|
50
|
+
|
|
51
|
+
- `ImageBlock(imageRef="...")` remains valid
|
|
52
|
+
- `ChartBlock(chartRef="...")`, `TableBlock(tableRef="...")`, and `MathBlock(latex="...")` may now omit instance `id`
|
|
53
|
+
- `Section` now supports `sectionRole`, `navigation`, `pagination`, and `presentation`
|
|
54
|
+
- `GridTableCell.blocks[]` now supports `_type="chart"` in addition to `_type="block"` and `_type="image"`
|
|
55
|
+
|
|
50
56
|
---
|
|
51
57
|
|
|
52
|
-
## 3.
|
|
58
|
+
## 3. Theme and block layout / theme 与块级 layout
|
|
59
|
+
|
|
60
|
+
### Theme models / theme 模型
|
|
61
|
+
|
|
62
|
+
- `ThemeConfig`
|
|
63
|
+
- `BlockStyleDefault`
|
|
64
|
+
- `BlockLayout`
|
|
65
|
+
- `LengthValue`
|
|
66
|
+
|
|
67
|
+
### Theme helpers / theme helper
|
|
68
|
+
|
|
69
|
+
- `block_layout(...)`
|
|
70
|
+
- `length_em(value)`
|
|
71
|
+
- `length_pt(value)`
|
|
72
|
+
|
|
73
|
+
### v1.1 formal fields / v1.1 正式字段
|
|
74
|
+
|
|
75
|
+
- `theme.blockStyleDefaults`
|
|
76
|
+
- `TextBlock.layout`
|
|
77
|
+
|
|
78
|
+
Supported `BlockLayout` fields:
|
|
79
|
+
|
|
80
|
+
- `textAlign`
|
|
81
|
+
- `firstLineIndent`
|
|
82
|
+
- `spaceBefore`
|
|
83
|
+
- `spaceAfter`
|
|
84
|
+
|
|
85
|
+
Supported `textAlign` values:
|
|
86
|
+
|
|
87
|
+
- `left`
|
|
88
|
+
- `center`
|
|
89
|
+
- `right`
|
|
90
|
+
- `justify`
|
|
91
|
+
|
|
92
|
+
Supported length units:
|
|
93
|
+
|
|
94
|
+
- `em`
|
|
95
|
+
- `pt`
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 4. Text helpers / 文本层 helper
|
|
53
100
|
|
|
54
101
|
### Inline text constructors / 行内文本构造
|
|
55
102
|
|
|
@@ -63,16 +110,11 @@ Body block objects / 正文块对象:
|
|
|
63
110
|
### Mark-definition helpers / markDef helper
|
|
64
111
|
|
|
65
112
|
- `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
113
|
- `annotation_def(key=..., type=..., data=...)`
|
|
72
114
|
|
|
73
115
|
### Block constructors / 文本块构造
|
|
74
116
|
|
|
75
|
-
- `paragraph(*parts, style="normal", mark_defs=None, list_item=None, level=None)`
|
|
117
|
+
- `paragraph(*parts, style="normal", mark_defs=None, list_item=None, level=None, layout=None)`
|
|
76
118
|
- `bullet_item(*parts, level=1, mark_defs=None)`
|
|
77
119
|
- `number_item(*parts, level=1, mark_defs=None)`
|
|
78
120
|
- `blocks_from_items(...)`
|
|
@@ -80,7 +122,7 @@ Body block objects / 正文块对象:
|
|
|
80
122
|
### Inline object helpers / 行内对象 helper
|
|
81
123
|
|
|
82
124
|
- `hard_break()`
|
|
83
|
-
- `xref(
|
|
125
|
+
- `xref(target_type=..., target_id=...)`
|
|
84
126
|
- `citation_ref(target_id)`
|
|
85
127
|
- `footnote_ref(target_id)`
|
|
86
128
|
- `glossary_term(target_id)`
|
|
@@ -88,7 +130,7 @@ Body block objects / 正文块对象:
|
|
|
88
130
|
|
|
89
131
|
---
|
|
90
132
|
|
|
91
|
-
##
|
|
133
|
+
## 5. Section helpers / Section 级 helper
|
|
92
134
|
|
|
93
135
|
### Create sections / 创建章节
|
|
94
136
|
|
|
@@ -100,13 +142,16 @@ Body block objects / 正文块对象:
|
|
|
100
142
|
|
|
101
143
|
### Append text / 追加文本
|
|
102
144
|
|
|
103
|
-
- `Section.append_paragraph(
|
|
145
|
+
- `Section.append_paragraph(..., layout=None)`
|
|
104
146
|
- `Section.append_paragraphs(...)`
|
|
105
147
|
- `Section.append_lead(...)`
|
|
106
148
|
- `Section.append_blockquote(...)`
|
|
107
149
|
- `Section.append_subheading(...)`
|
|
108
150
|
- `Section.append_smallprint(...)`
|
|
109
|
-
- `Section.
|
|
151
|
+
- `Section.append_caption(...)`
|
|
152
|
+
- `Section.append_figure_caption(...)`
|
|
153
|
+
- `Section.append_table_caption(...)`
|
|
154
|
+
- `Section.append_equation_caption(...)`
|
|
110
155
|
|
|
111
156
|
### Append lists / 追加列表
|
|
112
157
|
|
|
@@ -120,24 +165,25 @@ Body block objects / 正文块对象:
|
|
|
120
165
|
- `Section.append_to_last_content(block)`
|
|
121
166
|
- `Section.append_blocks_to_last_content(*blocks)`
|
|
122
167
|
- `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。
|
|
168
|
+
- `Section.append_paragraph_to_last_content(..., layout=None)`
|
|
127
169
|
|
|
128
170
|
### Append block objects / 追加块对象
|
|
129
171
|
|
|
130
172
|
- `Section.append_block(...)`
|
|
131
173
|
- `Section.append_blocks(...)`
|
|
132
174
|
- `Section.append_callout(...)`
|
|
133
|
-
- `Section.
|
|
175
|
+
- `Section.append_image(image_ref=..., id=None, anchor=None)`
|
|
176
|
+
- `Section.append_chart(...)`
|
|
177
|
+
- `Section.append_table(...)`
|
|
178
|
+
- `Section.append_math(...)`
|
|
179
|
+
- `Section.append_image_with_caption(image_ref=..., id=None, caption=...)`
|
|
134
180
|
- `Section.append_chart_with_caption(...)`
|
|
135
181
|
- `Section.append_table_with_caption(...)`
|
|
136
182
|
- `Section.append_math_with_caption(...)`
|
|
137
183
|
|
|
138
184
|
---
|
|
139
185
|
|
|
140
|
-
##
|
|
186
|
+
## 6. Registry helpers / registry helper
|
|
141
187
|
|
|
142
188
|
### Assets / 资源
|
|
143
189
|
|
|
@@ -153,25 +199,27 @@ Use these when multiple blocks should remain in the same protocol `content` item
|
|
|
153
199
|
### Datasets / 数据集
|
|
154
200
|
|
|
155
201
|
- `table_column(...)`
|
|
156
|
-
- `table_dataset(...)` → returns `RecordTableDataset`
|
|
157
|
-
|
|
202
|
+
- `table_dataset(...)` → returns `RecordTableDataset`
|
|
203
|
+
- `record_table_dataset(...)`
|
|
158
204
|
- `grid_table_cell(...)`
|
|
159
205
|
- `grid_table_row(...)`
|
|
160
|
-
- `grid_table_dataset(...)` → returns `GridTableDataset`
|
|
161
|
-
|
|
206
|
+
- `grid_table_dataset(...)` → returns `GridTableDataset`
|
|
207
|
+
- `table_column_spec_auto()`
|
|
208
|
+
- `table_column_spec_weight(value)`
|
|
209
|
+
- `table_layout(*column_specs)`
|
|
162
210
|
- `pie_slice(...)`
|
|
163
211
|
- `pie_chart_dataset(...)`
|
|
164
212
|
- `pie_chart_from_parallel_arrays(...)`
|
|
165
213
|
- `metric_value(...)`
|
|
166
214
|
- `metric_dataset(...)`
|
|
167
215
|
|
|
168
|
-
### Registry
|
|
216
|
+
### Registry-backed block instances / 正文引用实例
|
|
169
217
|
|
|
170
|
-
- `image_block(
|
|
171
|
-
- `chart_block(
|
|
172
|
-
- `table_block(
|
|
173
|
-
- `math_block(
|
|
174
|
-
- `callout(
|
|
218
|
+
- `image_block(image_ref=..., id=None, anchor=None)`
|
|
219
|
+
- `chart_block(id=..., chart_ref=..., anchor=None)`
|
|
220
|
+
- `table_block(id=..., table_ref=..., anchor=None)`
|
|
221
|
+
- `math_block(id=..., latex=..., anchor=None)`
|
|
222
|
+
- `callout(id=..., blocks=None, anchor=None)`
|
|
175
223
|
|
|
176
224
|
### Bibliography / footnotes / glossary
|
|
177
225
|
|
|
@@ -181,7 +229,7 @@ Use these when multiple blocks should remain in the same protocol `content` item
|
|
|
181
229
|
|
|
182
230
|
---
|
|
183
231
|
|
|
184
|
-
##
|
|
232
|
+
## 7. Main registry models / 主要 registry 模型
|
|
185
233
|
|
|
186
234
|
### Assets / 资源模型
|
|
187
235
|
|
|
@@ -201,9 +249,11 @@ Use these when multiple blocks should remain in the same protocol `content` item
|
|
|
201
249
|
- `GridTableDataset`
|
|
202
250
|
- `GridTableRow`
|
|
203
251
|
- `GridTableCell`
|
|
204
|
-
- `TableDataset`
|
|
205
|
-
Discriminated union of `record | grid`. / `record | grid` 判别联合类型。
|
|
252
|
+
- `TableDataset`
|
|
206
253
|
- `TableColumn`
|
|
254
|
+
- `TableLayout`
|
|
255
|
+
- `TableColumnSpec`
|
|
256
|
+
- `TableColumnWidth`
|
|
207
257
|
- `PieChartDataset`
|
|
208
258
|
- `PieSlice`
|
|
209
259
|
- `MetricDataset`
|
|
@@ -218,7 +268,44 @@ Use these when multiple blocks should remain in the same protocol `content` item
|
|
|
218
268
|
|
|
219
269
|
---
|
|
220
270
|
|
|
221
|
-
##
|
|
271
|
+
## 8. v1.1 table notes / v1.1 表格说明
|
|
272
|
+
|
|
273
|
+
### Table-level layout / 表级 layout
|
|
274
|
+
|
|
275
|
+
Both record and grid tables now support:
|
|
276
|
+
|
|
277
|
+
- `layout.columnSpecs[]`
|
|
278
|
+
|
|
279
|
+
Width modes:
|
|
280
|
+
|
|
281
|
+
- `auto`
|
|
282
|
+
- `weight`
|
|
283
|
+
|
|
284
|
+
Rules:
|
|
285
|
+
|
|
286
|
+
- `mode="auto"` → no `value`
|
|
287
|
+
- `mode="weight"` → `value > 0`
|
|
288
|
+
- `weight` is relative weight, not percent
|
|
289
|
+
|
|
290
|
+
### Grid cell blocks / grid 单元格 blocks
|
|
291
|
+
|
|
292
|
+
`GridTableCell.blocks` is now a restricted block array.
|
|
293
|
+
|
|
294
|
+
Currently supported block types:
|
|
295
|
+
|
|
296
|
+
- `_type="block"`
|
|
297
|
+
- `_type="image"`
|
|
298
|
+
|
|
299
|
+
Not supported in cell blocks:
|
|
300
|
+
|
|
301
|
+
- `chart`
|
|
302
|
+
- `table`
|
|
303
|
+
- `math_block`
|
|
304
|
+
- `callout`
|
|
305
|
+
|
|
306
|
+
---
|
|
307
|
+
|
|
308
|
+
## 9. Validation / 校验
|
|
222
309
|
|
|
223
310
|
- `Document.validate()`
|
|
224
311
|
- `Document.assert_valid()`
|
|
@@ -236,81 +323,32 @@ print(validation.to_text())
|
|
|
236
323
|
report.assert_valid()
|
|
237
324
|
```
|
|
238
325
|
|
|
326
|
+
Validator additions relevant to v1.1:
|
|
327
|
+
|
|
328
|
+
- checks `theme.blockStyleDefaults` keys
|
|
329
|
+
- checks `TextBlock.layout`
|
|
330
|
+
- checks table `layout.columnSpecs`
|
|
331
|
+
- checks grid cell image refs
|
|
332
|
+
- warns when image-like assets omit `alt`
|
|
333
|
+
|
|
239
334
|
---
|
|
240
335
|
|
|
241
|
-
##
|
|
336
|
+
## 10. Resolver / 解析器
|
|
242
337
|
|
|
243
338
|
- `Document.build_resolver()`
|
|
244
339
|
- `DocumentResolver.get(...)`
|
|
245
|
-
- `DocumentResolver.get_by_id(...)`
|
|
246
340
|
- `DocumentResolver.get_by_anchor(...)`
|
|
247
341
|
- `DocumentResolver.resolve_xref(...)`
|
|
248
342
|
- `DocumentResolver.debug_summary()`
|
|
249
343
|
|
|
250
|
-
Use the resolver when you need to inspect what is globally addressable in the document.
|
|
344
|
+
Use the resolver when you need to inspect what is globally addressable in the document.
|
|
251
345
|
当你需要检查文档中哪些对象在全局可解析时,使用 resolver。
|
|
252
346
|
|
|
253
347
|
---
|
|
254
348
|
|
|
255
|
-
##
|
|
349
|
+
## 11. Numbering / 编号
|
|
256
350
|
|
|
257
351
|
- `Document.build_numbering()`
|
|
258
352
|
- `NumberingConfig`
|
|
259
353
|
- `DocumentNumbering`
|
|
260
354
|
- `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
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Protocol Alignment / 协议对齐说明
|
|
2
2
|
|
|
3
|
-
This page explains how OVAPortableText 0.
|
|
4
|
-
本文档说明 OVAPortableText 0.
|
|
3
|
+
This page explains how OVAPortableText 0.3.0 aligns with the current Report Profile v1.2 protocol maintained in this repository.
|
|
4
|
+
本文档说明 OVAPortableText 0.3.0 与当前仓库内维护的 Report Profile v1.2 正式协议之间的对齐关系。
|
|
5
5
|
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -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.2`.
|
|
24
|
+
`schemaVersion` 默认值为 `report.v1.2`。
|
|
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.2`, image / chart / table / math instances may omit instance `id` where the protocol allows it, text blocks can carry `layout`, sections can carry `sectionRole / navigation / pagination / presentation`, and grid cells can now contain charts.
|
|
54
|
+
协议把“顶层 registry”与“正文实例”分开处理。在 `report.v1.2` 中,协议允许的图片 / 图表 / 表格 / 公式实例都可以省略实例 `id`,文本块可携带 `layout`,section 可携带 `sectionRole / navigation / pagination / presentation`,grid 单元格现在还可以放图表。
|
|
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()
|