Added links to wiki for EncodeHtml, EncodeJs, EncodeJson and EncodeXml

This commit is contained in:
Erik C. Thauvin 2023-03-18 14:56:19 -07:00
parent 0f62f9cb5b
commit cea371ed31
7 changed files with 16 additions and 36 deletions

View file

@ -32,6 +32,7 @@ import rife.tools.StringUtils;
* </pre>
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @see <a href="https://github.com/rife2/rife2-template-renderers/wiki/rife.render.EncodeHtml">rife.render.EncodeHtml</a>
* @see StringUtils#encodeHtml(String)
* @since 1.0
*/

View file

@ -32,6 +32,7 @@ import rife.tools.StringUtils;
* </pre>
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @see <a href="https://github.com/rife2/rife2-template-renderers/wiki/rife.render.EncodeJs">rife.render.EncodeJs</a>
* @see StringUtils#encodeJson(String)
* @since 1.0
*/

View file

@ -32,6 +32,7 @@ import rife.tools.StringUtils;
* </pre>
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @see <a href="https://github.com/rife2/rife2-template-renderers/wiki/rife.render.EncodeJson">rife.render.EncodeJson</a>
* @see StringUtils#encodeJson(String)
* @since 1.0
*/

View file

@ -32,6 +32,7 @@ import rife.tools.StringUtils;
* </pre>
*
* @author <a href="https://erik.thauvin.net/">Erik C. Thauvin</a>
* @see <a href="https://github.com/rife2/rife2-template-renderers/wiki/rife.render.EncodeXml">rife.render.EncodeXml</a>
* @see StringUtils#encodeXml(String)
* @since 1.0
*/

View file

@ -51,10 +51,10 @@ public final class RenderUtils {
}
/**
* Encodes a string to JavaScript/ECMAScript.
* Encodes a String to JavaScript/ECMAScript.
*
* @param src the source string
* @return the enocded string
* @param src the source String
* @return the encoded String
*/
public static String encodeJS(String src) {
if (src == null || src.isBlank()) {

View file

@ -54,8 +54,8 @@ class TestEncode {
@Test
void testEncodeJson() {
var t = TemplateFactory.JSON.get("encodeJson");
t.setAttribute(TestCase.FOO, "fde\fde\rjk\tos\\u218Foi");
assertThat(t.getContent()).isEqualTo("{\n \"foo\": \"fde\\fde\\rjk\\tos\\\\u218Foi\"\n}");
t.setAttribute(TestCase.FOO, "This is a \"•test\"");
assertThat(t.getContent()).isEqualTo("{\n \"foo\": \"This is a \\\"\\u2022test\\\"\"\n}");
}
@Test