diff --git a/hy_base/xml.hy b/hy_base/xml.hy index 211abde..98cff1b 100644 --- a/hy_base/xml.hy +++ b/hy_base/xml.hy @@ -38,8 +38,10 @@ (setv subchildren (get child "children")) (if subchildren (xmlchild new_parent subchildren)))))) -(defn xmln [tag &optional attrs children text] - "XMLNode with default children, not attributes" - (setv children (or (if text [text] children) [])) - {"tag" tag "attrs" (or attrs {}) "children" children} -) +(defn xmln [tag &optional attrs children] + "XMLNode with optional attributes or children, defaults according to second + argument type or empty dict and list" + (if (and attrs (not children)) + (if (instance? list attrs) + (do (setv children attrs) (setv attrs {})))) + {"tag" tag "attrs" (or attrs {}) "children" (or children [])})