bug#66366: [PATCH] doc: Add explanation on how to avoid escaping in SXML

Ekaitz Zarraga <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <vykFBaOoIW89r3Pe8HxJxD9jHGFVCKeAFFkGd1YDUtvQNw4CpnhYWIsrJEufcgWm9-V5MN5o9J7t9BkanPUDqvJVaY6MGdaPRRNjdQbD5PA=@elenq.tech>
From 7754fda28a6029116ee49172af28b5aa28bcda7e Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <[email protected]>
Date: Thu, 5 Oct 2023 22:42:44 +0200
Subject: [PATCH] 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.
---
 doc/ref/sxml.texi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/doc/ref/sxml.texi b/doc/ref/sxml.texi
index 835a39b36..b92f4c29e 100644
--- a/doc/ref/sxml.texi
+++ b/doc/ref/sxml.texi
@@ -203,6 +203,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>&lt;i&gt;Some example&lt;/i&gt;</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.
-- 
2.41.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.