split plugin rendering, so that plugin execution itself does not require a WikiDocument (a parser/renderer could work with other type of nodes/documents)
@@ -129,8 +129,6 @@ 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();
if (doc == null) {
@@ -152,6 +150,17 @@ public class PluginContent extends Text {
return getPluginName();
}
+ 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) {
