specitems 1.4.0__tar.gz → 1.4.2__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.
- {specitems-1.4.0 → specitems-1.4.2}/PKG-INFO +1 -1
- {specitems-1.4.0 → specitems-1.4.2}/pyproject.toml +1 -1
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/contentmarkdown.py +33 -7
- {specitems-1.4.0 → specitems-1.4.2}/README.md +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/__init__.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/cite.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/clihash.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/clipickle.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/clispecdoc.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/cliutil.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/cliyamlquery.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/content.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/contentsphinx.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/contenttext.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/getvaluesubprocess.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/glossary.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/hashutil.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/itemmapper.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/items.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/py.typed +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/spec.pickle +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/specdoc.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/specverify.py +0 -0
- {specitems-1.4.0 → specitems-1.4.2}/src/specitems/subprocessaction.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: specitems
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.2
|
|
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
|
|
@@ -46,12 +46,17 @@ def _md_escape(match: Match) -> str:
|
|
|
46
46
|
return f"\\{match.group(0)}"
|
|
47
47
|
|
|
48
48
|
|
|
49
|
+
def _simple_row(row: Iterable[str], maxi: Iterable[int]) -> str:
|
|
50
|
+
line = " | ".join(f"{cell:{width}}" for cell, width in zip(row, maxi))
|
|
51
|
+
return f" | {line} |"
|
|
52
|
+
|
|
53
|
+
|
|
49
54
|
class MarkdownContent(TextContent):
|
|
50
55
|
""" This class builds MyST Markdown content. """
|
|
51
56
|
|
|
52
57
|
# pylint: disable=too-many-public-methods
|
|
53
58
|
def __init__(self,
|
|
54
|
-
section_level: int =
|
|
59
|
+
section_level: int = 0,
|
|
55
60
|
the_license: str | set[str] | None = None):
|
|
56
61
|
super().__init__(section_level, the_license)
|
|
57
62
|
self.set_pop_indent_gap(True)
|
|
@@ -91,10 +96,13 @@ class MarkdownContent(TextContent):
|
|
|
91
96
|
def add_label(self, label: str) -> None:
|
|
92
97
|
self.add(f"({label.strip()})=")
|
|
93
98
|
|
|
94
|
-
def add_header(self,
|
|
99
|
+
def add_header(self,
|
|
100
|
+
name: str,
|
|
101
|
+
level: int = 0,
|
|
102
|
+
label: Optional[str] = None) -> None:
|
|
95
103
|
if label is not None:
|
|
96
104
|
self.add_label(label)
|
|
97
|
-
self.add([f"{level * '#'} {name.strip()}", ""])
|
|
105
|
+
self.add([f"#{level * '#'} {name.strip()}", ""])
|
|
98
106
|
|
|
99
107
|
def add_rubric(self, name: str) -> None:
|
|
100
108
|
self.add(["```{eval-rst}", f".. rubric:: {name}", "```", ""])
|
|
@@ -125,10 +133,28 @@ class MarkdownContent(TextContent):
|
|
|
125
133
|
font_size: Optional[str | int] = None) -> None:
|
|
126
134
|
if not rows:
|
|
127
135
|
return
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
136
|
+
if not widths and font_size is None:
|
|
137
|
+
escaped_rows: list[tuple[str, ...]] = []
|
|
138
|
+
maxi = tuple(map(len, rows[0]))
|
|
139
|
+
for row in rows:
|
|
140
|
+
escaped_row = tuple(cell.replace("|", "\\|") for cell in row)
|
|
141
|
+
escaped_rows.append(escaped_row)
|
|
142
|
+
row_lengths = tuple(map(len, escaped_row))
|
|
143
|
+
maxi = tuple(map(max, zip(maxi, row_lengths)))
|
|
144
|
+
|
|
145
|
+
# At least three dashes are required for a table
|
|
146
|
+
maxi = tuple(max(width, 3) for width in maxi)
|
|
147
|
+
|
|
148
|
+
sep = " | ".join(f"{'-' * width}" for width in maxi)
|
|
149
|
+
sep = f" | {sep} |"
|
|
150
|
+
lines = [_simple_row(escaped_rows[0], maxi), sep]
|
|
151
|
+
lines.extend(_simple_row(row, maxi) for row in escaped_rows[1:])
|
|
152
|
+
self.add(lines)
|
|
153
|
+
else:
|
|
154
|
+
with self.directive("eval-rst"):
|
|
155
|
+
table = SphinxContent()
|
|
156
|
+
table.add_simple_table(rows, widths, font_size)
|
|
157
|
+
self.add(table)
|
|
132
158
|
|
|
133
159
|
def add_grid_table(self,
|
|
134
160
|
rows: Sequence[Iterable[str | int]],
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|