mirror of
https://codeberg.org/hako/Rosenthal.git
synced 2026-11-29 22:58:06 +00:00
utils: Add scm->kdl-string, scm->kdlv1-string, kdl-file and kdlv1-file.
This commit is contained in:
2 files changed
+116
No files matched your search
@@ -16,6 +16,8 @@
|
||||
|
||||
ini-file
|
||||
json-file
|
||||
kdl-file
|
||||
kdlv1-file
|
||||
toml-file
|
||||
yaml-file))
|
||||
|
||||
@@ -94,6 +96,34 @@
|
||||
(cut scm->json '#$exp <> #:pretty #t)))))
|
||||
#:options '(#:substitutable? #f)))
|
||||
|
||||
(define (kdl-file name exp)
|
||||
(computed-file name
|
||||
(with-imported-modules '((rosenthal utils kdl))
|
||||
(if (gexp? exp)
|
||||
#~(begin
|
||||
(use-modules (srfi srfi-26) (rosenthal utils kdl))
|
||||
(call-with-output-file #$output
|
||||
(cut display (scm->kdl-string #$exp) <>)))
|
||||
#~(begin
|
||||
(use-modules (srfi srfi-26) (rosenthal utils kdl))
|
||||
(call-with-output-file #$output
|
||||
(cut display (scm->kdl-string '#$exp) <>)))))
|
||||
#:options '(#:substitutable? #f)))
|
||||
|
||||
(define (kdlv1-file name exp)
|
||||
(computed-file name
|
||||
(with-imported-modules '((rosenthal utils kdl))
|
||||
(if (gexp? exp)
|
||||
#~(begin
|
||||
(use-modules (srfi srfi-26) (rosenthal utils kdl))
|
||||
(call-with-output-file #$output
|
||||
(cut display (scm->kdlv1-string #$exp) <>)))
|
||||
#~(begin
|
||||
(use-modules (srfi srfi-26) (rosenthal utils kdl))
|
||||
(call-with-output-file #$output
|
||||
(cut display (scm->kdlv1-string '#$exp) <>)))))
|
||||
#:options '(#:substitutable? #f)))
|
||||
|
||||
;; https://github.com/hylophile/guile-toml
|
||||
;; TODO: TOML writing support is incomplete.
|
||||
;; See https://github.com/hylophile/guile-toml/blob/main/toml/builder.scm.
|
||||
|
||||
Reference in new issue
Block a user