Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(checker): look for @import only in CSS, not in visible slide text

hugohe3923a5360d73e
diff --git a/skills/ppt-master/scripts/svg_quality/svg_contracts.py b/skills/ppt-master/scripts/svg_quality/svg_contracts.py
index b4dee0a8..db39f921 100644
--- a/skills/ppt-master/scripts/svg_quality/svg_contracts.py
+++ b/skills/ppt-master/scripts/svg_quality/svg_contracts.py
@@ -229,7 +229,12 @@ def check_forbidden_elements(
result['errors'].append("Detected forbidden xml-stylesheet (external CSS references forbidden)")
if re.search(r'<link[^>]*rel\s*=\s*["\']stylesheet["\']', content_lower):
result['errors'].append("Detected forbidden <link rel=\"stylesheet\"> (external CSS references forbidden)")
- if re.search(r'@import\s+', content_lower):
+ # CSS only: a code slide whose visible text shows "@import url(...)" is fine.
+ css_text = " ".join(
+ "".join(elem.itertext()) if _local_name(elem).lower() == "style" else elem.get("style", "")
+ for elem in elems
+ )
+ if re.search(r'@import\s+', css_text.lower()):
result['errors'].append("Detected forbidden @import (external CSS references forbidden)")
if _validate_inline_geometry_properties is None:
result['warnings'].append(
diff --git a/skills/ppt-master/scripts/tests/test_svg_quality_checker.py b/skills/ppt-master/scripts/tests/test_svg_quality_checker.py
index 46f19463..00102c8e 100644
--- a/skills/ppt-master/scripts/tests/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/tests/test_svg_quality_checker.py
@@ -501,10 +501,11 @@ class ForbiddenAttributeTests(unittest.TestCase):
def test_text_and_data_attributes_are_not_forbidden_attributes(self) -> None:
for body in ('<g data-class="content"/>', "<text>class=Customer</text>",
- "<text>onload=initialize</text>"):
+ "<text>onload=initialize</text>", "<text>@import url(theme.css);</text>"):
with self.subTest(body=body):
self.assertEqual(self._errors(body), [])
def test_real_class_and_event_attributes_still_fail(self) -> None:
self.assertTrue(self._errors('<g class="a"/>'))
self.assertTrue(self._errors('<rect onclick="x()"/>'))
+ self.assertTrue(self._errors("<style>@import url(theme.css);</style>"))