[IMP]Hy base : use gensym for safer xml-write macro
This commit is contained in:
parent
19b9fa6c69
commit
9a7027622f
@ -50,11 +50,11 @@
|
||||
(defmacro field-inherit [xmlid] `(field {"name" "inherit_id" "ref" ~xmlid} []))
|
||||
(defmacro field-arch [&rest args] `(field {"name" "arch" "type" "xml"} ~@args))
|
||||
|
||||
(defmacro xml-write [filename tree]
|
||||
(defmacro/g! xml-write [filename tree]
|
||||
"Write XML file according to filename and given tree"
|
||||
`(do
|
||||
(import [os [path]])
|
||||
(setv output-xml (.tostring ET tree)
|
||||
output-path (.dirname path (.abspath path __file__))
|
||||
fpath f"{output-path}/{filename}")
|
||||
(with [f (open fpath "w")] (.write f output-xml))))
|
||||
(import [os [path]])
|
||||
(setv ~g!output-xml (.tostring ET tree)
|
||||
~g!output-path (.dirname path (.abspath path __file__))
|
||||
~g!fpath (+ ~g!output-path "/" ~g!filename))
|
||||
(with [f (open ~g!fpath "w")] (.write f ~g!output-xml))))
|
||||
|
Loading…
Reference in New Issue
Block a user