def use.expand

gralha-svg-render@0.1.0.1 · svg.bend:2793

import gralha-svg-render@0.1.0.1/svg.bend as Svg
import Base
import gralha-text-scan@0.1.0.1/scan.bend as U
import gralha-xml-doc@0.1.0.1/xml.bend as XML
import gralha-css-style@0.1.0.1/css.bend as CSS

2793def use.expand(+fuel: Nat, +xs: List<&2, XML.Element>, +all: List<&2, XML.Element>, +ancestors: List<&2, String>) -> List<&2, XML.Element>:
2794  match fuel xs:
2795    case 0n _: Nil{}
2796    case 1n+d Nil{}: Nil{}
2797    case 1n+d Con{XML.Element{n, attrs, kids, txt}, rest}:
2798      +as = attrs
2799      +tagname = n
2800      +parents = {Con{XML.attr.get(as, "id", ""), ancestors} : List<&2, String>}
2801      Con{XML.Element{tagname, as, U.branch(List<&2, XML.Element>, U.string.equal(tagname, "use"),
2802        _ => use.children(CSS.properties(as), all, parents, nodes => use.expand(d, nodes, all, parents)),
2803        _ => use.expand(fuel, kids, U.choose(List<&2, XML.Element>, U.string.equal(tagname, "#svg-image"), kids, all), U.choose(List<&2, String>, U.string.equal(tagname, "#svg-image"), Nil{}, parents))), txt}, use.expand(fuel, rest, all, ancestors)}

Uses (10)

Used by (1)