OVAPortableText 0.1.3__tar.gz → 0.1.4__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 (90) hide show
  1. ovaportabletext-0.1.4/CHANGELOG.md +80 -0
  2. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/PKG-INFO +1 -1
  3. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/extended_registries_demo.py +7 -7
  4. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/full_report_workflow_demo.py +3 -3
  5. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/image_sources_demo.py +14 -3
  6. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/inline_objects_report.py +1 -1
  7. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/patent_valuation_style_report.py +2 -2
  8. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/references_and_marks_demo.py +6 -10
  9. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/registry_blocks_report.py +1 -1
  10. ovaportabletext-0.1.4/examples/sample_outputs/generate_patent_report_sample_1.py +662 -0
  11. ovaportabletext-0.1.4/examples/sample_outputs/patent_report_sample_1.json +2903 -0
  12. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/validation_report.py +1 -1
  13. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/pyproject.toml +1 -1
  14. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/__init__.py +17 -14
  15. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/content.py +0 -5
  16. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/document.py +5 -69
  17. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/helpers.py +94 -85
  18. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/inline.py +16 -1
  19. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/registry.py +92 -54
  20. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/resolver.py +4 -1
  21. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/text.py +1 -27
  22. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/validator.py +32 -84
  23. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/version.py +1 -1
  24. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_extended_registries_and_resolver.py +8 -7
  25. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_inline_objects.py +2 -0
  26. ovaportabletext-0.1.3/CHANGELOG.md +0 -48
  27. ovaportabletext-0.1.3/docs/dev/ova/CHANGELOG.md +0 -48
  28. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_1.md +0 -62
  29. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_10.md +0 -168
  30. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_2.md +0 -45
  31. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_3.md +0 -85
  32. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_4.md +0 -69
  33. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_5.md +0 -261
  34. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_6.md +0 -196
  35. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_7.md +0 -271
  36. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_8.md +0 -210
  37. ovaportabletext-0.1.3/docs/dev/ova/IMPLEMENTATION_STEP_9.md +0 -169
  38. ovaportabletext-0.1.3/docs/dev/ova/report_profile_v1_draft.md +0 -2704
  39. ovaportabletext-0.1.3/examples/sample_outputs/patent_report_sample_1.json +0 -3289
  40. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/.gitignore +0 -0
  41. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/LICENSE +0 -0
  42. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/README.md +0 -0
  43. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/API_REFERENCE.md +0 -0
  44. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/EXAMPLES.md +0 -0
  45. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/PROTOCOL_ALIGNMENT.md +0 -0
  46. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/PUBLISHING_CHECKLIST.md +0 -0
  47. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/QUICKSTART.md +0 -0
  48. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/REAL_WORLD_RECIPES.md +0 -0
  49. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/TEST_MATRIX.md +0 -0
  50. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/USER_TESTING_CHECKLIST.md +0 -0
  51. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/docs/VALIDATION_AND_RESOLVER.md +0 -0
  52. {ovaportabletext-0.1.3/docs/dev → ovaportabletext-0.1.4/docs}/native/portable_text_basics.md +0 -0
  53. /ovaportabletext-0.1.3/docs/dev/ova/report_profile_v1.0.md → /ovaportabletext-0.1.4/docs/protocol/v1.0.md +0 -0
  54. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/builder_numbering_roundtrip_demo.py +0 -0
  55. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/grid_table_demo.py +0 -0
  56. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/marks_and_lists_report.py +0 -0
  57. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/minimal_report.py +0 -0
  58. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/save_and_load_json_demo.py +0 -0
  59. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/examples/validation_context_demo.py +0 -0
  60. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/base.py +0 -0
  61. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/block_objects.py +0 -0
  62. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/exceptions.py +0 -0
  63. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/numbering.py +0 -0
  64. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/py.typed +0 -0
  65. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/section.py +0 -0
  66. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/src/ova_portable_text/theme.py +0 -0
  67. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_blocks_and_registry.py +0 -0
  68. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_builder_roundtrip_and_theme.py +0 -0
  69. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_content_flow_helpers.py +0 -0
  70. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_document_validation_error_rendering.py +0 -0
  71. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_examples_smoke.py +0 -0
  72. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_file_io_roundtrip.py +0 -0
  73. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_image_asset_sources.py +0 -0
  74. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_mark_validation.py +0 -0
  75. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_marks_and_lists.py +0 -0
  76. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_minimal_report.py +0 -0
  77. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_numbering.py +0 -0
  78. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_pie_chart_parallel_arrays.py +0 -0
  79. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_resolver_debug_summary.py +0 -0
  80. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_resolver_semantic_figure_alias.py +0 -0
  81. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_roundtrip_and_runtime_version.py +0 -0
  82. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_section_batch_helpers.py +0 -0
  83. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_strict_ids.py +0 -0
  84. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_style_validation.py +0 -0
  85. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_table_dataset_validation.py +0 -0
  86. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_validation_context_output.py +0 -0
  87. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_validation_failures.py +0 -0
  88. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_validation_report_python_alias.py +0 -0
  89. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_validation_success.py +0 -0
  90. {ovaportabletext-0.1.3 → ovaportabletext-0.1.4}/tests/test_validator_extended_rules.py +0 -0
