mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
@@ -310,10 +310,13 @@ class SheetBuilder:
|
|||||||
brackets_level -= 1
|
brackets_level -= 1
|
||||||
text += l
|
text += l
|
||||||
|
|
||||||
# replace urls url(#marker) with url(#prefix-marker)
|
def replace_urls(text):
|
||||||
# since url(#marker.prefix) doesn't seem to work
|
"""replace urls `url(#marker)` with `url(#prefix-marker)`
|
||||||
text = re.sub(r"url\(#([^\)]+)\)", rf"url(#{prefix}-\1)", text)
|
since `url(#marker.prefix)` doesn't seem to work
|
||||||
style.text = text
|
"""
|
||||||
|
return re.sub(r"url\(#([^\)]+)\)", rf"url(#{prefix}-\1)", text)
|
||||||
|
|
||||||
|
style.text = replace_urls(text)
|
||||||
|
|
||||||
for svg_element in svg.findall(f".//*"):
|
for svg_element in svg.findall(f".//*"):
|
||||||
if svg_element.tag in (f"{SVG}style", f"{SVG}svg"):
|
if svg_element.tag in (f"{SVG}style", f"{SVG}svg"):
|
||||||
@@ -325,6 +328,9 @@ class SheetBuilder:
|
|||||||
# add class "prefix" to all classes
|
# add class "prefix" to all classes
|
||||||
if "class" in attrib:
|
if "class" in attrib:
|
||||||
attrib["class"] += f" {prefix}"
|
attrib["class"] += f" {prefix}"
|
||||||
|
if "filter" in attrib:
|
||||||
|
# example use "#fill-background" filter
|
||||||
|
attrib["filter"] = replace_urls(attrib["filter"])
|
||||||
if svg_element.tag == f"{SVG}use":
|
if svg_element.tag == f"{SVG}use":
|
||||||
href_attrib = f"{XLINK}href"
|
href_attrib = f"{XLINK}href"
|
||||||
if href_attrib in attrib:
|
if href_attrib in attrib:
|
||||||
|
|||||||
Reference in New Issue
Block a user