@tiens.nguyen/gu-cli 1.0.903 → 1.0.905
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/NOTICE +18 -0
- package/gu-repl.mjs +1 -1
- package/package.json +3 -2
- package/skills/core/deep-research/SKILL.md +51 -0
- package/skills/core/docx/LICENSE.txt +202 -0
- package/skills/core/docx/SKILL.md +97 -0
- package/skills/core/docx/scripts/__init__.py +1 -0
- package/skills/core/docx/scripts/accept_changes.py +135 -0
- package/skills/core/docx/scripts/comment.py +368 -0
- package/skills/core/docx/scripts/merge_runs.py +310 -0
- package/skills/core/docx/scripts/office/helpers/__init__.py +121 -0
- package/skills/core/docx/scripts/office/helpers/pptx_chart.py +283 -0
- package/skills/core/docx/scripts/office/helpers/pptx_slide.py +100 -0
- package/skills/core/docx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/core/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/core/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/core/docx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/core/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/core/docx/scripts/office/soffice.py +192 -0
- package/skills/core/docx/scripts/office/validate.py +210 -0
- package/skills/core/docx/scripts/office/validators/__init__.py +15 -0
- package/skills/core/docx/scripts/office/validators/base.py +874 -0
- package/skills/core/docx/scripts/office/validators/docx.py +519 -0
- package/skills/core/docx/scripts/office/validators/pptx.py +549 -0
- package/skills/core/docx/scripts/office/validators/redlining.py +461 -0
- package/skills/core/docx/scripts/templates/comments.xml +3 -0
- package/skills/core/docx/scripts/templates/commentsExtended.xml +3 -0
- package/skills/core/docx/scripts/templates/commentsExtensible.xml +3 -0
- package/skills/core/docx/scripts/templates/commentsIds.xml +3 -0
- package/skills/core/docx/scripts/templates/people.xml +3 -0
- package/skills/core/pdf/FORMS.md +294 -0
- package/skills/core/pdf/LICENSE.txt +202 -0
- package/skills/core/pdf/REFERENCE.md +613 -0
- package/skills/core/pdf/SKILL.md +314 -0
- package/skills/core/pdf/scripts/check_bounding_boxes.py +65 -0
- package/skills/core/pdf/scripts/check_fillable_fields.py +11 -0
- package/skills/core/pdf/scripts/convert_pdf_to_images.py +33 -0
- package/skills/core/pdf/scripts/create_validation_image.py +37 -0
- package/skills/core/pdf/scripts/extract_form_field_info.py +122 -0
- package/skills/core/pdf/scripts/extract_form_structure.py +115 -0
- package/skills/core/pdf/scripts/fill_fillable_fields.py +98 -0
- package/skills/core/pdf/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/skills/core/pptx/LICENSE.txt +202 -0
- package/skills/core/pptx/SKILL.md +275 -0
- package/skills/core/pptx/scripts/__init__.py +0 -0
- package/skills/core/pptx/scripts/add_slide.py +463 -0
- package/skills/core/pptx/scripts/apply_theme.js +107 -0
- package/skills/core/pptx/scripts/clean.py +309 -0
- package/skills/core/pptx/scripts/office/helpers/__init__.py +121 -0
- package/skills/core/pptx/scripts/office/helpers/pptx_chart.py +283 -0
- package/skills/core/pptx/scripts/office/helpers/pptx_slide.py +100 -0
- package/skills/core/pptx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/core/pptx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/core/pptx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/core/pptx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/core/pptx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/core/pptx/scripts/office/soffice.py +192 -0
- package/skills/core/pptx/scripts/office/validate.py +210 -0
- package/skills/core/pptx/scripts/office/validators/__init__.py +15 -0
- package/skills/core/pptx/scripts/office/validators/base.py +874 -0
- package/skills/core/pptx/scripts/office/validators/docx.py +519 -0
- package/skills/core/pptx/scripts/office/validators/pptx.py +549 -0
- package/skills/core/pptx/scripts/office/validators/redlining.py +461 -0
- package/skills/core/pptx/scripts/slide_text.py +132 -0
- package/skills/core/pptx/scripts/thumbnail.py +311 -0
- package/skills/core/xlsx/LICENSE.txt +202 -0
- package/skills/core/xlsx/SKILL.md +99 -0
- package/skills/core/xlsx/scripts/office/helpers/__init__.py +121 -0
- package/skills/core/xlsx/scripts/office/helpers/pptx_chart.py +283 -0
- package/skills/core/xlsx/scripts/office/helpers/pptx_slide.py +100 -0
- package/skills/core/xlsx/scripts/office/helpers/pptx_theme.py +114 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
- package/skills/core/xlsx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
- package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
- package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
- package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
- package/skills/core/xlsx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
- package/skills/core/xlsx/scripts/office/schemas/mce/mc.xsd +75 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
- package/skills/core/xlsx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
- package/skills/core/xlsx/scripts/office/soffice.py +192 -0
- package/skills/core/xlsx/scripts/office/validate.py +210 -0
- package/skills/core/xlsx/scripts/office/validators/__init__.py +15 -0
- package/skills/core/xlsx/scripts/office/validators/base.py +874 -0
- package/skills/core/xlsx/scripts/office/validators/docx.py +519 -0
- package/skills/core/xlsx/scripts/office/validators/pptx.py +549 -0
- package/skills/core/xlsx/scripts/office/validators/redlining.py +461 -0
- package/skills/core/xlsx/scripts/recalc.py +456 -0
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"""Find chart XML that PowerPoint refuses or repairs.
|
|
2
|
+
|
|
3
|
+
Detection only: more than one repair is usually valid, and only the author knows
|
|
4
|
+
which was meant.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import html
|
|
11
|
+
import re
|
|
12
|
+
from collections import Counter
|
|
13
|
+
from typing import Mapping
|
|
14
|
+
|
|
15
|
+
from defusedxml import ElementTree
|
|
16
|
+
from defusedxml.common import DefusedXmlException
|
|
17
|
+
|
|
18
|
+
from . import part_text
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
_CHART_PART_RE = re.compile(r"ppt/charts/chart\d+\.xml")
|
|
22
|
+
|
|
23
|
+
_GROUPING_RE = re.compile(r"""<c:grouping\b[^>]*?\bval=["'](\w+)["']""")
|
|
24
|
+
_DLBL_POS_RE = re.compile(r"""<c:dLblPos\b[^>]*?\bval=["'](\w+)["']""")
|
|
25
|
+
|
|
26
|
+
def _strip_ext_lst(text: str) -> str:
|
|
27
|
+
return _strip_outermost(text, "c:extLst")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def _strip_outermost(text: str, name: str) -> str:
|
|
31
|
+
out, cursor = [], 0
|
|
32
|
+
for lo, hi in _outermost_spans(text, name):
|
|
33
|
+
out.append(text[cursor:lo])
|
|
34
|
+
cursor = hi
|
|
35
|
+
out.append(text[cursor:])
|
|
36
|
+
return "".join(out)
|
|
37
|
+
|
|
38
|
+
_BAR_GROUP_RE = re.compile(r"<c:(bar3DChart|barChart)\b[^>]*(?<!/)>.*?</c:\1\s*>", re.DOTALL)
|
|
39
|
+
|
|
40
|
+
STACKED_GROUPINGS = frozenset({"stacked", "percentStacked"})
|
|
41
|
+
ILLEGAL_ON_STACKED = frozenset({"outEnd"})
|
|
42
|
+
LEGAL_ON_STACKED = ("ctr", "inEnd", "inBase")
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def _check_stacked_label_positions(part: str, xml: str) -> list[str]:
|
|
46
|
+
problems: list[str] = []
|
|
47
|
+
for match in _BAR_GROUP_RE.finditer(xml):
|
|
48
|
+
block = _strip_ext_lst(match.group(0))
|
|
49
|
+
group = match.group(1)
|
|
50
|
+
|
|
51
|
+
grouping = _GROUPING_RE.search(block)
|
|
52
|
+
if grouping is None or grouping.group(1) not in STACKED_GROUPINGS:
|
|
53
|
+
continue
|
|
54
|
+
|
|
55
|
+
bad = [p for p in _DLBL_POS_RE.findall(block) if p in ILLEGAL_ON_STACKED]
|
|
56
|
+
for pos in sorted(set(bad)):
|
|
57
|
+
problems.append(
|
|
58
|
+
f'{part}: {bad.count(pos)} data label(s) use dLblPos="{pos}" on a '
|
|
59
|
+
f"{grouping.group(1)} {group}; PowerPoint allows only "
|
|
60
|
+
f"{', '.join(LEGAL_ON_STACKED)} there"
|
|
61
|
+
)
|
|
62
|
+
return problems
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
_ANY_CHART_GROUP_RE = re.compile(r"<c:(\w+Chart)\b[^>]*(?<!/)>.*?</c:\1\s*>", re.DOTALL)
|
|
67
|
+
|
|
68
|
+
_AXID_RE = re.compile(
|
|
69
|
+
r"""\s*<c:axId\b[^>]*?\bval=["'](-?\d+)["']\s*(?:/>|>\s*</c:axId\s*>)"""
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
_AXIS_DECL_RE = re.compile(
|
|
73
|
+
r"""<c:(catAx|valAx|serAx|dateAx)\b[^>]*(?<!/)>\s*<c:axId\b[^>]*?\bval=["'](-?\d+)["']"""
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
AXID_LIMIT = {
|
|
77
|
+
"barChart": 2, "lineChart": 2, "areaChart": 2, "scatterChart": 2,
|
|
78
|
+
"bubbleChart": 2, "radarChart": 2, "stockChart": 2,
|
|
79
|
+
"bar3DChart": 3, "line3DChart": 3, "area3DChart": 3,
|
|
80
|
+
"surfaceChart": 3, "surface3DChart": 3,
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
AXID_MINIMUM = {
|
|
84
|
+
"barChart": 2, "lineChart": 2, "areaChart": 2, "scatterChart": 2,
|
|
85
|
+
"bubbleChart": 2, "radarChart": 2, "stockChart": 2,
|
|
86
|
+
"bar3DChart": 2, "area3DChart": 2, "surfaceChart": 2,
|
|
87
|
+
"line3DChart": 3, "surface3DChart": 3,
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _declared_axes(xml: str) -> dict[str, list[str]]:
|
|
92
|
+
axes: dict[str, list[str]] = {}
|
|
93
|
+
for kind, axid in _AXIS_DECL_RE.findall(xml):
|
|
94
|
+
axes.setdefault(kind, []).append(axid)
|
|
95
|
+
return axes
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def _canonical_ids(axes: dict[str, list[str]], limit: int) -> list[str] | None:
|
|
99
|
+
category = axes.get("catAx", []) + axes.get("dateAx", [])
|
|
100
|
+
value = axes.get("valAx", [])
|
|
101
|
+
series = axes.get("serAx", [])
|
|
102
|
+
if len(category) != 1 or len(value) != 1 or len(series) > 1:
|
|
103
|
+
return None
|
|
104
|
+
ids = [category[0], value[0]]
|
|
105
|
+
if limit >= 3 and series:
|
|
106
|
+
ids.append(series[0])
|
|
107
|
+
return ids
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def _undeclared_axes(kind: str, block: str, axes: dict[str, list[str]]) -> list[str] | None:
|
|
111
|
+
if kind not in AXID_LIMIT:
|
|
112
|
+
return None
|
|
113
|
+
ids = _AXID_RE.findall(block)
|
|
114
|
+
declared = {i for group in axes.values() for i in group}
|
|
115
|
+
if len([i for i in ids if i in declared]) >= 2:
|
|
116
|
+
return None
|
|
117
|
+
return ids
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _check_chart_axis_references(part: str, xml: str) -> list[str]:
|
|
121
|
+
axes = _declared_axes(xml)
|
|
122
|
+
problems: list[str] = []
|
|
123
|
+
declared = {i for group in axes.values() for i in group}
|
|
124
|
+
for match in _ANY_CHART_GROUP_RE.finditer(xml):
|
|
125
|
+
kind, block = match.group(1), match.group(0)
|
|
126
|
+
ids = _undeclared_axes(kind, block, axes)
|
|
127
|
+
if ids is None:
|
|
128
|
+
continue
|
|
129
|
+
if not ids:
|
|
130
|
+
problems.append(
|
|
131
|
+
f"{part}: <c:{kind}> declares no <c:axId> this part can resolve; a chart "
|
|
132
|
+
f"group needs {AXID_MINIMUM[kind]}, and PowerPoint discards one with fewer"
|
|
133
|
+
)
|
|
134
|
+
continue
|
|
135
|
+
dead = [i for i in ids if i not in declared]
|
|
136
|
+
canonical = _canonical_ids(axes, AXID_LIMIT[kind])
|
|
137
|
+
if canonical is not None and len(canonical) >= AXID_MINIMUM[kind]:
|
|
138
|
+
hint = f"Fix: point them at the axes this part declares ({', '.join(canonical)})"
|
|
139
|
+
else:
|
|
140
|
+
hint = ("Fix: the part declares several axes of a kind -- declare the "
|
|
141
|
+
"secondary axes the series expects, or drop them")
|
|
142
|
+
detail = (f"of which {', '.join(dead)} name no declared axis"
|
|
143
|
+
if dead else f"only {len(ids)} of which this part declares")
|
|
144
|
+
problems.append(
|
|
145
|
+
f"{part}: <c:{kind}> references axId {', '.join(ids)}, {detail}, "
|
|
146
|
+
f"leaving fewer than two live axes; PowerPoint discards the chart. {hint}"
|
|
147
|
+
)
|
|
148
|
+
return problems
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
def _shown(value: str) -> str:
|
|
152
|
+
return '"' + repr(value[:20])[1:-1] + '"'
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
DECIMAL_SETTINGS = (
|
|
156
|
+
"crossesAt", "max", "min", "majorUnit", "minorUnit", "logBase",
|
|
157
|
+
"forward", "backward", "intercept", "x", "y", "w", "h",
|
|
158
|
+
"splitPos", "custUnit", "pictureStackUnit",
|
|
159
|
+
)
|
|
160
|
+
_DECIMAL_SETTING_RE = re.compile(
|
|
161
|
+
rf"""<c:({"|".join(DECIMAL_SETTINGS)})\b[^<>]*?\bval=["']([^"'<>]*)["']"""
|
|
162
|
+
)
|
|
163
|
+
_DECIMAL_RE = re.compile(
|
|
164
|
+
r"[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?"
|
|
165
|
+
r"|[+-]?(inf|infinity|nan(\(\w*\))?|\u221e|1\.#(inf|qnan|snan|ind)\d*)",
|
|
166
|
+
re.IGNORECASE,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
def _check_decimal_settings(part: str, xml: str) -> list[str]:
|
|
171
|
+
problems = []
|
|
172
|
+
for name, raw in sorted(set(_DECIMAL_SETTING_RE.findall(_strip_ext_lst(xml)))):
|
|
173
|
+
value = html.unescape(raw)
|
|
174
|
+
if _DECIMAL_RE.fullmatch(value.strip()):
|
|
175
|
+
continue
|
|
176
|
+
fix = "Fix: write a plain number, or remove the element"
|
|
177
|
+
if name == "crossesAt" and value.strip() == "autoZero":
|
|
178
|
+
fix = ("Fix: leave valAxisCrossesAt: 0 out of the pptxgenjs options, the axis "
|
|
179
|
+
"crosses at zero anyway. In the XML, write "
|
|
180
|
+
'<c:crosses val="autoZero"/> or a number')
|
|
181
|
+
problems.append(
|
|
182
|
+
f"{part}: <c:{name} val={_shown(value)}> is not a number, and PowerPoint "
|
|
183
|
+
f"will offer to repair the deck. {fix}"
|
|
184
|
+
)
|
|
185
|
+
return problems
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def _local(tag: str) -> str:
|
|
189
|
+
return tag.rsplit("}", 1)[-1]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def _drawn_series(root) -> list:
|
|
193
|
+
found, to_visit = [], [root]
|
|
194
|
+
while to_visit:
|
|
195
|
+
for child in to_visit.pop():
|
|
196
|
+
name = _local(child.tag)
|
|
197
|
+
if name == "ser":
|
|
198
|
+
found.append(child)
|
|
199
|
+
elif name == "AlternateContent":
|
|
200
|
+
to_visit.extend(child[:1])
|
|
201
|
+
elif name != "extLst":
|
|
202
|
+
to_visit.append(child)
|
|
203
|
+
return found
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def _check_series_order(part: str, xml: str) -> list[str]:
|
|
207
|
+
try:
|
|
208
|
+
root = ElementTree.fromstring(xml.encode("utf-8", "surrogateescape"))
|
|
209
|
+
except (ElementTree.ParseError, DefusedXmlException, LookupError, ValueError):
|
|
210
|
+
return []
|
|
211
|
+
orders = Counter()
|
|
212
|
+
for series in _drawn_series(root):
|
|
213
|
+
own = [c.get("val", "") for c in series if _local(c.tag) == "order"]
|
|
214
|
+
if own and own[0].isascii() and own[0].isdigit():
|
|
215
|
+
orders[own[0]] += 1
|
|
216
|
+
repeated = sorted((o for o, n in orders.items() if n > 1), key=lambda o: (len(o), o))
|
|
217
|
+
if not repeated:
|
|
218
|
+
return []
|
|
219
|
+
return [
|
|
220
|
+
f"{part}: two or more series share the <c:order> value {', '.join(o[:12] for o in repeated)}, "
|
|
221
|
+
f"and PowerPoint will offer to repair the deck. Fix: number <c:order> "
|
|
222
|
+
f"(and <c:idx>) 0, 1, 2... across every series in the chart, a combo "
|
|
223
|
+
f"chart's line series carrying on from its bars"
|
|
224
|
+
]
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
PRESET_DASHES = frozenset({
|
|
228
|
+
"solid", "dot", "dash", "lgDash", "dashDot", "lgDashDot", "lgDashDotDot",
|
|
229
|
+
"sysDash", "sysDot", "sysDashDot", "sysDashDotDot",
|
|
230
|
+
})
|
|
231
|
+
_PRESET_DASH_RE = re.compile(r"""<a:prstDash\b[^<>]*?\bval=["']([^"'<>]*)["']""")
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
def _check_preset_dashes(part: str, xml: str) -> list[str]:
|
|
235
|
+
values = {html.unescape(v) for v in _PRESET_DASH_RE.findall(_strip_ext_lst(xml))}
|
|
236
|
+
return [
|
|
237
|
+
f"{part}: <a:prstDash val={_shown(value)}> is not a dash style, and PowerPoint "
|
|
238
|
+
f"will offer to repair the deck. Use one of {', '.join(sorted(PRESET_DASHES))}. "
|
|
239
|
+
f"In pptxgenjs, lineDash takes one such word for the whole chart, not an array"
|
|
240
|
+
for value in sorted(values)
|
|
241
|
+
if value.strip() not in PRESET_DASHES
|
|
242
|
+
]
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def _outermost_spans(text: str, name: str) -> list[tuple[int, int]]:
|
|
246
|
+
spans: list[tuple[int, int]] = []
|
|
247
|
+
depth = 0
|
|
248
|
+
start = 0
|
|
249
|
+
for match in re.finditer(rf"<(/?){name}\b[^<>]*?(/?)>", text):
|
|
250
|
+
closing, self_closing = match.group(1), match.group(2)
|
|
251
|
+
if self_closing:
|
|
252
|
+
continue
|
|
253
|
+
if closing:
|
|
254
|
+
if depth:
|
|
255
|
+
depth -= 1
|
|
256
|
+
if depth == 0:
|
|
257
|
+
spans.append((start, match.end()))
|
|
258
|
+
else:
|
|
259
|
+
if depth == 0:
|
|
260
|
+
start = match.start()
|
|
261
|
+
depth += 1
|
|
262
|
+
return spans
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
CHART_CHECKS = (
|
|
266
|
+
_check_stacked_label_positions,
|
|
267
|
+
_check_chart_axis_references,
|
|
268
|
+
_check_decimal_settings,
|
|
269
|
+
_check_series_order,
|
|
270
|
+
_check_preset_dashes,
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
_COMMENT_OR_PI_RE = re.compile(r"<!--.*?(?:-->|\Z)|<\?(?!xml\s).*?(?:\?>|\Z)", re.DOTALL)
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
def find_chart_problems(files: Mapping[str, bytes]) -> list[str]:
|
|
278
|
+
problems: list[str] = []
|
|
279
|
+
for part in sorted(n for n in files if _CHART_PART_RE.fullmatch(n)):
|
|
280
|
+
xml = _strip_outermost(_COMMENT_OR_PI_RE.sub("", part_text(files[part])), "mc:Fallback")
|
|
281
|
+
for check in CHART_CHECKS:
|
|
282
|
+
problems.extend(check(part, xml))
|
|
283
|
+
return problems
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Find the slide-XML defects known or predicted to make PowerPoint refuse or repair the file.
|
|
2
|
+
|
|
3
|
+
Schema errors are picked by a denylist over lxml's messages, so an unrecognised
|
|
4
|
+
error class is a miss rather than a false alarm. Animations that name a shape
|
|
5
|
+
the slide no longer has are found by reading the part.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import re
|
|
12
|
+
|
|
13
|
+
SLIDE_PART_RE = re.compile(
|
|
14
|
+
r"ppt/(slides|slideLayouts|slideMasters|notesSlides|notesMasters|handoutMasters)"
|
|
15
|
+
r"/[^/]+\.xml"
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
FATAL_SLIDE_ERRORS: tuple[tuple[re.Pattern[str], str], ...] = (
|
|
19
|
+
(
|
|
20
|
+
re.compile(r"\}tableStyleId': This element is not expected"),
|
|
21
|
+
"two <a:tableStyleId> in one <a:tblPr> (the schema allows one)",
|
|
22
|
+
),
|
|
23
|
+
(
|
|
24
|
+
re.compile(r"\}srgbClr', attribute 'val'"),
|
|
25
|
+
"a colour that is not six hex digits",
|
|
26
|
+
),
|
|
27
|
+
(
|
|
28
|
+
re.compile(r"\}txBody': Missing child element"),
|
|
29
|
+
"a <p:txBody> with no children",
|
|
30
|
+
),
|
|
31
|
+
(
|
|
32
|
+
re.compile(r"\}miter', attribute 'lim'"),
|
|
33
|
+
'a line join with lim="NaN"',
|
|
34
|
+
),
|
|
35
|
+
(
|
|
36
|
+
re.compile(r"\}uLnTx': This element is not expected"),
|
|
37
|
+
"<a:uLnTx> in a position the schema forbids",
|
|
38
|
+
),
|
|
39
|
+
(
|
|
40
|
+
re.compile(r"\}overrideClrMapping': This element is not expected"),
|
|
41
|
+
"<p:overrideClrMapping> in a position the schema forbids",
|
|
42
|
+
),
|
|
43
|
+
(
|
|
44
|
+
re.compile(r"\}nvGrpSpPr': Missing child element"),
|
|
45
|
+
"a <p:nvGrpSpPr> with no children",
|
|
46
|
+
),
|
|
47
|
+
(
|
|
48
|
+
re.compile(r"\}(?:off|ext|chOff|chExt)', attribute '\w+': '-?(?:Infinity|NaN)'"),
|
|
49
|
+
"a position or size that is not a number (check the x, y, w, h you worked out)",
|
|
50
|
+
),
|
|
51
|
+
(
|
|
52
|
+
re.compile(r"\}prstDash', attribute 'val'"),
|
|
53
|
+
"an unknown line dash style (for line.dashType try dash, sysDash or solid)",
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def is_schema_verdict(error: str) -> bool:
|
|
59
|
+
return error.startswith("Element ")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
_PML = "{http://schemas.openxmlformats.org/presentationml/2006/main}"
|
|
63
|
+
_MC = "{http://schemas.openxmlformats.org/markup-compatibility/2006}"
|
|
64
|
+
|
|
65
|
+
_NAMES_A_SHAPE = frozenset({f"{_PML}spTgt", f"{_PML}bldP", f"{_PML}bldGraphic"})
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _shape_id(value: str | None) -> int | str | None:
|
|
69
|
+
text = (value or "").strip()
|
|
70
|
+
if text.isascii() and text.isdigit() and len(text) <= 18:
|
|
71
|
+
return int(text)
|
|
72
|
+
return text or None
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def stranded_animation_targets(root) -> list[str]:
|
|
76
|
+
timing = root.find(f"{_PML}timing")
|
|
77
|
+
if timing is None:
|
|
78
|
+
timing = root.find(f"{_MC}AlternateContent/{_MC}Choice/{_PML}timing")
|
|
79
|
+
if timing is None:
|
|
80
|
+
return []
|
|
81
|
+
|
|
82
|
+
on_slide = {_shape_id(e.get("id")) for e in root.iter("{*}cNvPr")}
|
|
83
|
+
named = {_shape_id(e.get("spid")) for e in timing.iter(*_NAMES_A_SHAPE)} - {None}
|
|
84
|
+
stranded = named - on_slide
|
|
85
|
+
return [
|
|
86
|
+
f"<p:timing> animates shape id {spid if isinstance(spid, int) else repr(spid[:16])}, which is gone, so PowerPoint will "
|
|
87
|
+
f"offer to repair the deck. Fix: delete the slide's whole <p:timing> element "
|
|
88
|
+
f"(the slide loses its animations), or put the shape back"
|
|
89
|
+
for spid in sorted(stranded, key=str)
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def fatal_slide_errors(errors: set[str]) -> list[str]:
|
|
94
|
+
out = []
|
|
95
|
+
for error in sorted(errors):
|
|
96
|
+
for pattern, meaning in FATAL_SLIDE_ERRORS:
|
|
97
|
+
if pattern.search(error):
|
|
98
|
+
out.append(f"{meaning}: {error}")
|
|
99
|
+
break
|
|
100
|
+
return out
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"""Find masters sharing a theme part in the way PowerPoint refuses to open.
|
|
2
|
+
|
|
3
|
+
Reports only; the fix is to move <p:notesMasterIdLst> back to directly after
|
|
4
|
+
<p:sldIdLst> in ppt/presentation.xml.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import posixpath
|
|
11
|
+
import re
|
|
12
|
+
from typing import Mapping
|
|
13
|
+
|
|
14
|
+
from . import part_text
|
|
15
|
+
|
|
16
|
+
THEME_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"
|
|
17
|
+
|
|
18
|
+
_MASTER_RE = re.compile(
|
|
19
|
+
r"^ppt/(?P<group>slideMasters|notesMasters|handoutMasters)/"
|
|
20
|
+
r"(?:slide|notes|handout)Master(?P<num>\d+)\.xml$"
|
|
21
|
+
)
|
|
22
|
+
_GROUP_ORDER = {"slideMasters": 0, "notesMasters": 1, "handoutMasters": 2}
|
|
23
|
+
|
|
24
|
+
_RELATIONSHIP_RE = re.compile(
|
|
25
|
+
r"<Relationship\b[^>]*?(?:/>|>.*?</Relationship\s*>)", re.DOTALL
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _sort_key(name: str) -> tuple[int, int]:
|
|
30
|
+
m = _MASTER_RE.match(name)
|
|
31
|
+
assert m is not None
|
|
32
|
+
return (_GROUP_ORDER[m.group("group")], int(m.group("num")))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def _rels_path(part: str) -> str:
|
|
36
|
+
directory, base = posixpath.split(part)
|
|
37
|
+
return f"{directory}/_rels/{base}.rels"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _resolve(rels_path: str, target: str) -> str:
|
|
41
|
+
if target.startswith("/"):
|
|
42
|
+
return target.lstrip("/")
|
|
43
|
+
part_dir = posixpath.dirname(posixpath.dirname(rels_path))
|
|
44
|
+
return posixpath.normpath(posixpath.join(part_dir, target))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _theme_rel(files: Mapping[str, bytes], master: str):
|
|
48
|
+
rels_path = _rels_path(master)
|
|
49
|
+
rels = files.get(rels_path)
|
|
50
|
+
if rels is None:
|
|
51
|
+
return None
|
|
52
|
+
for element in _RELATIONSHIP_RE.findall(part_text(rels)):
|
|
53
|
+
if f'Type="{THEME_REL_TYPE}"' not in element:
|
|
54
|
+
continue
|
|
55
|
+
target = re.search(r'\bTarget="([^"]+)"', element)
|
|
56
|
+
if target is None:
|
|
57
|
+
continue
|
|
58
|
+
return rels_path, element, _resolve(rels_path, target.group(1))
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _masters(files: Mapping[str, bytes]) -> list[str]:
|
|
63
|
+
return sorted((n for n in files if _MASTER_RE.match(n)), key=_sort_key)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
_PRESENTATION = "ppt/presentation.xml"
|
|
67
|
+
_NOTES_MASTERS = "ppt/notesMasters/"
|
|
68
|
+
_IGNORABLE_RE = re.compile(r"<!--.*?-->|<\?.*?\?>", re.DOTALL)
|
|
69
|
+
_AFTER_SLDIDLST_RE = re.compile(
|
|
70
|
+
r"<p:sldIdLst\b(?:[^>]*/>|[^>]*>.*?</p:sldIdLst\s*>)\s*(<[^>\s/]+)", re.DOTALL
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _notes_master_share_is_inert(files: Mapping[str, bytes]) -> bool:
|
|
75
|
+
data = files.get(_PRESENTATION)
|
|
76
|
+
if data is None:
|
|
77
|
+
return False
|
|
78
|
+
match = _AFTER_SLDIDLST_RE.search(_IGNORABLE_RE.sub("", part_text(data)))
|
|
79
|
+
return match is not None and match.group(1) == "<p:notesMasterIdLst"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _shares(files: Mapping[str, bytes]):
|
|
83
|
+
owner: dict[str, str] = {}
|
|
84
|
+
for master in _masters(files):
|
|
85
|
+
found = _theme_rel(files, master)
|
|
86
|
+
if found is None:
|
|
87
|
+
continue
|
|
88
|
+
rels_path, element, theme = found
|
|
89
|
+
if theme not in files:
|
|
90
|
+
continue
|
|
91
|
+
if theme in owner:
|
|
92
|
+
yield master, rels_path, element, theme, owner[theme]
|
|
93
|
+
else:
|
|
94
|
+
owner[theme] = master
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def _is_inert(master: str, inert_notes: bool) -> bool:
|
|
98
|
+
return inert_notes and master.startswith(_NOTES_MASTERS)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def find_shared_master_themes(files: Mapping[str, bytes]) -> list[str]:
|
|
102
|
+
return [
|
|
103
|
+
f"{master} shares {theme} with {first}"
|
|
104
|
+
for master, _, _, theme, first in _shares(files)
|
|
105
|
+
]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def live_shared_master_themes(files: Mapping[str, bytes]) -> list[str]:
|
|
109
|
+
inert_notes = _notes_master_share_is_inert(files)
|
|
110
|
+
return [
|
|
111
|
+
f"{master} shares {theme} with {first}"
|
|
112
|
+
for master, _, _, theme, first in _shares(files)
|
|
113
|
+
if not _is_inert(master, inert_notes)
|
|
114
|
+
]
|