jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From juanpa...@apache.org
Subject [13/16] jspwiki git commit: split plugin rendering, so that plugin execution itself does not require a WikiDocument (a parser/renderer could work with other type of nodes/documents)
Date Sun, 16 Jul 2017 11:54:58 GMT
split plugin rendering, so that plugin execution itself does not require a WikiDocument (a
parser/renderer could work with other type of nodes/documents)


Project: http://git-wip-us.apache.org/repos/asf/jspwiki/repo
Commit: http://git-wip-us.apache.org/repos/asf/jspwiki/commit/303b4a96
Tree: http://git-wip-us.apache.org/repos/asf/jspwiki/tree/303b4a96
Diff: http://git-wip-us.apache.org/repos/asf/jspwiki/diff/303b4a96

Branch: refs/heads/master
Commit: 303b4a962683607697b6cdb3db30577c89d7e4db
Parents: 0c2b4d9
Author: juanpablo <juanpablo@apache.org>
Authored: Sun Jun 4 20:18:54 2017 +0200
Committer: juanpablo <juanpablo@apache.org>
Committed: Sun Jul 16 13:26:32 2017 +0200

----------------------------------------------------------------------
 .../org/apache/wiki/parser/PluginContent.java    | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jspwiki/blob/303b4a96/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
----------------------------------------------------------------------
diff --git a/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java b/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
index f21a2de..8ef5c22 100644
--- a/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
+++ b/jspwiki-war/src/main/java/org/apache/wiki/parser/PluginContent.java
@@ -129,9 +129,7 @@ public class PluginContent extends Text {
      * @return The plugin rendered according to the options set in the WikiContext.
      */
     public String getText() {
-        String result;
-
-        WikiDocument doc = (WikiDocument) getDocument();
+        WikiDocument doc = ( WikiDocument )getDocument();
 
         if (doc == null) {
             //
@@ -152,7 +150,18 @@ public class PluginContent extends Text {
             return getPluginName();
         }
 
-        Boolean wysiwygVariable = (Boolean) context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE);
+        return invoke( context );
+    }
+
+    /**
+     * Performs plugin invocation and return its contents.
+     * 
+     * @param context WikiContext in which the plugin is executed. Must NOT be null.
+     * @return plugin contents.
+     */
+	public String invoke( WikiContext context ) {
+		String result;
+		Boolean wysiwygVariable = (Boolean) context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE);
         boolean wysiwygEditorMode = false;
         if (wysiwygVariable != null) {
             wysiwygEditorMode = wysiwygVariable.booleanValue();
@@ -208,7 +217,7 @@ public class PluginContent extends Text {
 
 
         return result;
-    }
+	}
 
     /**
      * Executes the executeParse() method.


Mime
View raw message