This is an automated email from the ASF dual-hosted git repository. davsclaus pushed a commit to branch CAMEL-27274-doc-entities in repository https://gitbox.apache.org/repos/asf/camel.git
commit 58bba1273860966ce8b288870726a0af6226020c Author: Claus Ibsen <[email protected]> AuthorDate: Thu Nov 26 07:26:45 2026 +0100 CAMEL-27274: docs - show entity references literally in inline code Asciidoctor restores character references such as &foo; inside inline code, so the camel-website html check failed on the unknown entity in simple-functions, and known entities (&, <, ') rendered as the character instead of the escape. Use literal passthrough. Co-Authored-By: Claude Opus 5.5 <[email protected]> --- .../org/apache/camel/catalog/docs/simple-functions.adoc | 10 +++++----- .../org/apache/camel/catalog/docs/velocity-component.adoc | 2 +- .../camel-velocity/src/main/docs/velocity-component.adoc | 2 +- .../main/docs/modules/languages/pages/simple-functions.adoc | 10 +++++----- .../modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc | 2 +- 5 files changed, 13 insertions(+), 13 deletions(-) diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-functions.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-functions.adoc index c79481b61f3f..6a97e668bb9b 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-functions.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/simple-functions.adoc @@ -586,7 +586,7 @@ instead of chaining multiple `replace` calls or using a custom bean. The first a [width="100%",cols="10%,45%,45%",options="header",] |==== |Kind |Escaping |Example -|`html` | `&` `<` `>` `"` `'` are replaced with HTML entities | `${escape(html, 'Tom & Jerry')}` returns `Tom & Jerry` +|`html` | `&` `<` `>` `"` `'` are replaced with HTML entities | `${escape(html, 'Tom & Jerry')}` returns `+Tom & Jerry+` |`xml` | `&` `<` `>` `"` `'` are replaced with the five predefined XML entities | `${escape(xml, $\{header.title})}` |`json` | quotes, backslashes and control characters are backslash-escaped for use inside a JSON string (surrounding quotes are not added) | `${escape(json, $\{body})}` |`js` | as `json`, and also single quotes and `</` so the value can be used inside a JavaScript string literal | `${escape(js, $\{header.msg})}` @@ -595,25 +595,25 @@ instead of chaining multiple `replace` calls or using a custom bean. The first a |==== Without a second argument the function operates on the message body, so if the body is `Monday & Tuesday` -then `${escape(html)}` returns `Monday & Tuesday`. The kind is case-insensitive, and `javascript` can be used instead of `js`. +then `${escape(html)}` returns `+Monday & Tuesday+`. The kind is case-insensitive, and `javascript` can be used instead of `js`. TIP: Prefer parameterized queries over `escape(sql)`; the SQL kind is meant as a last resort for components where parameters cannot be used. -The `unescape` function is the inverse of `escape`, and takes the same kinds, so `${unescape(xml, 'Tom & Jerry')}` +The `unescape` function is the inverse of `escape`, and takes the same kinds, so `+${unescape(xml, 'Tom & Jerry')}+` returns `Tom & Jerry`, and `${unescape(url, 'Camel%20in%20Action')}` returns `Camel in Action`: [width="100%",cols="10%,90%",options="header",] |==== |Kind |Unescaping -|`html`, `xml` | the five predefined entities `&` `<` `>` `"` `'`, and numeric character references such as `'` or `'`. Other named entities, such as the HTML ` `, are kept as they are. +|`html`, `xml` | the five predefined entities `+&+` `+<+` `+>+` `+"+` `+'+`, and numeric character references such as `+'+` or `+'+`. Other named entities, such as the HTML `+ +`, are kept as they are. |`json` | the backslash escapes `\"` `\\` `\/` `\b` `\f` `\n` `\r` `\t` and `\uXXXX` |`js` | as `json`, and also `\'` |`sql` | doubled single quotes become one |`url` | percent-encoded sequences (decoded as UTF-8), and a `+` becomes a space as in a URL query |==== -A sequence that is not a valid escape of the kind, such as `&foo;` or `%zz`, is kept as it is. +A sequence that is not a valid escape of the kind, such as `+&foo;+` or `%zz`, is kept as it is. The `lowercase` and `uppercase` functions are as the name implies used for lower and uppercasing. So `${lowercase('Hello World')}` returns `hello world` and `${uppercase('Hello World')}` returns `HELLO WORLD`. diff --git a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/velocity-component.adoc b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/velocity-component.adoc index a215ef6531ae..9b6ba6b09a22 100644 --- a/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/velocity-component.adoc +++ b/catalog/camel-catalog/src/generated/resources/org/apache/camel/catalog/docs/velocity-component.adoc @@ -179,7 +179,7 @@ YAML:: Dear ${headers.name}. You ordered item $variables.esc.xml(${headers.item}) on $variables.esc.xml(${body}). ---- -With a body of `Monday & Tuesday` the template renders `Monday & Tuesday`. +With a body of `Monday & Tuesday` the template renders `+Monday & Tuesday+`. The same works with `$variables.esc.html(...)`, `$variables.esc.json(...)`, `$variables.esc.sql(...)`, and `$variables.esc.url(...)`. TIP: A message header works the same way (`setHeader("esc", constant(new EscapeTool()))` and `$headers.esc` in the template), diff --git a/components/camel-velocity/src/main/docs/velocity-component.adoc b/components/camel-velocity/src/main/docs/velocity-component.adoc index a215ef6531ae..9b6ba6b09a22 100644 --- a/components/camel-velocity/src/main/docs/velocity-component.adoc +++ b/components/camel-velocity/src/main/docs/velocity-component.adoc @@ -179,7 +179,7 @@ YAML:: Dear ${headers.name}. You ordered item $variables.esc.xml(${headers.item}) on $variables.esc.xml(${body}). ---- -With a body of `Monday & Tuesday` the template renders `Monday & Tuesday`. +With a body of `Monday & Tuesday` the template renders `+Monday & Tuesday+`. The same works with `$variables.esc.html(...)`, `$variables.esc.json(...)`, `$variables.esc.sql(...)`, and `$variables.esc.url(...)`. TIP: A message header works the same way (`setHeader("esc", constant(new EscapeTool()))` and `$headers.esc` in the template), diff --git a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-functions.adoc b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-functions.adoc index c79481b61f3f..6a97e668bb9b 100644 --- a/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-functions.adoc +++ b/core/camel-core-languages/src/main/docs/modules/languages/pages/simple-functions.adoc @@ -586,7 +586,7 @@ instead of chaining multiple `replace` calls or using a custom bean. The first a [width="100%",cols="10%,45%,45%",options="header",] |==== |Kind |Escaping |Example -|`html` | `&` `<` `>` `"` `'` are replaced with HTML entities | `${escape(html, 'Tom & Jerry')}` returns `Tom & Jerry` +|`html` | `&` `<` `>` `"` `'` are replaced with HTML entities | `${escape(html, 'Tom & Jerry')}` returns `+Tom & Jerry+` |`xml` | `&` `<` `>` `"` `'` are replaced with the five predefined XML entities | `${escape(xml, $\{header.title})}` |`json` | quotes, backslashes and control characters are backslash-escaped for use inside a JSON string (surrounding quotes are not added) | `${escape(json, $\{body})}` |`js` | as `json`, and also single quotes and `</` so the value can be used inside a JavaScript string literal | `${escape(js, $\{header.msg})}` @@ -595,25 +595,25 @@ instead of chaining multiple `replace` calls or using a custom bean. The first a |==== Without a second argument the function operates on the message body, so if the body is `Monday & Tuesday` -then `${escape(html)}` returns `Monday & Tuesday`. The kind is case-insensitive, and `javascript` can be used instead of `js`. +then `${escape(html)}` returns `+Monday & Tuesday+`. The kind is case-insensitive, and `javascript` can be used instead of `js`. TIP: Prefer parameterized queries over `escape(sql)`; the SQL kind is meant as a last resort for components where parameters cannot be used. -The `unescape` function is the inverse of `escape`, and takes the same kinds, so `${unescape(xml, 'Tom & Jerry')}` +The `unescape` function is the inverse of `escape`, and takes the same kinds, so `+${unescape(xml, 'Tom & Jerry')}+` returns `Tom & Jerry`, and `${unescape(url, 'Camel%20in%20Action')}` returns `Camel in Action`: [width="100%",cols="10%,90%",options="header",] |==== |Kind |Unescaping -|`html`, `xml` | the five predefined entities `&` `<` `>` `"` `'`, and numeric character references such as `'` or `'`. Other named entities, such as the HTML ` `, are kept as they are. +|`html`, `xml` | the five predefined entities `+&+` `+<+` `+>+` `+"+` `+'+`, and numeric character references such as `+'+` or `+'+`. Other named entities, such as the HTML `+ +`, are kept as they are. |`json` | the backslash escapes `\"` `\\` `\/` `\b` `\f` `\n` `\r` `\t` and `\uXXXX` |`js` | as `json`, and also `\'` |`sql` | doubled single quotes become one |`url` | percent-encoded sequences (decoded as UTF-8), and a `+` becomes a space as in a URL query |==== -A sequence that is not a valid escape of the kind, such as `&foo;` or `%zz`, is kept as it is. +A sequence that is not a valid escape of the kind, such as `+&foo;+` or `%zz`, is kept as it is. The `lowercase` and `uppercase` functions are as the name implies used for lower and uppercasing. So `${lowercase('Hello World')}` returns `hello world` and `${uppercase('Hello World')}` returns `HELLO WORLD`. diff --git a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc index 0af8b498cb0f..fcda3d28f9a6 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4x-upgrade-guide-4_24.adoc @@ -5688,7 +5688,7 @@ element as before, set that element as the body. === camel-stax - the text mode of xtokenize gives the text as an XML parser reads it With mode `t`, `xtokenize` returned the characters between the tags of the element as they are written: entity and -character references were not decoded (`AT&T` instead of `AT&T`), and the content of a CDATA section was left +character references were not decoded (`+AT&T+` instead of `AT&T`), and the content of a CDATA section was left out. The text is now decoded and includes the content of CDATA sections, so a route that decoded the entities itself must stop doing so. With a `group` greater than 1, the texts in the `<group>` element are escaped as XML text, so the group is still well-formed XML.
