From bd5bb267d8aca89dd3cf486e47366b414b9f43ab Mon Sep 17 00:00:00 2001 From: Nicolas Boulenguez Date: Mon, 25 Jul 2022 07:54:42 +0200 Subject: [PATCH] docs: move the only non-ASCII character to a one-line separate file Unicode substitutions seem impossible in litteral blocks or code-blocks. --- docs/dom.rst | 7 +++---- docs/dom/convert.adb | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) create mode 100644 docs/dom/convert.adb diff --git a/docs/dom.rst b/docs/dom.rst index 3d8dd6f..2321ef1 100644 --- a/docs/dom.rst +++ b/docs/dom.rst @@ -109,14 +109,13 @@ This Byte_Sequence must always be encoded in the encoding defined in the package `Sax.Encoding` (as described earlier, changing this package requires recompiling XML/Ada). By default, this is UTF-8. -.. highlight:: ada - Therefore, if you need to set an attribute to a string encoded for instance in iso-8859-15, you should use the subprogram `Unicode.Encodings.Convert` to convert it appropriately. -The code would thus look as follows:: +The code would thus look as follows: - Set_Attribute (N, Convert ("å", From => Get_By_Name ("iso-8859-15"))); +.. literalinclude:: dom/convert.adb + :language: ada Printing DOM tress ================== diff --git a/docs/dom/convert.adb b/docs/dom/convert.adb new file mode 100644 index 0000000..33a8fd3 --- /dev/null +++ b/docs/dom/convert.adb @@ -0,0 +1 @@ +Set_Attribute (N, Convert ("å", From => Get_By_Name ("iso-8859-15")));