[REF]Hy base : finalize fns over macros
This commit is contained in:
parent
c45d527fff
commit
82fd49a5e5
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
" Odoo XML macros "
|
" Odoo XML macros "
|
||||||
|
|
||||||
(require [odoo.addons.hy_base.xml [*]])
|
|
||||||
(import [odoo.addons.hy_base.xml [*]])
|
(import [odoo.addons.hy_base.xml [*]])
|
||||||
|
|
||||||
(defmacro if-python2 [python2-form python3-form]
|
(defmacro if-python2 [python2-form python3-form]
|
||||||
|
@ -43,24 +43,3 @@
|
|||||||
(setv children (or (if text [text] children) []))
|
(setv children (or (if text [text] children) []))
|
||||||
{"tag" tag "attrs" (or attrs {}) "children" 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]))
|
|
||||||
|
Loading…
Reference in New Issue
Block a user