@@ -0,0 +1,80 @@
1
+ # Changelog
2
+
3
+ **All notable changes to this project will be documented in this file.** ** **本项目的重要变更会记录在此文件中。
4
+
5
+ ## [Unreleased]
6
+
7
+ ## [0.1.4] - 2026-03-25
8
+
9
+ ### Added
10
+
11
+ * **bilingual end-user and developer documentation, including a restructured **`README.md`
12
+ * **protocol-aligned table authoring helpers for both **`record` and `grid` table modes
13
+ * **generic chart registry support so non-**`pie` chart entries can remain in `datasets.charts[]` without pretending to follow the `pie` schema
14
+ * **richer example coverage for image sources, grid tables, references, marks, and end-to-end report generation**
15
+ * **resolver support for the generic **`asset` target alias in cross-references
16
+
17
+ ### Changed
18
+
19
+ * **synchronized the package with the latest **`report.v1.0` protocol wording and data contracts
20
+ * **standardized document schema version handling to **`report.v1.0`
21
+ * **aligned **`meta` handling with the latest protocol field set, including stronger enum / format validation where the protocol now defines it
22
+ * **aligned bibliography generation with the latest protocol by treating **`displayText` as the primary display field
23
+ * **aligned image registries (**`images`, `logos`, `backgrounds`, `icons`) around the current `imageSource` model and helper flow
24
+ * **aligned inline reference models around **`targetId`
25
+ * **expanded validator coverage for **`grid` tables, protocol-native image sources, and newer registry / reference rules
26
+ * **refreshed examples and tests to use the current protocol instead of older transitional shapes**
27
+
28
+ ### Fixed
29
+
30
+ * **corrected remaining mismatches between protocol examples and package-generated JSON structures**
31
+ * **corrected resolver / validator gaps around newer reference and asset resolution behaviors**
32
+ * **corrected helper / example inconsistencies that could force manual post-processing for some protocol features**
33
+
34
+ ## [0.1.3]
35
+
36
+ ### Added
37
+
38
+ * **formal image-source helpers: **`image_asset_url(...)`, `image_asset_embedded(...)`, and `image_asset_from_file(...)`
39
+ * **typed image source models: **`ImageSourceUrl`, `ImageSourceEmbedded`, and discriminated `ImageSource`
40
+
41
+ ### Changed
42
+
43
+ * `assets.images` now follows the pure `imageSource` protocol and no longer depends on legacy `src`
44
+ * **image-related examples, tests, and docs now use the new protocol-native image helpers**
45
+
46
+ ## [0.1.2]
47
+
48
+ ### Added
49
+
50
+ * **optional **`strict_ids=True` fail-early duplicate-ID checks for common authoring paths
51
+ * **continuous-content helpers on **`Section`:
52
+ * `append_to_last_content()`
53
+ * `append_blocks_to_last_content()`
54
+ * `append_text_block_to_last_content()`
55
+ * `append_paragraph_to_last_content()`
56
+ * **release-facing docs now explain the implemented v1.0 protocol subset more explicitly**
57
+
58
+ ### Changed
59
+
60
+ * **packaging and release metadata were aligned for a cleaner publication flow**
61
+ * `Section.numbering` now accepts only protocol-approved values: `auto`, `none`, and `manual`
62
+ * **publishing checklist now includes changelog layout and sdist verification guidance**
63
+
64
+ ## [0.1.1]
65
+
66
+ ### Added
67
+
68
+ * **improved authoring ergonomics for local save/load and batch section writing**
69
+ * **more release-prep docs and smoke-test coverage**
70
+
71
+ ## [0.1.0]
72
+
73
+ ### Added
74
+
75
+ * **document / section tree builder**
76
+ * **text blocks, spans, marks, markDefs, and list semantics**
77
+ * **inline refs: **`xref`, `citation_ref`, `footnote_ref`, `glossary_term`, `hard_break`
78
+ * **block objects: **`image`, `chart`, `table`, `math_block`, `callout`
79
+ * **registries: assets, datasets, bibliography, footnotes, glossary**
80
+ * **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.1.4
4
4
  Summary: Python builder for generating OVAPortableText / Report Profile v1 JSON documents
