[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 02/04: doc: Add explanation on how to avoid escaping in
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] 02/04: doc: Add explanation on how to avoid escaping in SXML |
Date: |
Sun, 22 Dec 2024 16:46:24 -0500 (EST) |
civodul pushed a commit to branch main
in repository guile.
commit c9d0a0c48cedf85b3e3929ebda3cefb8cb74cc4f
Author: Ekaitz Zarraga <ekaitz@elenq.tech>
AuthorDate: Thu Oct 5 22:42:44 2023 +0200
doc: Add explanation on how to avoid escaping in SXML
* doc/ref/sxml.texi (Reading and Writing XML): Add explanation on using
a procedure to avoid escaping.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
doc/ref/sxml.texi | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/doc/ref/sxml.texi b/doc/ref/sxml.texi
index 3502c3f1a..fceb30655 100644
--- a/doc/ref/sxml.texi
+++ b/doc/ref/sxml.texi
@@ -204,6 +204,21 @@ the current output port, unless the optional argument
@var{port} is
present.
@end deffn
+Output is automatically escaped as expected for a serializer.
+
+@example
+(sxml->xml `(code "<i>Some example</i>"))
+@result{} <code><i>Some example</i></code>
+@end example
+
+In order to avoid some string from being escaped, it must be wrapped in a
+procedure that writes the string to the @code{(current-output-port)}.
+
+@example
+(sxml->xml `(code ,(lambda () (display "<i>Some example</i>"))))
+@result{} <code><i>Some example</i></code>
+@end example
+
@deffn {Scheme Procedure} sxml->string sxml
Detag an sxml tree @var{sxml} into a string. Does not perform any
formatting.