simple-skills 1.3.3 → 1.3.4

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 (78) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +1 -1
  3. package/skills/engineering/docx/SKILL.md +617 -0
  4. package/skills/engineering/docx/scripts/__init__.py +1 -0
  5. package/skills/engineering/docx/scripts/accept_changes.py +135 -0
  6. package/skills/engineering/docx/scripts/comment.py +318 -0
  7. package/skills/engineering/docx/scripts/office/__pycache__/soffice.cpython-314.pyc +0 -0
  8. package/skills/engineering/docx/scripts/office/helpers/__init__.py +0 -0
  9. package/skills/engineering/docx/scripts/office/helpers/__pycache__/__init__.cpython-314.pyc +0 -0
  10. package/skills/engineering/docx/scripts/office/helpers/__pycache__/merge_runs.cpython-314.pyc +0 -0
  11. package/skills/engineering/docx/scripts/office/helpers/__pycache__/simplify_redlines.cpython-314.pyc +0 -0
  12. package/skills/engineering/docx/scripts/office/helpers/merge_runs.py +199 -0
  13. package/skills/engineering/docx/scripts/office/helpers/simplify_redlines.py +197 -0
  14. package/skills/engineering/docx/scripts/office/pack.py +159 -0
  15. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chart.xsd +1499 -0
  16. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-chartDrawing.xsd +146 -0
  17. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-diagram.xsd +1085 -0
  18. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-lockedCanvas.xsd +11 -0
  19. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-main.xsd +3081 -0
  20. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-picture.xsd +23 -0
  21. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-spreadsheetDrawing.xsd +185 -0
  22. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/dml-wordprocessingDrawing.xsd +287 -0
  23. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/pml.xsd +1676 -0
  24. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-additionalCharacteristics.xsd +28 -0
  25. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-bibliography.xsd +144 -0
  26. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-commonSimpleTypes.xsd +174 -0
  27. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlDataProperties.xsd +25 -0
  28. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-customXmlSchemaProperties.xsd +18 -0
  29. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesCustom.xsd +59 -0
  30. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesExtended.xsd +56 -0
  31. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-documentPropertiesVariantTypes.xsd +195 -0
  32. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-math.xsd +582 -0
  33. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/shared-relationshipReference.xsd +25 -0
  34. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/sml.xsd +4439 -0
  35. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-main.xsd +570 -0
  36. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-officeDrawing.xsd +509 -0
  37. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-presentationDrawing.xsd +12 -0
  38. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-spreadsheetDrawing.xsd +108 -0
  39. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/vml-wordprocessingDrawing.xsd +96 -0
  40. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/wml.xsd +3646 -0
  41. package/skills/engineering/docx/scripts/office/schemas/ISO-IEC29500-4_2016/xml.xsd +116 -0
  42. package/skills/engineering/docx/scripts/office/schemas/ecma/fouth-edition/opc-contentTypes.xsd +42 -0
  43. package/skills/engineering/docx/scripts/office/schemas/ecma/fouth-edition/opc-coreProperties.xsd +50 -0
  44. package/skills/engineering/docx/scripts/office/schemas/ecma/fouth-edition/opc-digSig.xsd +49 -0
  45. package/skills/engineering/docx/scripts/office/schemas/ecma/fouth-edition/opc-relationships.xsd +33 -0
  46. package/skills/engineering/docx/scripts/office/schemas/mce/mc.xsd +75 -0
  47. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-2010.xsd +560 -0
  48. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-2012.xsd +67 -0
  49. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-2018.xsd +14 -0
  50. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-cex-2018.xsd +20 -0
  51. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-cid-2016.xsd +13 -0
  52. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-sdtdatahash-2020.xsd +4 -0
  53. package/skills/engineering/docx/scripts/office/schemas/microsoft/wml-symex-2015.xsd +8 -0
  54. package/skills/engineering/docx/scripts/office/soffice.py +183 -0
  55. package/skills/engineering/docx/scripts/office/unpack.py +132 -0
  56. package/skills/engineering/docx/scripts/office/validate.py +111 -0
  57. package/skills/engineering/docx/scripts/office/validators/__init__.py +15 -0
  58. package/skills/engineering/docx/scripts/office/validators/base.py +847 -0
  59. package/skills/engineering/docx/scripts/office/validators/docx.py +446 -0
  60. package/skills/engineering/docx/scripts/office/validators/pptx.py +275 -0
  61. package/skills/engineering/docx/scripts/office/validators/redlining.py +247 -0
  62. package/skills/engineering/docx/scripts/templates/comments.xml +3 -0
  63. package/skills/engineering/docx/scripts/templates/commentsExtended.xml +3 -0
  64. package/skills/engineering/docx/scripts/templates/commentsExtensible.xml +3 -0
  65. package/skills/engineering/docx/scripts/templates/commentsIds.xml +3 -0
  66. package/skills/engineering/docx/scripts/templates/people.xml +3 -0
  67. package/skills/engineering/theme-factory/SKILL.md +0 -63
  68. package/skills/engineering/theme-factory/theme-showcase.pdf +0 -0
  69. package/skills/engineering/theme-factory/themes/arctic-frost.md +0 -19
  70. package/skills/engineering/theme-factory/themes/botanical-garden.md +0 -19
  71. package/skills/engineering/theme-factory/themes/desert-rose.md +0 -19
  72. package/skills/engineering/theme-factory/themes/forest-canopy.md +0 -19
  73. package/skills/engineering/theme-factory/themes/golden-hour.md +0 -19
  74. package/skills/engineering/theme-factory/themes/midnight-galaxy.md +0 -19
  75. package/skills/engineering/theme-factory/themes/modern-minimalist.md +0 -19
  76. package/skills/engineering/theme-factory/themes/ocean-depths.md +0 -19
  77. package/skills/engineering/theme-factory/themes/sunset-boulevard.md +0 -19
  78. package/skills/engineering/theme-factory/themes/tech-innovation.md +0 -19
