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 self.height = self.raw_height * self.svg_scale
def add_stylesheet(self): def add_stylesheet(self):
path = self.resource_paths["Stylesheet"] paths = self.resource_paths["Stylesheet"]
if not path: if not paths:
return return
if not os.path.exists(path): path_list = [p.strip() for p in paths.split(',')]
print(f"WARNING. Couldn't find stylesheet for the drawing by the path: {path}") for path in path_list:
return if not os.path.exists(path):
with open(path, "r") as stylesheet: print(f"WARNING. Couldn't find stylesheet for the drawing by the path: {path}")
self.svg.defs.add(self.svg.style(stylesheet.read())) continue
with open(path, "r") as stylesheet:
self.svg.defs.add(self.svg.style(stylesheet.read()))
def add_markers(self): def add_markers(self):
path = self.resource_paths["Markers"] path = self.resource_paths["Markers"]