unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Ekaitz Zarraga <ekaitz@elenq.tech>
To: 66366@debbugs.gnu.org
Subject: bug#66366: [PATCH] doc: Add explanation on how to avoid escaping in SXML
Date: Thu, 05 Oct 2023 20:48:34 +0000	[thread overview]
Message-ID: <vykFBaOoIW89r3Pe8HxJxD9jHGFVCKeAFFkGd1YDUtvQNw4CpnhYWIsrJEufcgWm9-V5MN5o9J7t9BkanPUDqvJVaY6MGdaPRRNjdQbD5PA=@elenq.tech> (raw)

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







                 reply	other threads:[~2023-10-05 20:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='vykFBaOoIW89r3Pe8HxJxD9jHGFVCKeAFFkGd1YDUtvQNw4CpnhYWIsrJEufcgWm9-V5MN5o9J7t9BkanPUDqvJVaY6MGdaPRRNjdQbD5PA=@elenq.tech' \
    --to=ekaitz@elenq.tech \
    --cc=66366@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).