mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 22:33:33 +00:00
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:
@@ -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"]
|
||||||
|
|||||||
Reference in New Issue
Block a user