1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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>
This commit is contained in:
Ekaitz Zarraga 2023-10-05 22:42:44 +02:00 committed by Ludovic Courtès
parent d987e7e7cb
commit c9d0a0c48c
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -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>&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.