specitems 1.4.2__tar.gz → 1.4.3__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 (25) hide show
  1. {specitems-1.4.2 → specitems-1.4.3}/PKG-INFO +1 -1
  2. {specitems-1.4.2 → specitems-1.4.3}/pyproject.toml +2 -2
  3. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/__init__.py +6 -0
  4. specitems-1.4.3/src/specitems/contentcommonmark.py +119 -0
  5. {specitems-1.4.2 → specitems-1.4.3}/README.md +0 -0
  6. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/cite.py +0 -0
  7. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/clihash.py +0 -0
  8. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/clipickle.py +0 -0
  9. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/clispecdoc.py +0 -0
  10. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/cliutil.py +0 -0
  11. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/cliyamlquery.py +0 -0
  12. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/content.py +0 -0
  13. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/contentmarkdown.py +0 -0
  14. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/contentsphinx.py +0 -0
  15. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/contenttext.py +0 -0
  16. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/getvaluesubprocess.py +0 -0
  17. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/glossary.py +0 -0
  18. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/hashutil.py +0 -0
  19. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/itemmapper.py +0 -0
  20. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/items.py +0 -0
  21. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/py.typed +0 -0
  22. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/spec.pickle +0 -0
  23. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/specdoc.py +0 -0
  24. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/specverify.py +0 -0
  25. {specitems-1.4.2 → specitems-1.4.3}/src/specitems/subprocessaction.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: specitems
3
- Version: 1.4.2
3
+ Version: 1.4.3
4
4
  Summary: Provides interfaces to work with specification items.
5
5
  Keywords: certification,documentation,markdown,qualification,requirements-management,traceability
6
6
  Author: The specitems Authors
@@ -4,7 +4,7 @@
4
4
 
5
5
  [project]
6
6
  name = "specitems"
7
- version = "1.4.2"
7
+ version = "1.4.3"
8
8
  description = "Provides interfaces to work with specification items."
9
9
  authors = [
10
10
  {name = "The specitems Authors", email = "specthings@embedded-brains.de"}
@@ -56,7 +56,7 @@ spechash = "specitems.clihash:clihash"
56
56
  specyamlquery = "specitems.cliyamlquery:cliyamlquery"
57
57
 
58
58
  [build-system]
59
- requires = ["uv_build>=0.10.0,<0.11.0"]
59
+ requires = ["uv_build>=0.10.0"]
60
60
  build-backend = "uv_build"
61
61
 
62
62
  [dependency-groups]
@@ -56,6 +56,10 @@ from .contenttext import (
56
56
  latex_escape,
57
57
  make_label,
58
58
  )
59
+ from .contentcommonmark import (
60
+ CommonMarkContent,
61
+ CommonMarkMapper,
62
+ )
59
63
  from .contentmarkdown import (
60
64
  MarkdownContent,
61
65
  MarkdownMapper,
@@ -140,6 +144,8 @@ from .subprocessaction import (
140
144
  __all__ = [
141
145
  "BibTeXCitationProvider",
142
146
  "COL_SPAN",
147
+ "CommonMarkContent",
148
+ "CommonMarkMapper",
143
149
  "Content",
144
150
  "ContentAddContext",
145
151
  "Copyright",
@@ -0,0 +1,119 @@
1
+ # SPDX-License-Identifier: BSD-2-Clause
2
+ """ Provides interfaces for CommonMark content generation. """
3
+
4
+ # Copyright (C) 2025, 2026 embedded brains GmbH & Co. KG
5
+ #
6
+ # Redistribution and use in source and binary forms, with or without
7
+ # modification, are permitted provided that the following conditions
8
+ # are met:
9
+ # 1. Redistributions of source code must retain the above copyright
10
+ # notice, this list of conditions and the following disclaimer.
11
+ # 2. Redistributions in binary form must reproduce the above copyright
12
+ # notice, this list of conditions and the following disclaimer in the
13
+ # documentation and/or other materials provided with the distribution.
14
+ #
15
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16
+ # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18
+ # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22
+ # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23
+ # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25
+ # POSSIBILITY OF SUCH DAMAGE.
26
+
27
+ from typing import Iterable, Optional, Sequence
28
+
29
+ from .content import GenericContent, make_lines
30
+ from .contentmarkdown import MarkdownContent
31
+ from .contenttext import COL_SPAN, ROW_SPAN, TextContent, TextMapper
32
+
33
+
34
+ def _make_simple(cell: str | int) -> str:
35
+ if isinstance(cell, str):
36
+ return cell
37
+ if cell == COL_SPAN | ROW_SPAN:
38
+ return "↖"
39
+ if cell == ROW_SPAN:
40
+ return "←"
41
+ return "↑"
42
+
43
+
44
+ class CommonMarkContent(MarkdownContent):
45
+ """ This class builds CommonMark content. """
46
+
47
+ def reference(self, label: str, name: Optional[str] = None) -> str:
48
+ if not name:
49
+ name = label
50
+ return self.link(name, f"#{label}")
51
+
52
+ def term(self, text: str, term: str | None = None) -> str:
53
+ return text
54
+
55
+ def cite(self, identifier: str) -> str:
56
+ return ""
57
+
58
+ def add_label(self, label: str) -> None:
59
+ self.add(f"<a id=\"{label.strip()}\"></a>")
60
+
61
+ def add_rubric(self, name: str) -> None:
62
+ self.add([self.strong(name), ""])
63
+
64
+ def add_image(self, base: str, width: Optional[str] = None) -> None:
65
+ self.add(f"![]({base})")
66
+
67
+ def add_index_entries(self, entries: list[str]) -> None:
68
+ pass
69
+
70
+ def open_directive(self,
71
+ name: str,
72
+ value: Optional[str] = None,
73
+ options: Optional[list[str]] = None) -> None:
74
+ self.add(f"```{name.strip()}")
75
+ self.gap = False
76
+
77
+ def add_simple_table(self,
78
+ rows: Sequence[Iterable[str]],
79
+ widths: Optional[list[int]] = None,
80
+ font_size: Optional[str | int] = None) -> None:
81
+ super().add_simple_table(rows)
82
+
83
+ def add_grid_table(self,
84
+ rows: Sequence[Iterable[str | int]],
85
+ widths: Optional[list[int]] = None,
86
+ header_rows: int = 1,
87
+ font_size: Optional[str | int] = None) -> None:
88
+ if not rows:
89
+ return
90
+ simple_rows = [
91
+ tuple(_make_simple(cell) for cell in row) for row in rows
92
+ ]
93
+ self.add_simple_table(simple_rows)
94
+
95
+ def add_definition_item(self, name: GenericContent,
96
+ definition: GenericContent) -> None:
97
+ self.add(f"{self.strong(', '.join(make_lines(name)))}:")
98
+ self.append(definition)
99
+
100
+ def add_glossary_term(self, term: str, definition: str) -> None:
101
+ self.add_definition_item(term, definition)
102
+
103
+ def add_code_block(self,
104
+ code: list[str],
105
+ language: str = "none",
106
+ font_size: str | int = "footnotesize",
107
+ line_number_start: int = 1) -> None:
108
+ with self.directive(language):
109
+ self.append(code)
110
+
111
+
112
+ class CommonMarkMapper(TextMapper):
113
+ """ Provides an item mapper for CommonMark formatted text production. """
114
+
115
+ def create_content(
116
+ self,
117
+ section_level: int = 0,
118
+ the_license: str | set[str] | None = None) -> TextContent:
119
+ return CommonMarkContent(section_level, the_license)
File without changes