unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#66366: [PATCH] doc: Add explanation on how to avoid escaping in SXML
@ 2023-10-05 20:48 Ekaitz Zarraga
  0 siblings, 0 replies; only message in thread
From: Ekaitz Zarraga @ 2023-10-05 20:48 UTC (permalink / raw)
  To: 66366

From 7754fda28a6029116ee49172af28b5aa28bcda7e Mon Sep 17 00:00:00 2001
From: Ekaitz Zarraga <ekaitz@elenq.tech>
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







^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-10-05 20:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-05 20:48 bug#66366: [PATCH] doc: Add explanation on how to avoid escaping in SXML Ekaitz Zarraga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).