internal package Foswiki::Plugins::WysiwygPlugin::HTML2TML

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::HTML2TML;

Convertor for translating HTML into TML (Topic Meta Language)

The conversion is done by parsing the HTML and generating a parse tree, and then converting that parse tree into TML.

The class is a subclass of HTML::Parser, run in XML mode, so it should be tolerant to many syntax errors, and will also handle XHTML syntax.

The translator tries hard to make good use of newlines in the HTML, in order to maintain text level formating that isn't reflected in the HTML. So the parser retains newlines and spaces, rather than throwing them away, and uses various heuristics to determine which to keep when generating the final TML.

ClassMethod new()

Constructs a new HTML to TML convertor.

You must provide parseWikiUrl and convertImage if you want URLs translated back to wikinames. See for an example of how to call it.

ObjectMethod convert( $html ) → $tml

Convert a block of HTML text into TML.

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