close #3451: support comma-separated stylesheet paths

Enable multiple CSS files in stylesheet_path using comma separation.
Files are loaded in order with natural CSS cascading behavior.

Example: "base.css, overrides.css"
This commit is contained in:
Ryan Schultz
2026-01-03 18:10:21 -06:00
parent 4874f7770b
commit cb08191083
@@ -257,14 +257,16 @@ class SvgWriter:
self.height = self.raw_height * self.svg_scale
def add_stylesheet(self):
path = self.resource_paths["Stylesheet"]
if not path:
paths = self.resource_paths["Stylesheet"]
if not paths:
return
if not os.path.exists(path):
print(f"WARNING. Couldn't find stylesheet for the drawing by the path: {path}")
return
with open(path, "r") as stylesheet:
self.svg.defs.add(self.svg.style(stylesheet.read()))
path_list = [p.strip() for p in paths.split(',')]
for path in path_list:
if not os.path.exists(path):
print(f"WARNING. Couldn't find stylesheet for the drawing by the path: {path}")
continue
with open(path, "r") as stylesheet:
self.svg.defs.add(self.svg.style(stylesheet.read()))
def add_markers(self):
path = self.resource_paths["Markers"]