const
{$IFDEF PAIDVERS}
SDLVersionInfo = 'htmlsupport_r1200_full';
IsLightEd = false;
{$ELSE}
SDLVersionInfo = 'htmlsupport_r1200_lighted';
IsLightEd = true;
{$ENDIF}
Release = 1200;
type
TOnHTMLTagEvent = procedure (Sender: TObject; TagName: string; Params: string;
var Replacement: string) of object;
THtmlProducer= class(TComponent)
private
FTemplate : string;
FOnHTMLTag : TOnHtmlTagEvent;
FSPos : integer;
FConvertedHTML: string;
FStrStream : TStringStream;
procedure SetTemplate (value: string);
public
constructor Create (AOwner: TComponent); override;
destructor Destroy; override;
function Convert: string;
property ConvertedHTML: string read FConvertedHTML;
function ConvertedHTMLAsStream: TStream;
procedure ReadTemplateFromFile (FName: string);
procedure ReadTemplateFromStream (InStream: TStream);
property Template: string read FTemplate write SetTemplate;
procedure WriteConvertedHTMLToFile (FName: string);
published
property OnHTMLTag: TOnHTMLTagEvent read FOnHTMLTag write FOnHTMLTag;
end;
{procedures and functions}
function AnsiToHTMLEntity
(cc : char) { character to encode }
: string; { corresponding HTML entity }
function ConvertHTMLBodyToText
(InString : string; { HTML string to be converted }
ListIndicator : char) { controls how <LI> is resolved }
: string; { corresponding text }
function CountWordsHTML
(InString : string; { string to be analyzed }
NoNumbers : boolean; { TRUE: numbers not counted }
var OpenHTMLTag : boolean){TRUE:the string ends with an unclosed HTML tag }
: integer; { word count of string }
function DefaultHTMLHead
(Title, { title of HTML page }
Author, { author of HTML page }
CharSet, { character set to be used }
Stylesheet : string; { style sheet to be used }
IncludeBody : boolean) { TRUE: include opening BODY tag }
: string; { string containing the HTML code }
function DefaultHTMLFoot
(IncludeBody : boolean) { TRUE: include closing BODY tag }
: string; { string containing the HTML code }
function ExtractHTMLBody
(InString : string) { HTML file as a string }
: string; { HTML code between body tags }
function ExtractHTTPPath
(const URL : string) { source string }
: string; { path in URL }
function HTMLEntityToAnsi
(Entity : string) { HTML entity (Latin-1) }
: char; { corresponding character }
function MakeStringHTMLCompatible
(InString : string) { string to be converted }
: string; { HTML compatible string }
function ResolveHTMLEntities
(InString : string) { string to be converted }
: string; { string with entities resolved }
function URLEncode
(InString : string) { string to be percent encoded }
: string;
function URLDecode
(InString : string) { percent encoded string }
: string; { ASCII string }
|