[REF]Hy base : finalize fns over macros

This commit is contained in:
Fabien BOURGEOIS 2019-09-22 10:41:17 +02:00
parent c45d527fff
commit 82fd49a5e5
2 changed files with 0 additions and 22 deletions

View File

@ -17,7 +17,6 @@
" Odoo XML macros "
(require [odoo.addons.hy_base.xml [*]])
(import [odoo.addons.hy_base.xml [*]])
(defmacro if-python2 [python2-form python3-form]

View File

@ -43,24 +43,3 @@
(setv children (or (if text [text] children) []))
{"tag" tag "attrs" (or attrs {}) "children" children}
)
(defmacro xmlnc [&rest args]
"XMLNode with default children, not attributes"
(cond [(= (len args) 1) (setv tag (first args) attrs {} children [])]
[(= (len args) 2) (setv tag (first args) attrs {} children (last args))]
[(= (len args) 3) (setv tag (first args) attrs (get args 1) children (last args))])
`{"tag" ~tag "attrs" ~attrs "children" ~children})
(defmacro xmlna [&rest args]
"XMLNode with default attributes, not children"
(cond [(= (len args) 1) (setv tag (first args) attrs {} children [])]
[(= (len args) 2) (setv tag (first args) attrs (last args) children [])]
[(= (len args) 3) (setv tag (first args) attrs (get args 1) children (last args))])
`{"tag" ~tag "attrs" ~attrs "children" ~children})
(defmacro xmlnt [&rest args]
"XMLNode with no child but maybe some text"
(cond [(= (len args) 1) (setv tag (first args) attrs {} text "")]
[(= (len args) 2) (setv tag (first args) attrs {} text (last args))]
[(= (len args) 3) (setv tag (first args) attrs (get args 1) text (last args))])
`(xmln ~tag ~attrs [~text]))