@@ -0,0 +1,275 @@
1
+ """
2
+ Validator for PowerPoint presentation XML files against XSD schemas.
3
+ """
4
+
5
+ import re
6
+
7
+ from .base import BaseSchemaValidator
8
+
9
+
10
+ class PPTXSchemaValidator(BaseSchemaValidator):
11
+
12
+ PRESENTATIONML_NAMESPACE = (
13
+ "http://schemas.openxmlformats.org/presentationml/2006/main"
14
+ )
15
+
16
+ ELEMENT_RELATIONSHIP_TYPES = {
17
+ "sldid": "slide",
18
+ "sldmasterid": "slidemaster",
19
+ "notesmasterid": "notesmaster",
20
+ "sldlayoutid": "slidelayout",
21
+ "themeid": "theme",
22
+ "tablestyleid": "tablestyles",
23
+ }
24
+
25
+ def validate(self):
26
+ if not self.validate_xml():
27
+ return False
28
+
29
+ all_valid = True
30
+ if not self.validate_namespaces():
31
+ all_valid = False
32
+
33
+ if not self.validate_unique_ids():
34
+ all_valid = False
35
+
36
+ if not self.validate_uuid_ids():
37
+ all_valid = False
38
+
39
+ if not self.validate_file_references():
40
+ all_valid = False
41
+
42
+ if not self.validate_slide_layout_ids():
43
+ all_valid = False
44
+
45
+ if not self.validate_content_types():
46
+ all_valid = False
47
+
48
+ if not self.validate_against_xsd():
49
+ all_valid = False
50
+
51
+ if not self.validate_notes_slide_references():
52
+ all_valid = False
53
+
54
+ if not self.validate_all_relationship_ids():
55
+ all_valid = False
56
+
57
+ if not self.validate_no_duplicate_slide_layouts():
58
+ all_valid = False
59
+
60
+ return all_valid
61
+
62
+ def validate_uuid_ids(self):
63
+ import lxml.etree
64
+
65
+ errors = []
66
+ uuid_pattern = re.compile(
67
+ r"^[\{\(]?[0-9A-Fa-f]{8}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{4}-?[0-9A-Fa-f]{12}[\}\)]?$"
68
+ )
69
+
70
+ for xml_file in self.xml_files:
71
+ try:
72
+ root = lxml.etree.parse(str(xml_file)).getroot()
73
+
74
+ for elem in root.iter():
75
+ for attr, value in elem.attrib.items():
76
+ attr_name = attr.split("}")[-1].lower()
77
+ if attr_name == "id" or attr_name.endswith("id"):
78
+ if self._looks_like_uuid(value):
79
+ if not uuid_pattern.match(value):
80
+ errors.append(
81
+ f" {xml_file.relative_to(self.unpacked_dir)}: "
82
+ f"Line {elem.sourceline}: ID '{value}' appears to be a UUID but contains invalid hex characters"
83
+ )
84
+
85
+ except (lxml.etree.XMLSyntaxError, Exception) as e:
86
+ errors.append(
87
+ f" {xml_file.relative_to(self.unpacked_dir)}: Error: {e}"
88
+ )
89
+
90
+ if errors:
91
+ print(f"FAILED - Found {len(errors)} UUID ID validation errors:")
92
+ for error in errors:
93
+ print(error)
94
+ return False
95
+ else:
96
+ if self.verbose:
97
+ print("PASSED - All UUID-like IDs contain valid hex values")
98
+ return True
99
+
100
+ def _looks_like_uuid(self, value):
101
+ clean_value = value.strip("{}()").replace("-", "")
102
+ return len(clean_value) == 32 and all(c.isalnum() for c in clean_value)
103
+
104
+ def validate_slide_layout_ids(self):
105
+ import lxml.etree
106
+
107
+ errors = []
108
+
109
+ slide_masters = list(self.unpacked_dir.glob("ppt/slideMasters/*.xml"))
110
+
111
+ if not slide_masters:
112
+ if self.verbose:
113
+ print("PASSED - No slide masters found")
114
+ return True
115
+
116
+ for slide_master in slide_masters:
117
+ try:
118
+ root = lxml.etree.parse(str(slide_master)).getroot()
119
+
120
+ rels_file = slide_master.parent / "_rels" / f"{slide_master.name}.rels"
121
+
122
+ if not rels_file.exists():
123
+ errors.append(
124
+ f" {slide_master.relative_to(self.unpacked_dir)}: "
125
+ f"Missing relationships file: {rels_file.relative_to(self.unpacked_dir)}"
126
+ )
127
+ continue
128
+
129
+ rels_root = lxml.etree.parse(str(rels_file)).getroot()
130
+
131
+ valid_layout_rids = set()
132
+ for rel in rels_root.findall(
133
+ f".//{{{self.PACKAGE_RELATIONSHIPS_NAMESPACE}}}Relationship"
134
+ ):
135
+ rel_type = rel.get("Type", "")
136
+ if "slideLayout" in rel_type:
137
+ valid_layout_rids.add(rel.get("Id"))
138
+
139
+ for sld_layout_id in root.findall(
140
+ f".//{{{self.PRESENTATIONML_NAMESPACE}}}sldLayoutId"
141
+ ):
142
+ r_id = sld_layout_id.get(
143
+ f"{{{self.OFFICE_RELATIONSHIPS_NAMESPACE}}}id"
144
+ )
145
+ layout_id = sld_layout_id.get("id")
146
+
147
+ if r_id and r_id not in valid_layout_rids:
148
+ errors.append(
149
+ f" {slide_master.relative_to(self.unpacked_dir)}: "
150
+ f"Line {sld_layout_id.sourceline}: sldLayoutId with id='{layout_id}' "
151
+ f"references r:id='{r_id}' which is not found in slide layout relationships"
152
+ )
153
+
154
+ except (lxml.etree.XMLSyntaxError, Exception) as e:
155
+ errors.append(
156
+ f" {slide_master.relative_to(self.unpacked_dir)}: Error: {e}"
157
+ )
158
+
159
+ if errors:
160
+ print(f"FAILED - Found {len(errors)} slide layout ID validation errors:")
161
+ for error in errors:
162
+ print(error)
163
+ print(
164
+ "Remove invalid references or add missing slide layouts to the relationships file."
165
+ )
166
+ return False
167
+ else:
168
+ if self.verbose:
169
+ print("PASSED - All slide layout IDs reference valid slide layouts")
170
+ return True
171
+
172
+ def validate_no_duplicate_slide_layouts(self):
173
+ import lxml.etree
174
+
175
+ errors = []
176
+ slide_rels_files = list(self.unpacked_dir.glob("ppt/slides/_rels/*.xml.rels"))
177
+
178
+ for rels_file in slide_rels_files:
179
+ try:
180
+ root = lxml.etree.parse(str(rels_file)).getroot()
181
+
182
+ layout_rels = [
183
+ rel
184
+ for rel in root.findall(
185
+ f".//{{{self.PACKAGE_RELATIONSHIPS_NAMESPACE}}}Relationship"
186
+ )
187
+ if "slideLayout" in rel.get("Type", "")
188
+ ]
189
+
190
+ if len(layout_rels) > 1:
191
+ errors.append(
192
+ f" {rels_file.relative_to(self.unpacked_dir)}: has {len(layout_rels)} slideLayout references"
193
+ )
194
+
195
+ except Exception as e:
196
+ errors.append(
197
+ f" {rels_file.relative_to(self.unpacked_dir)}: Error: {e}"
198
+ )
199
+
200
+ if errors:
201
+ print("FAILED - Found slides with duplicate slideLayout references:")
202
+ for error in errors:
203
+ print(error)
204
+ return False
205
+ else:
206
+ if self.verbose:
207
+ print("PASSED - All slides have exactly one slideLayout reference")
208
+ return True
209
+
210
+ def validate_notes_slide_references(self):
211
+ import lxml.etree
212
+
213
+ errors = []
214
+ notes_slide_references = {}
215
+
216
+ slide_rels_files = list(self.unpacked_dir.glob("ppt/slides/_rels/*.xml.rels"))
217
+
218
+ if not slide_rels_files:
219
+ if self.verbose:
220
+ print("PASSED - No slide relationship files found")
221
+ return True
222
+
223
+ for rels_file in slide_rels_files:
224
+ try:
225
+ root = lxml.etree.parse(str(rels_file)).getroot()
226
+
227
+ for rel in root.findall(
228
+ f".//{{{self.PACKAGE_RELATIONSHIPS_NAMESPACE}}}Relationship"
229
+ ):
230
+ rel_type = rel.get("Type", "")
231
+ if "notesSlide" in rel_type:
232
+ target = rel.get("Target", "")
233
+ if target:
234
+ normalized_target = target.replace("../", "")
235
+
236
+ slide_name = rels_file.stem.replace(
237
+ ".xml", ""
238
+ )
239
+
240
+ if normalized_target not in notes_slide_references:
241
+ notes_slide_references[normalized_target] = []
242
+ notes_slide_references[normalized_target].append(
243
+ (slide_name, rels_file)
244
+ )
245
+
246
+ except (lxml.etree.XMLSyntaxError, Exception) as e:
247
+ errors.append(
248
+ f" {rels_file.relative_to(self.unpacked_dir)}: Error: {e}"
249
+ )
250
+
251
+ for target, references in notes_slide_references.items():
252
+ if len(references) > 1:
253
+ slide_names = [ref[0] for ref in references]
254
+ errors.append(
255
+ f" Notes slide '{target}' is referenced by multiple slides: {', '.join(slide_names)}"
256
+ )
257
+ for slide_name, rels_file in references:
258
+ errors.append(f" - {rels_file.relative_to(self.unpacked_dir)}")
259
+
260
+ if errors:
261
+ print(
262
+ f"FAILED - Found {len([e for e in errors if not e.startswith(' ')])} notes slide reference validation errors:"
263
+ )
264
+ for error in errors:
265
+ print(error)
266
+ print("Each slide may optionally have its own slide file.")
267
+ return False
268
+ else:
269
+ if self.verbose:
270
+ print("PASSED - All notes slide references are unique")
271
+ return True
272
+
273
+
274
+ if __name__ == "__main__":
275
+ raise RuntimeError("This module should not be run directly.")
@@ -0,0 +1,247 @@
1
+ """
2
+ Validator for tracked changes in Word documents.
3
+ """
4
+
5
+ import subprocess
6
+ import tempfile
7
+ import zipfile
8
+ from pathlib import Path
9
+
10
+
11
+ class RedliningValidator:
12
+
13
+ def __init__(self, unpacked_dir, original_docx, verbose=False, author="Opencode"):
14
+ self.unpacked_dir = Path(unpacked_dir)
15
+ self.original_docx = Path(original_docx)
16
+ self.verbose = verbose
17
+ self.author = author
18
+ self.namespaces = {
19
+ "w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
20
+ }
21
+
22
+ def repair(self) -> int:
23
+ return 0
24
+
25
+ def validate(self):
26
+ modified_file = self.unpacked_dir / "word" / "document.xml"
27
+ if not modified_file.exists():
28
+ print(f"FAILED - Modified document.xml not found at {modified_file}")
29
+ return False
30
+
31
+ try:
32
+ import xml.etree.ElementTree as ET
33
+
34
+ tree = ET.parse(modified_file)
35
+ root = tree.getroot()
36
+
37
+ del_elements = root.findall(".//w:del", self.namespaces)
38
+ ins_elements = root.findall(".//w:ins", self.namespaces)
39
+
40
+ author_del_elements = [
41
+ elem
42
+ for elem in del_elements
43
+ if elem.get(f"{{{self.namespaces['w']}}}author") == self.author
44
+ ]
45
+ author_ins_elements = [
46
+ elem
47
+ for elem in ins_elements
48
+ if elem.get(f"{{{self.namespaces['w']}}}author") == self.author
49
+ ]
50
+
51
+ if not author_del_elements and not author_ins_elements:
52
+ if self.verbose:
53
+ print(f"PASSED - No tracked changes by {self.author} found.")
54
+ return True
55
+
56
+ except Exception:
57
+ pass
58
+
59
+ with tempfile.TemporaryDirectory() as temp_dir:
60
+ temp_path = Path(temp_dir)
61
+
62
+ try:
63
+ with zipfile.ZipFile(self.original_docx, "r") as zip_ref:
64
+ zip_ref.extractall(temp_path)
65
+ except Exception as e:
66
+ print(f"FAILED - Error unpacking original docx: {e}")
67
+ return False
68
+
69
+ original_file = temp_path / "word" / "document.xml"
70
+ if not original_file.exists():
71
+ print(
72
+ f"FAILED - Original document.xml not found in {self.original_docx}"
73
+ )
74
+ return False
75
+
76
+ try:
77
+ import xml.etree.ElementTree as ET
78
+
79
+ modified_tree = ET.parse(modified_file)
80
+ modified_root = modified_tree.getroot()
81
+ original_tree = ET.parse(original_file)
82
+ original_root = original_tree.getroot()
83
+ except ET.ParseError as e:
84
+ print(f"FAILED - Error parsing XML files: {e}")
85
+ return False
86
+
87
+ self._remove_author_tracked_changes(original_root)
88
+ self._remove_author_tracked_changes(modified_root)
89
+
90
+ modified_text = self._extract_text_content(modified_root)
91
+ original_text = self._extract_text_content(original_root)
92
+
93
+ if modified_text != original_text:
94
+ error_message = self._generate_detailed_diff(
95
+ original_text, modified_text
96
+ )
97
+ print(error_message)
98
+ return False
99
+
100
+ if self.verbose:
101
+ print(f"PASSED - All changes by {self.author} are properly tracked")
102
+ return True
103
+
104
+ def _generate_detailed_diff(self, original_text, modified_text):
105
+ error_parts = [
106
+ f"FAILED - Document text doesn't match after removing {self.author}'s tracked changes",
107
+ "",
108
+ "Likely causes:",
109
+ " 1. Modified text inside another author's <w:ins> or <w:del> tags",
110
+ " 2. Made edits without proper tracked changes",
111
+ " 3. Didn't nest <w:del> inside <w:ins> when deleting another's insertion",
112
+ "",
113
+ "For pre-redlined documents, use correct patterns:",
114
+ " - To reject another's INSERTION: Nest <w:del> inside their <w:ins>",
115
+ " - To restore another's DELETION: Add new <w:ins> AFTER their <w:del>",
116
+ "",
117
+ ]
118
+
119
+ git_diff = self._get_git_word_diff(original_text, modified_text)
120
+ if git_diff:
121
+ error_parts.extend(["Differences:", "============", git_diff])
122
+ else:
123
+ error_parts.append("Unable to generate word diff (git not available)")
124
+
125
+ return "\n".join(error_parts)
126
+
127
+ def _get_git_word_diff(self, original_text, modified_text):
128
+ try:
129
+ with tempfile.TemporaryDirectory() as temp_dir:
130
+ temp_path = Path(temp_dir)
131
+
132
+ original_file = temp_path / "original.txt"
133
+ modified_file = temp_path / "modified.txt"
134
+
135
+ original_file.write_text(original_text, encoding="utf-8")
136
+ modified_file.write_text(modified_text, encoding="utf-8")
137
+
138
+ result = subprocess.run(
139
+ [
140
+ "git",
141
+ "diff",
142
+ "--word-diff=plain",
143
+ "--word-diff-regex=.",
144
+ "-U0",
145
+ "--no-index",
146
+ str(original_file),
147
+ str(modified_file),
148
+ ],
149
+ capture_output=True,
150
+ text=True,
151
+ )
152
+
153
+ if result.stdout.strip():
154
+ lines = result.stdout.split("\n")
155
+ content_lines = []
156
+ in_content = False
157
+ for line in lines:
158
+ if line.startswith("@@"):
159
+ in_content = True
160
+ continue
161
+ if in_content and line.strip():
162
+ content_lines.append(line)
163
+
164
+ if content_lines:
165
+ return "\n".join(content_lines)
166
+
167
+ result = subprocess.run(
168
+ [
169
+ "git",
170
+ "diff",
171
+ "--word-diff=plain",
172
+ "-U0",
173
+ "--no-index",
174
+ str(original_file),
175
+ str(modified_file),
176
+ ],
177
+ capture_output=True,
178
+ text=True,
179
+ )
180
+
181
+ if result.stdout.strip():
182
+ lines = result.stdout.split("\n")
183
+ content_lines = []
184
+ in_content = False
185
+ for line in lines:
186
+ if line.startswith("@@"):
187
+ in_content = True
188
+ continue
189
+ if in_content and line.strip():
190
+ content_lines.append(line)
191
+ return "\n".join(content_lines)
192
+
193
+ except (subprocess.CalledProcessError, FileNotFoundError, Exception):
194
+ pass
195
+
196
+ return None
197
+
198
+ def _remove_author_tracked_changes(self, root):
199
+ ins_tag = f"{{{self.namespaces['w']}}}ins"
200
+ del_tag = f"{{{self.namespaces['w']}}}del"
201
+ author_attr = f"{{{self.namespaces['w']}}}author"
202
+
203
+ for parent in root.iter():
204
+ to_remove = []
205
+ for child in parent:
206
+ if child.tag == ins_tag and child.get(author_attr) == self.author:
207
+ to_remove.append(child)
208
+ for elem in to_remove:
209
+ parent.remove(elem)
210
+
211
+ deltext_tag = f"{{{self.namespaces['w']}}}delText"
212
+ t_tag = f"{{{self.namespaces['w']}}}t"
213
+
214
+ for parent in root.iter():
215
+ to_process = []
216
+ for child in parent:
217
+ if child.tag == del_tag and child.get(author_attr) == self.author:
218
+ to_process.append((child, list(parent).index(child)))
219
+
220
+ for del_elem, del_index in reversed(to_process):
221
+ for elem in del_elem.iter():
222
+ if elem.tag == deltext_tag:
223
+ elem.tag = t_tag
224
+
225
+ for child in reversed(list(del_elem)):
226
+ parent.insert(del_index, child)
227
+ parent.remove(del_elem)
228
+
229
+ def _extract_text_content(self, root):
230
+ p_tag = f"{{{self.namespaces['w']}}}p"
231
+ t_tag = f"{{{self.namespaces['w']}}}t"
232
+
233
+ paragraphs = []
234
+ for p_elem in root.findall(f".//{p_tag}"):
235
+ text_parts = []
236
+ for t_elem in p_elem.findall(f".//{t_tag}"):
237
+ if t_elem.text:
238
+ text_parts.append(t_elem.text)
239
+ paragraph_text = "".join(text_parts)
240
+ if paragraph_text:
241
+ paragraphs.append(paragraph_text)
242
+
243
+ return "\n".join(paragraphs)
244
+
245
+
246
+ if __name__ == "__main__":
247
+ raise RuntimeError("This module should not be run directly.")
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" ?>
2
+ <w:comments xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14">
3
+ </w:comments>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" ?>
2
+ <w15:commentsEx xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14">
3
+ </w15:commentsEx>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" ?>
2
+ <w16cex:commentsExtensible xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:cr="http://schemas.microsoft.com/office/comments/2020/reactions" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl cr w16du wp14">
3
+ </w16cex:commentsExtensible>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" ?>
2
+ <w16cid:commentsIds xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16du="http://schemas.microsoft.com/office/word/2023/wordml/word16du" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16sdtfl="http://schemas.microsoft.com/office/word/2024/wordml/sdtformatlock" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh w16sdtfl w16du wp14">
3
+ </w16cid:commentsIds>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" ?>
2
+ <w15:people xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml">
3
+ </w15:people>
@@ -1,63 +0,0 @@
1
- ---
2
- name: theme-factory
3
- description: 用于使用主题样式化各种工件的工具包。这些工件可以是幻灯片、文档、报告、HTML 着陆页等。有 10 个预设的颜色/字体主题,可以应用于任何已创建的工件,或者可以即时生成新主题。
4
- license: Complete terms in LICENSE.txt
5
- ---
6
-
7
-
8
- # 主题工厂技能
9
-
10
- 此技能提供经过策划的专业字体和颜色主题集合,每个主题都有精心选择的调色板和字体配对。选择主题后,可以将其应用于任何工件。
11
-
12
- ## 用途
13
-
14
- 要将一致的、专业的样式应用于演示幻灯片组,使用此技能。每个主题包括:
15
-
16
- - 带有十六进制代码的凝聚调色板
17
- - 标题和正文文本的互补字体配对
18
- - 适合不同上下文和受众的独特视觉身份
19
-
20
- ## 使用说明
21
-
22
- 要将样式应用于幻灯片组或其他工件:
23
-
24
- 1. **展示主题展示**:显示 `theme-showcase.pdf` 文件以让用户看到所有可用的主题视觉。不要对其进行任何修改;仅展示文件供查看。
25
- 2. **询问选择**:询问要应用哪个主题到幻灯片组
26
- 3. **等待选择**:获得关于所选主题的明确确认
27
- 4. **应用主题**:一旦选择主题,将所选主题的颜色和字体应用于幻灯片组/工件
28
-
29
- ## 可用主题
30
-
31
- 以下是 10 个可用主题,每个主题都在 `theme-showcase.pdf` 中展示:
32
-
33
- 1. **海洋深处** - 专业且舒缓的海洋主题
34
- 2. **日落大道** - 温暖且充满活力的日落颜色
35
- 3. **森林树冠** - 自然且踏实的大地色调
36
- 4. **现代极简** - 干净且当代的灰度
37
- 5. **黄金时刻** - 丰富且温暖的秋季调色板
38
- 6. **北极霜** - 凉爽且 crisp 的冬季灵感主题
39
- 7. **沙漠玫瑰** - 柔和且精致的粉色调
40
- 8. **技术创新** - 大胆且现代的科技美学
41
- 9. **植物园** - 新鲜且有机的花园颜色
42
- 10. **午夜银河** - 戏剧性且宇宙般的深色调
43
-
44
- ## 主题详情
45
-
46
- 每个主题都在 `themes/` 目录中定义,具有完整的规范,包括:
47
-
48
- - 带有十六进制代码的凝聚调色板
49
- - 标题和正文文本的互补字体配对
50
- - 适合不同上下文和受众的独特视觉身份
51
-
52
- ## 应用过程
53
-
54
- 选择首选主题后:
55
-
56
- 1. 从 `themes/` 目录读取相应的主题文件
57
- 2. 将整个幻灯片组一致地应用指定的颜色和字体
58
- 3. 确保适当的对比度和可读性
59
- 4. 在所有幻灯片上保持主题的视觉身份
60
-
61
- ## 创建自己的主题
62
-
63
- 要处理现有主题都不适用于工件的情况,创建自定义主题。根据提供的输入,生成与上述主题相似的新主题。给主题一个类似的名称,描述字体/颜色组合代表什么。使用提供的基本描述选择合适的颜色/字体。生成主题后,展示它以供审查和验证。之后,按照上述说明应用主题。
@@ -1,19 +0,0 @@
1
- # Arctic Frost
2
-
3
- A cool and crisp winter-inspired theme that conveys clarity, precision, and professionalism.
4
-
5
- ## Color Palette
6
-
7
- - **Ice Blue**: `#d4e4f7` - Light backgrounds and highlights
8
- - **Steel Blue**: `#4a6fa5` - Primary accent color
9
- - **Silver**: `#c0c0c0` - Metallic accent elements
10
- - **Crisp White**: `#fafafa` - Clean backgrounds and text
11
-
12
- ## Typography
13
-
14
- - **Headers**: DejaVu Sans Bold
15
- - **Body Text**: DejaVu Sans
16
-
17
- ## Best Used For
18
-
19
- Healthcare presentations, technology solutions, winter sports, clean tech, pharmaceutical content.