We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf0c406 commit 051df1bCopy full SHA for 051df1b
cairosvg/defs.py
@@ -29,12 +29,15 @@
29
}
30
31
32
-def update_def_href(surface, def_name, def_dict):
+def update_def_href(surface, def_name, def_dict, chain=None):
33
"""Update the attributes of the def according to its href attribute."""
34
def_node = def_dict[def_name]
35
href = parse_url(def_node.get_href()).fragment
36
- if href in def_dict:
37
- update_def_href(surface, href, def_dict)
+ if chain is None:
+ chain = set()
38
+ if href in def_dict and href not in chain:
39
+ chain.add(href)
40
+ update_def_href(surface, href, def_dict, chain)
41
href_node = def_dict[href]
42
def_dict[def_name] = Tree(
43
url=f'#{def_name}', url_fetcher=def_node.url_fetcher,
0 commit comments