Css.css.tree: def of gralha-css-style@0.1.0.1 Import: import gralha-css-style@0.1.0.1/css.bend as Css Lines 451-462 of gralha-css-style@0.1.0.1/css.bend: https://jend.leeeet.dev/read.txt?path=gralha-css-style@0.1.0.1/css.bend&start_line=451&end_line=462 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 def css.tree(+xs: List<&2, XML.Element>, +rules: List<&2, CSSRule>, +parents: List<&2, CSSContext>, +previous: List<&2, CSSContext>, +index: U32, +count: U32) -> List<&2, XML.Element>: match xs: case Nil{}: Nil{} case Con{XML.Element{n, as, kids, txt}, rest}: +tagname = n +children = kids +node = {XML.Element{tagname, as, children, txt} : XML.Element} +context = {CSSContext{node, parents, previous, index, count} : CSSContext} U.branch(List<&2, XML.Element>, U.string.equal(tagname, "#text"), _ => Con{node, css.tree(rest, rules, parents, previous, index, count)}, _ => Con{XML.Element{tagname, css.styled(context, rules), css.tree(children, rules, Con{context, parents}, Nil{}, 1, css.element.count(children)), txt}, css.tree(rest, rules, parents, Con{context, previous}, U32.inc(index), count)}) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.inc https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=CSSContext https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=CSSRule https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.element.count https://jend.leeeet.dev/definition.txt?path=gralha-css-style@0.1.0.1/css.bend&name=css.styled https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=branch https://jend.leeeet.dev/definition.txt?path=gralha-text-scan@0.1.0.1/scan.bend&name=string.equal https://jend.leeeet.dev/definition.txt?path=gralha-xml-doc@0.1.0.1/xml.bend&name=Element