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 WysiwygPlugin.pm for an example of how to call it.

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

Convert a block of HTML text into TML.

Options:
  • expandVarsInURL
  • xmltag

IMPORTANT: $html is a perl internal string, NOT octets

Topic revision: r1 - 22 Jan 2018, UnknownUser
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 Hubert's Wiki? Send feedback