def css.sheets
gralha-css-style@0.1.0.1 · css.bend:382
import gralha-css-style@0.1.0.1/css.bend as Css
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
382def css.sheets(+xs: List<&2, XML.Element>, +w: F32, +h: F32) -> String:
383 match xs:
384 case Nil{}: ""
385 case Con{XML.Element{n, as, kids, txt}, rest}:
386 +nodes = kids
387 U.branch(String, U.string.equal(n, "style"),
388 _ => U.choose(String, U.string.equal(css.lower(XML.attr.get(as, "type", "text/css")), "text/css") && css.media(XML.attr.get(as, "media", ""), w, h), css.text(nodes), ""),
389 _ => css.sheets(nodes, w, h)) ++ "\n" ++ css.sheets(rest, w, h)