Sign in Join
FPDoc Onlineexperiment

THTML2TextRenderer class

In unit HTML2TextRender

Implements an HTML-to-Text renderer.

Declaration

pascal
THTML2TextRenderer = class

Description

THTML2TextRenderer is an HTML-to-Text renderer. It converts HTML into plain text by stripping tags and their attributes. Converted text includes configurable indentation for HTML tags that affect the indentation level. The following HTML tags include special processing in the renderer:

  • HTML
  • BODY
  • P
  • BR
  • HR
  • OL
  • UL
  • LI
  • DIV CLASS="TITLE" (forces title mark output)

The following Named character entities are converted to their plain text equivalent:

 
' '
<
'<'
&gt;
'>;'
&amp;
'&'

Other named character entities or numeric character entities are included verbatim in the plain text output.

A UTF-8 Byte Order Mark in the HTML is ignored.

Set property values in the class instance to customize the content and formatting produced in the output. Use the Render method to parse and process the HTML content passed to the constructor, and generate the output for the class instance.

See also

Properties

LineEndMarkpublicDefines the end-of-line character sequence.
TitleMarkpublicDefines the character used to delimit a title or header.
HorzLineMarkpublicRepresents a HR tag in the plaint text output.
LinkBeginMarkpublicRepresents an A start tag in the plain text output.
LinkEndMarkpublicRepresents an A end tag in the plain text output.
ListItemMarkpublicRepresents a list item in the plain text output.
MoreMarkpublicIndicates that the plain text output is truncated due to a line limit restriction.
MaxLineLenpublicMaximum number of characters allowed in a line output by the renderer.
IndentSteppublicIncrement (in spaces) for each nested HTML level.

Methods

CreatepublicConstructor for the class instance.
DestroypublicFrees the class instance.
RenderpublicParses the HTML and renders the plain text output.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.