internal package Foswiki::Plugins::WysiwygPlugin::Handlers

See Published API for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

StaticMethod addXMLTag($tag, \&fn)

Instruct Wysiwyg Plugin to "lift out" the named tag and pass it to &fn for processing. &fn may modify the text of the tag. &fn should return 0 if the tag is to be re-embedded immediately, or 1 if it is to be re-embedded after all processing is complete. The text passed (by reference) to &fn includes the ... brackets.

The simplest use of this function is something like this: Foswiki::Plugins::WysiwygPlugin::addXMLTag( 'mytag', sub { 1 } );

A plugin may call this function more than once e.g. to change the processing function for a tag. However, only the original plugin may change the processing for a tag.

Plugins should call this function from their initPlugin handlers so that Wysiwyg Plugin will protect the XML-like tags for all conversions, including REST conversions. Plugins that are intended to be used with older versions of Foswiki (e.g. 1.0.6) should check that this function is defined before calling it, so that they degrade gracefully if an older version of Wysiwyg Plugin (e.g. that shipped with 1.0.6) is installed.

Topic revision: r1 - 21 Nov 2014, ProjectContributor
 

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback