marklas 0.8.2__tar.gz → 0.8.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.
- {marklas-0.8.2 → marklas-0.8.3}/PKG-INFO +1 -1
- {marklas-0.8.2 → marklas-0.8.3}/pyproject.toml +1 -1
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/adf/parser.py +3 -2
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/adf/renderer.py +7 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/ast.py +11 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/inline.py +11 -1
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/normalize.py +7 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/renderer/block.py +16 -0
- {marklas-0.8.2 → marklas-0.8.3}/README.md +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/__init__.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/adf/__init__.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/convert.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/__init__.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/__init__.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/block.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/cell.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/parser/ir.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/renderer/__init__.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/md/renderer/cell.py +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/py.typed +0 -0
- {marklas-0.8.2 → marklas-0.8.3}/src/marklas/transform.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: marklas
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.3
|
|
4
4
|
Summary: Bidirectional converter between GitHub Flavored Markdown and Atlassian Document Format
|
|
5
5
|
Keywords: markdown,adf,atlassian,jira,confluence,converter,atlassian-document-format
|
|
6
6
|
Author: byExist
|
|
@@ -71,11 +71,12 @@ def _parse_mark(mark: dict[str, Any]) -> ast.Mark | None:
|
|
|
71
71
|
return ast.BorderMark(
|
|
72
72
|
size=attrs.get("size", 1), color=attrs.get("color", "")
|
|
73
73
|
)
|
|
74
|
+
case "fontSize":
|
|
75
|
+
return ast.FontSizeMark(size=attrs.get("fontSize", ""))
|
|
74
76
|
case "fragment":
|
|
75
77
|
return None # lossy: editor runtime metadata
|
|
76
78
|
case _:
|
|
77
|
-
|
|
78
|
-
raise ValueError(msg)
|
|
79
|
+
return ast.UnknownMark(type=mark.get("type", ""), attrs=mark.get("attrs"))
|
|
79
80
|
|
|
80
81
|
|
|
81
82
|
def _parse_marks(marks: list[dict[str, Any]]) -> list[ast.Mark]:
|
|
@@ -108,6 +108,13 @@ def _render_mark(mark: ast.Mark) -> dict[str, Any]:
|
|
|
108
108
|
return {"type": "dataConsumer", "attrs": {"sources": mark.sources}}
|
|
109
109
|
case ast.BorderMark():
|
|
110
110
|
return {"type": "border", "attrs": {"size": mark.size, "color": mark.color}}
|
|
111
|
+
case ast.FontSizeMark():
|
|
112
|
+
return {"type": "fontSize", "attrs": {"fontSize": mark.size}}
|
|
113
|
+
case ast.UnknownMark():
|
|
114
|
+
result: dict[str, Any] = {"type": mark.type}
|
|
115
|
+
if mark.attrs is not None:
|
|
116
|
+
result["attrs"] = mark.attrs
|
|
117
|
+
return result
|
|
111
118
|
case _:
|
|
112
119
|
msg = f"Unknown mark type: {type(mark)}"
|
|
113
120
|
raise ValueError(msg)
|
|
@@ -64,6 +64,11 @@ class EmMark(Mark):
|
|
|
64
64
|
pass
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
@dataclass
|
|
68
|
+
class FontSizeMark(Mark):
|
|
69
|
+
size: str
|
|
70
|
+
|
|
71
|
+
|
|
67
72
|
# @dataclass
|
|
68
73
|
# class FragmentMark(Mark):
|
|
69
74
|
# name: str | None = None
|
|
@@ -108,6 +113,12 @@ class UnderlineMark(Mark):
|
|
|
108
113
|
pass
|
|
109
114
|
|
|
110
115
|
|
|
116
|
+
@dataclass
|
|
117
|
+
class UnknownMark(Mark):
|
|
118
|
+
type: str
|
|
119
|
+
attrs: dict[str, Any] | None = None
|
|
120
|
+
|
|
121
|
+
|
|
111
122
|
# ── Inline Nodes ──────────────────────────────────────────────────────────────
|
|
112
123
|
|
|
113
124
|
|
|
@@ -214,7 +214,14 @@ def _build_paired_inline(
|
|
|
214
214
|
return [_build_media_inline(token.attrs)]
|
|
215
215
|
case "inlineExtension":
|
|
216
216
|
return [_build_inline_extension(token.attrs)]
|
|
217
|
-
case
|
|
217
|
+
case (
|
|
218
|
+
"underline"
|
|
219
|
+
| "textColor"
|
|
220
|
+
| "bgColor"
|
|
221
|
+
| "subSup"
|
|
222
|
+
| "annotation"
|
|
223
|
+
| "unknownMark"
|
|
224
|
+
):
|
|
218
225
|
return _apply_html_mark(
|
|
219
226
|
token.tag, token.adf_type, token.attrs, token.inner, parent_marks
|
|
220
227
|
)
|
|
@@ -251,6 +258,9 @@ def _apply_html_mark(
|
|
|
251
258
|
id=p.get("id", ""),
|
|
252
259
|
annotation_type=p.get("annotationType", "inlineComment"),
|
|
253
260
|
)
|
|
261
|
+
case "unknownMark":
|
|
262
|
+
p = get_params(attrs)
|
|
263
|
+
mark = ast.UnknownMark(type=p.get("type", ""), attrs=p.get("attrs"))
|
|
254
264
|
case _:
|
|
255
265
|
content = inline_text(inner)
|
|
256
266
|
text = ast.Text(text=content)
|
|
@@ -427,4 +427,11 @@ def parse_block_marks(params: dict[str, Any]) -> list[ast.Mark]:
|
|
|
427
427
|
size=params["borderSize"], color=params.get("borderColor", "")
|
|
428
428
|
)
|
|
429
429
|
)
|
|
430
|
+
if "fontSize" in params:
|
|
431
|
+
marks.append(ast.FontSizeMark(size=params["fontSize"]))
|
|
432
|
+
if "unknownMarks" in params:
|
|
433
|
+
for um in params["unknownMarks"]:
|
|
434
|
+
marks.append(
|
|
435
|
+
ast.UnknownMark(type=um.get("type", ""), attrs=um.get("attrs"))
|
|
436
|
+
)
|
|
430
437
|
return marks
|
|
@@ -226,6 +226,15 @@ def block_marks_params(marks: Sequence[ast.Mark]) -> dict[str, Any]:
|
|
|
226
226
|
case ast.BorderMark(size=size, color=color):
|
|
227
227
|
d["borderSize"] = size
|
|
228
228
|
d["borderColor"] = color
|
|
229
|
+
case ast.FontSizeMark(size=fsize):
|
|
230
|
+
d["fontSize"] = fsize
|
|
231
|
+
case ast.UnknownMark(type=type_, attrs=attrs):
|
|
232
|
+
entry = (
|
|
233
|
+
{"type": type_}
|
|
234
|
+
if attrs is None
|
|
235
|
+
else {"type": type_, "attrs": attrs}
|
|
236
|
+
)
|
|
237
|
+
d.setdefault("unknownMarks", []).append(entry)
|
|
229
238
|
case _:
|
|
230
239
|
pass
|
|
231
240
|
return d
|
|
@@ -1189,6 +1198,13 @@ def _wrap_html_mark(text: str, mark: ast.Mark) -> str:
|
|
|
1189
1198
|
adf="annotation",
|
|
1190
1199
|
params=build_params({"id": id_}),
|
|
1191
1200
|
)
|
|
1201
|
+
case ast.UnknownMark(type=type_, attrs=attrs):
|
|
1202
|
+
return el(
|
|
1203
|
+
"span",
|
|
1204
|
+
text,
|
|
1205
|
+
adf="unknownMark",
|
|
1206
|
+
params=build_params({"type": type_, "attrs": attrs}),
|
|
1207
|
+
)
|
|
1192
1208
|
case _:
|
|
1193
1209
|
return text
|
|
1194
1210
|
|
|
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
|