@@ -76,19 +76,19 @@ THTMLBuilder = class abstract (TObject)
7676 BodyTagName = ' body' ;
7777 PreTagName = ' pre' ;
7878 SpanTagName = ' span' ;
79- strict protected
79+ public
8080 // / <summary>Returns the class used to generate tags for the appropriate
8181 // / type of HTML.</summary>
82- function TagGenerator : THTMLClass; virtual ; abstract ;
82+ class function TagGenerator : THTMLClass; virtual ; abstract ;
8383 // / <summary>Returns any preamble to be written to the HTML before the
8484 // / opening <html> tag.</summary>
85- function Preamble : string; virtual ; abstract ;
85+ class function Preamble : string; virtual ; abstract ;
8686 // / <summary>Returns the attributes of the document's <html> tag.
8787 // / </summary>
88- function HTMLTagAttrs : IHTMLAttributes; virtual ; abstract ;
88+ class function HTMLTagAttrs : IHTMLAttributes; virtual ; abstract ;
8989 // / <summary>Returns any <meta> tags to be included within the
9090 // / document's <head> tag.</summary>
91- function MetaTags : string; virtual ; abstract ;
91+ class function MetaTags : string; virtual ; abstract ;
9292 public
9393 // / <summary>Object constructor. Initialises object with empty body.
9494 // / </summary>
@@ -146,19 +146,19 @@ TXHTMLBuilder = class sealed(THTMLBuilder)
146146 // XML document type
147147 XHTMLDocType = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
148148 + ' "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ;
149- strict protected
149+ public
150150 // / <summary>Returns the class used to generate XHTML compliant tags.
151151 // / </summary>
152- function TagGenerator : THTMLClass; override;
152+ class function TagGenerator : THTMLClass; override;
153153 // / <summary>Returns the XML processing instruction followed by the XHTML
154154 // / doctype.</summary>
155- function Preamble : string; override;
155+ class function Preamble : string; override;
156156 // / <summary>Returns the attributes required for an XHTML <html> tag.
157157 // / </summary>
158- function HTMLTagAttrs : IHTMLAttributes; override;
158+ class function HTMLTagAttrs : IHTMLAttributes; override;
159159 // / <summary>Returns a <meta> tag that specifies the text/html
160160 // / content type and UTF-8 encodiing.</summary>
161- function MetaTags : string; override;
161+ class function MetaTags : string; override;
162162 end ;
163163
164164 // / <summary>Class used to create the content of a HTML 5 document.</summary>
@@ -167,18 +167,18 @@ THTML5Builder = class sealed(THTMLBuilder)
167167 const
168168 // HTML 5 document type
169169 HTML5DocType = ' <!DOCTYPE HTML>' ;
170- strict protected
170+ public
171171 // / <summary>Returns the class used to generate HTML 5 compliant tags.
172172 // / </summary>
173- function TagGenerator : THTMLClass; override;
173+ class function TagGenerator : THTMLClass; override;
174174 // / <summary>Returns the HTML 5 doctype.</summary>
175- function Preamble : string; override;
175+ class function Preamble : string; override;
176176 // / <summary>Returns the attributes required for an HTML 5 <html>
177177 // / tag.</summary>
178- function HTMLTagAttrs : IHTMLAttributes; override;
178+ class function HTMLTagAttrs : IHTMLAttributes; override;
179179 // / <summary>Returns a <meta> tag that specifies that the document
180180 // / uses UTF-8 encoding.</summary>
181- function MetaTags : string; override;
181+ class function MetaTags : string; override;
182182 end ;
183183
184184
@@ -312,7 +312,7 @@ function THTMLBuilder.TitleTag: string;
312312
313313{ TXHTMLBuilder }
314314
315- function TXHTMLBuilder.HTMLTagAttrs : IHTMLAttributes;
315+ class function TXHTMLBuilder.HTMLTagAttrs : IHTMLAttributes;
316316begin
317317 Result := THTMLAttributes.Create(
318318 [THTMLAttribute.Create(' xmlns' , ' https://www.w3.org/1999/xhtml' ),
@@ -321,7 +321,7 @@ function TXHTMLBuilder.HTMLTagAttrs: IHTMLAttributes;
321321 );
322322end ;
323323
324- function TXHTMLBuilder.MetaTags : string;
324+ class function TXHTMLBuilder.MetaTags : string;
325325begin
326326 Result := TagGenerator.SimpleTag(
327327 MetaTagName,
@@ -332,24 +332,24 @@ function TXHTMLBuilder.MetaTags: string;
332332 );
333333end ;
334334
335- function TXHTMLBuilder.Preamble : string;
335+ class function TXHTMLBuilder.Preamble : string;
336336begin
337337 Result := XMLProcInstruction + EOL + XHTMLDocType;
338338end ;
339339
340- function TXHTMLBuilder.TagGenerator : THTMLClass;
340+ class function TXHTMLBuilder.TagGenerator : THTMLClass;
341341begin
342342 Result := TXHTML;
343343end ;
344344
345345{ THTML5Builder }
346346
347- function THTML5Builder.HTMLTagAttrs : IHTMLAttributes;
347+ class function THTML5Builder.HTMLTagAttrs : IHTMLAttributes;
348348begin
349349 Result := THTMLAttributes.Create(' lang' , ' en' );
350350end ;
351351
352- function THTML5Builder.MetaTags : string;
352+ class function THTML5Builder.MetaTags : string;
353353begin
354354 // <meta charset="UTF-8">
355355 Result := TagGenerator.SimpleTag(
@@ -358,12 +358,12 @@ function THTML5Builder.MetaTags: string;
358358 );
359359end ;
360360
361- function THTML5Builder.Preamble : string;
361+ class function THTML5Builder.Preamble : string;
362362begin
363363 Result := HTML5DocType;
364364end ;
365365
366- function THTML5Builder.TagGenerator : THTMLClass;
366+ class function THTML5Builder.TagGenerator : THTMLClass;
367367begin
368368 Result := THTML5;
369369end ;
0 commit comments