@tasksai/install 0.1.26 → 0.1.28
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.
- package/package.json +1 -1
- package/runtime/server.py +23 -5
package/package.json
CHANGED
package/runtime/server.py
CHANGED
|
@@ -125,7 +125,7 @@ if not LICENSE_KEY:
|
|
|
125
125
|
print("Find your key in your purchase confirmation email.", file=sys.stderr, flush=True)
|
|
126
126
|
sys.exit(1)
|
|
127
127
|
|
|
128
|
-
SERVER_VERSION = "2.4.
|
|
128
|
+
SERVER_VERSION = "2.4.4"
|
|
129
129
|
|
|
130
130
|
AUTH_HEADERS = {
|
|
131
131
|
"Authorization": f"Bearer {LICENSE_KEY}",
|
|
@@ -938,6 +938,10 @@ def labeled_fact(line):
|
|
|
938
938
|
match = re.match(r"^([^:\n]{1,55}):\s+(.+)$", line.strip())
|
|
939
939
|
if not match:
|
|
940
940
|
return None
|
|
941
|
+
if re.search(r"[`*_\[\]]", match.group(1)):
|
|
942
|
+
# A colon after inline Markdown is sentence punctuation, not a
|
|
943
|
+
# short label/value field. Let the normal inline parser handle it.
|
|
944
|
+
return None
|
|
941
945
|
return match.group(1).strip(), match.group(2).strip()
|
|
942
946
|
|
|
943
947
|
|
|
@@ -956,8 +960,9 @@ def add_labeled_fact(doc, label, value):
|
|
|
956
960
|
|
|
957
961
|
def iter_inline_markdown(text):
|
|
958
962
|
"""Yield (text, marks) spans for common inline Markdown."""
|
|
963
|
+
text = re.sub(r"\\([\\`*_{}\[\]()#+.!-])", r"\1", text)
|
|
959
964
|
token_re = re.compile(
|
|
960
|
-
r"(`[^`]+`|\*\*[^*]+\*\*|__[^_]
|
|
965
|
+
r"(`[^`]+`|\*\*[^*]+\*\*|(?<!_)__(?![_\s])[^_]+?(?<!\s)__(?!_)|\*[^*\s][^*]*\*|(?<!\w)_[^_\s][^_]*_(?!\w)|\[[^\]]+\]\([^)]+\))"
|
|
961
966
|
)
|
|
962
967
|
pos = 0
|
|
963
968
|
for match in token_re.finditer(text):
|
|
@@ -1036,12 +1041,25 @@ def add_markdown_text(paragraph, text):
|
|
|
1036
1041
|
run = paragraph.add_run(value)
|
|
1037
1042
|
if marks.get("bold"):
|
|
1038
1043
|
run.bold = True
|
|
1044
|
+
if re.match(r"^\+\d", value):
|
|
1045
|
+
# Aptos substitution in some headless Word renderers maps a
|
|
1046
|
+
# bold leading plus sign to a diamond. Arial preserves the
|
|
1047
|
+
# intended glyph and remains portable in Office.
|
|
1048
|
+
run.font.name = "Arial"
|
|
1039
1049
|
if marks.get("italic"):
|
|
1040
1050
|
run.italic = True
|
|
1041
1051
|
if marks.get("code"):
|
|
1042
1052
|
run.font.name = "Courier New"
|
|
1043
1053
|
|
|
1044
1054
|
|
|
1055
|
+
def add_markdown_heading(doc, text, level):
|
|
1056
|
+
"""Create a Word heading while parsing any inline Markdown in its text."""
|
|
1057
|
+
|
|
1058
|
+
paragraph = doc.add_heading(level=level)
|
|
1059
|
+
add_markdown_text(paragraph, text)
|
|
1060
|
+
return paragraph
|
|
1061
|
+
|
|
1062
|
+
|
|
1045
1063
|
def add_horizontal_rule(paragraph):
|
|
1046
1064
|
"""Render a horizontal Markdown rule as a Word paragraph border."""
|
|
1047
1065
|
from docx.oxml import OxmlElement
|
|
@@ -1340,16 +1358,16 @@ def write_docx(path, title, content_markdown, product_name):
|
|
|
1340
1358
|
and re.sub(r"\W+", "", heading_text).casefold()
|
|
1341
1359
|
== re.sub(r"\W+", "", title).casefold()
|
|
1342
1360
|
):
|
|
1343
|
-
doc
|
|
1361
|
+
add_markdown_heading(doc, heading_text, min(len(heading.group(1)), 4))
|
|
1344
1362
|
keep_checklist_together = "checklist" in heading_text.casefold()
|
|
1345
1363
|
index += 1
|
|
1346
1364
|
elif standalone_bold_heading:
|
|
1347
1365
|
flush_paragraph()
|
|
1348
|
-
doc
|
|
1366
|
+
add_markdown_heading(doc, standalone_bold_heading.group(1).strip(), 3)
|
|
1349
1367
|
index += 1
|
|
1350
1368
|
elif inferred_heading:
|
|
1351
1369
|
flush_paragraph()
|
|
1352
|
-
doc
|
|
1370
|
+
add_markdown_heading(doc, stripped, inferred_heading)
|
|
1353
1371
|
keep_checklist_together = "checklist" in stripped.casefold()
|
|
1354
1372
|
index += 1
|
|
1355
1373
|
elif fact:
|