freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [4/7] freemarker git commit: Better toString() for the commonly used TemplateMarkupOutputModel-s.
Date Wed, 19 Dec 2018 21:14:42 GMT
Better toString() for the commonly used TemplateMarkupOutputModel-s.


Project: http://git-wip-us.apache.org/repos/asf/freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/freemarker/commit/1d5323b3
Tree: http://git-wip-us.apache.org/repos/asf/freemarker/tree/1d5323b3
Diff: http://git-wip-us.apache.org/repos/asf/freemarker/diff/1d5323b3

Branch: refs/heads/2.3-gae
Commit: 1d5323b33a04def450b98155ccb082da49fb6818
Parents: 6e1b282
Author: ddekany <ddekany@apache.org>
Authored: Wed Dec 19 11:16:36 2018 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Wed Dec 19 11:16:36 2018 +0100

----------------------------------------------------------------------
 .../core/CommonTemplateMarkupOutputModel.java          | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/freemarker/blob/1d5323b3/src/main/java/freemarker/core/CommonTemplateMarkupOutputModel.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/CommonTemplateMarkupOutputModel.java b/src/main/java/freemarker/core/CommonTemplateMarkupOutputModel.java
index 1e6c8ad..754ddf5 100644
--- a/src/main/java/freemarker/core/CommonTemplateMarkupOutputModel.java
+++ b/src/main/java/freemarker/core/CommonTemplateMarkupOutputModel.java
@@ -63,4 +63,17 @@ public abstract class CommonTemplateMarkupOutputModel<MO extends CommonTemplateM
         this.markupContent = markupContent;
     }
 
+    /**
+     * Returns something like {@code "markup(format=HTML, markup=<p>foo</p>)"};
where the first parameter is
+     * {@link OutputFormat#getName()}, and the second is the content, that's prefixed with
{@code markup=} or {@code
+     * plainText=}, depending on the way the content is internally stored.
+     *
+     * @since 2.3.29
+     */
+    @Override
+    public String toString() {
+        return "markupOutput(format=" + getOutputFormat().getName() + ", " + (plainTextContent
!= null ?
+            "plainText=" + plainTextContent : "markup=" + markupContent) + ")";
+    }
+
 }


Mime
View raw message