internal package Foswiki::Plugins::WysiwygPlugin::TML2HTML

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

internal package Foswiki::Plugins::WysiwygPlugin::TML2HTML

Convertor class for translating TML (Topic Meta Language) into HTML

The convertor does not use the Foswiki rendering, as that is a lossy conversion, and would make symmetric translation back to TML an impossibility.

The design goal was to support round-trip conversion from well-formed TML to XHTML1.0 and back to identical TML. Notes that some deprecated TML syntax is not supported.

ClassMethod new()

Construct a new TML to HTML convertor.

ObjectMethod convert( $tml, \%options ) → $tml

Convert a block of TML text into HTML. Options:
  • getViewUrl is a reference to a method:
    getViewUrl($web,$topic) -> $url (where $topic may include an anchor)
  • expandVarsInURL is a reference to a static method:
    expandVarsInURL($url, \%options) -> $url
    that expands selected variables in URLs so that, for example, tags appear as pictures in the wysiwyg editor.
  • xmltag is a reference to a hash. The keys are names of XML-like tags. The values are references to a function to determine if the content of the tag must be protected:
    fn($markup) -> $bool
    The $markup appears between the delimiters. The functions may modify the markup.
  • dieOnError makes convert throw an exception if a conversion fails. The default behaviour is to encode the whole topic as verbatim text.

Topic revision: r1 - 19 Apr 2011, ProjectContributor
This site is powered by FoswikiCopyright © CC-BY-SA by the contributing authors. All material on this collaboration platform is copyrighted under CC-BY-SA by the contributing authors unless otherwise noted.
Ideas, requests, problems regarding Foswiki? Send feedback