5
5
  Author: FENG QU
6
6
  License-Expression: MIT
@@ -1,19 +1,19 @@
1
1
  from ova_portable_text import (
2
2
  attachment_asset,
3
- background_asset,
3
+ background_asset_url,
4
4
  create_document,
5
- icon_asset,
6
- logo_asset,
5
+ icon_asset_url,
6
+ logo_asset_url,
7
7
  metric_dataset,
8
8
  metric_value,
9
9
  )
10
10
 
11
11
  report = create_document(title="Extended Registries Demo", language="en", reportType="valuation")
12
12
 
13
- report.add_logo_asset(logo_asset(id="logo-main", url="https://example.com/assets/logo.svg", alt="Main brand logo", variant="light"))
14
- report.add_background_asset(background_asset(id="bg-cover", url="https://example.com/assets/cover.png", usage="cover"))
15
- report.add_icon_asset(icon_asset(id="icon-growth", url="https://example.com/assets/growth.svg", alt="Growth icon", family="outline"))
16
- report.add_attachment_asset(attachment_asset(id="att-appendix-a", url="https://example.com/appendix-a.pdf", file_name="appendix-a.pdf", description="Supporting appendix PDF"))
13
+ report.add_logo_asset(logo_asset_url(id="logo-main", url="https://example.com/assets/logo.svg", alt="Main brand logo", variant="light"))
14
+ report.add_background_asset(background_asset_url(id="bg-cover", url="https://example.com/assets/cover.png", usage="cover"))
15
+ report.add_icon_asset(icon_asset_url(id="icon-growth", url="https://example.com/assets/growth.svg", alt="Growth icon", family="outline"))
16
+ report.add_attachment_asset(attachment_asset(id="att-appendix-a", src="https://example.com/appendix-a.pdf", file_name="appendix-a.pdf", description="Supporting appendix PDF"))
17
17
  report.add_metric_dataset(metric_dataset(id="metric-overview", values=[metric_value(key="revenue", label="Revenue", value=128.4, unit="USDm"), metric_value(key="employees", label="Employees", value=96), metric_value(key="profitable", label="Profitable", value=True)], label="Company snapshot"))
18
18
 
19
19
  print(report.to_json())
@@ -23,7 +23,7 @@ report = create_document(
23
23
  title="Full Workflow Demo",
24
24
  language="en",
25
25
  subtitle="Step 8 end-to-end example",
26
- documentType="valuationReport",
26
+ documentType="report",
27
27
  )
28
28
 
29
29
  report.add_image_asset(
@@ -60,11 +60,11 @@ report.add_chart_dataset(
60
60
  report.add_bibliography_entry(
61
61
  bibliography_entry(
62
62
  id="bib-pt",
63
- display_text="Portable Text Authors. Portable Text Specification. 2026.",
63
+ display_text="Portable Text Authors (2026). Portable Text Specification.",
64
64
  title="Portable Text Specification",
65
65
  authors=["Portable Text Authors"],
66
66
  year=2026,
67
- type="other",
67
+ type="specification",
68
68
  )
69
69
  )
70
70
 
@@ -43,7 +43,11 @@ def main() -> None:
43
43
  report.add_logo_asset(
44
44
  logo_asset(
45
45
  id="logo-main",
46
- data_base64=TINY_PNG_BASE64,
46
+ image_source={
47
+ "kind": "embedded",
48
+ "encoding": "base64",
49
+ "data": TINY_PNG_BASE64,
50
+ },
47
51
  alt="Main logo",
48
52
  mimeType="image/png",
49
53
  width=32,
@@ -54,7 +58,10 @@ def main() -> None:
54
58
  report.add_background_asset(
55
59
  background_asset(
56
60
  id="bg-cover",
57
- url="https://example.com/assets/cover-bg.png",
61
+ image_source={
62
+ "kind": "url",
63
+ "url": "https://example.com/assets/cover-bg.png",
64
+ },
58
65
  mimeType="image/png",
59
66
  width=1600,
60
67
  height=900,
@@ -64,7 +71,11 @@ def main() -> None:
64
71
  report.add_icon_asset(
65
72
  icon_asset(
66
73
  id="icon-growth",
67
- data_base64=TINY_PNG_BASE64,
74
+ image_source={
75
+ "kind": "embedded",
76
+ "encoding": "base64",
77
+ "data": TINY_PNG_BASE64,
78
+ },
68
79
  alt="Growth icon",
69
80
  mimeType="image/png",
70
81
  width=16,
@@ -13,7 +13,7 @@ from ova_portable_text import (
13
13
  report = create_document(
14
14
  title="Inline Object Demo",
15
15
  language="en",
16
- documentType="valuationReport",
16
+ documentType="report",
17
17
  )
18
18
 
19
19
  intro = section(id="sec-intro", level=1, title="Introduction")
@@ -27,7 +27,7 @@ def main() -> None:
27
27
  title="Patent Valuation Report",
28
28
  subtitle="Illustrative protocol example",
29
29
  language="en",
30
- documentType="valuationReport",
30
+ documentType="report",
31
31
  author="OVA Demo",
32
32
  confidentiality="internal",
33
33
  )
@@ -81,7 +81,7 @@ def main() -> None:
81
81
  report.add_bibliography_entry(
82
82
  bibliography_entry(
83
83
  id="bib-market-2025",
84
- display_text="Research Team. Global Patent Market Review. 2025.",
84
+ display_text="Research Team (2025). Global Patent Market Review.",
85
85
  title="Global Patent Market Review",
86
86
  authors=["Research Team"],
87
87
  year=2025,
@@ -3,18 +3,14 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from ova_portable_text import (
6
+ annotation_def,
6
7
  bibliography_entry,
7
- citation_ref_def,
8
8
  create_document,
9
9
  footnote_entry,
10
- footnote_ref_def,
11
10
  glossary_entry,
12
- glossary_term_def,
13
- inline_math_def,
14
11
  link_def,
15
12
  paragraph,
16
13
  span,
17
- xref_def,
18
14
  )
19
15
 
20
16
 
@@ -70,11 +66,11 @@ def main() -> None:
70
66
  ".",
71
67
  mark_defs=[
72
68
  link_def(key="m-link", href="https://example.com"),
73
- xref_def(key="m-xref", target_id="sec-method", target_type="section"),
74
- citation_ref_def(key="m-cite", target_id="cite-fu-2026"),
75
- footnote_ref_def(key="m-footnote", target_id="fn-1"),
76
- glossary_term_def(key="m-term", target_id="term-dcf"),
77
- inline_math_def(key="m-math", latex="E = mc^2"),
69
+ annotation_def(key="m-xref", type="xref", data={"targetId": "sec-method", "targetType": "section"}),
70
+ annotation_def(key="m-cite", type="citation_ref", data={"targetId": "cite-fu-2026"}),
71
+ annotation_def(key="m-footnote", type="footnote_ref", data={"targetId": "fn-1"}),
72
+ annotation_def(key="m-term", type="glossary_term", data={"targetId": "term-dcf"}),
73
+ annotation_def(key="m-math", type="inline_math", data={"latex": "E = mc^2"}),
78
74
  ],
79
75
  )
80
76
 
@@ -16,7 +16,7 @@ from ova_portable_text import (
16
16
  report = create_document(
17
17
  title="OVAPortableText Step 3 Demo",
18
18
  language="en",
19
- documentType="valuationReport",
19
+ documentType="report",
20
20
  )
21
21
 
22
22
  # Add registry entries / 追加顶层 registry 条目