@@ -76,19 +76,19 @@ THTMLBuilder = class abstract (TObject)
76
76
BodyTagName = ' body' ;
77
77
PreTagName = ' pre' ;
78
78
SpanTagName = ' span' ;
79
- strict protected
79
+ public
80
80
// / <summary>Returns the class used to generate tags for the appropriate
81
81
// / type of HTML.</summary>
82
- function TagGenerator : THTMLClass; virtual ; abstract ;
82
+ class function TagGenerator : THTMLClass; virtual ; abstract ;
83
83
// / <summary>Returns any preamble to be written to the HTML before the
84
84
// / opening <html> tag.</summary>
85
- function Preamble : string; virtual ; abstract ;
85
+ class function Preamble : string; virtual ; abstract ;
86
86
// / <summary>Returns the attributes of the document's <html> tag.
87
87
// / </summary>
88
- function HTMLTagAttrs : IHTMLAttributes; virtual ; abstract ;
88
+ class function HTMLTagAttrs : IHTMLAttributes; virtual ; abstract ;
89
89
// / <summary>Returns any <meta> tags to be included within the
90
90
// / document's <head> tag.</summary>
91
- function MetaTags : string; virtual ; abstract ;
91
+ class function MetaTags : string; virtual ; abstract ;
92
92
public
93
93
// / <summary>Object constructor. Initialises object with empty body.
94
94
// / </summary>
@@ -146,19 +146,19 @@ TXHTMLBuilder = class sealed(THTMLBuilder)
146
146
// XML document type
147
147
XHTMLDocType = ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" '
148
148
+ ' "https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">' ;
149
- strict protected
149
+ public
150
150
// / <summary>Returns the class used to generate XHTML compliant tags.
151
151
// / </summary>
152
- function TagGenerator : THTMLClass; override;
152
+ class function TagGenerator : THTMLClass; override;
153
153
// / <summary>Returns the XML processing instruction followed by the XHTML
154
154
// / doctype.</summary>
155
- function Preamble : string; override;
155
+ class function Preamble : string; override;
156
156
// / <summary>Returns the attributes required for an XHTML <html> tag.
157
157
// / </summary>
158
- function HTMLTagAttrs : IHTMLAttributes; override;
158
+ class function HTMLTagAttrs : IHTMLAttributes; override;
159
159
// / <summary>Returns a <meta> tag that specifies the text/html
160
160
// / content type and UTF-8 encodiing.</summary>
161
- function MetaTags : string; override;
161
+ class function MetaTags : string; override;
162
162
end ;
163
163
164
164
// / <summary>Class used to create the content of a HTML 5 document.</summary>
@@ -167,18 +167,18 @@ THTML5Builder = class sealed(THTMLBuilder)
167
167
const
168
168
// HTML 5 document type
169
169
HTML5DocType = ' <!DOCTYPE HTML>' ;
170
- strict protected
170
+ public
171
171
// / <summary>Returns the class used to generate HTML 5 compliant tags.
172
172
// / </summary>
173
- function TagGenerator : THTMLClass; override;
173
+ class function TagGenerator : THTMLClass; override;
174
174
// / <summary>Returns the HTML 5 doctype.</summary>
175
- function Preamble : string; override;
175
+ class function Preamble : string; override;
176
176
// / <summary>Returns the attributes required for an HTML 5 <html>
177
177
// / tag.</summary>
178
- function HTMLTagAttrs : IHTMLAttributes; override;
178
+ class function HTMLTagAttrs : IHTMLAttributes; override;
179
179
// / <summary>Returns a <meta> tag that specifies that the document
180
180
// / uses UTF-8 encoding.</summary>
181
- function MetaTags : string; override;
181
+ class function MetaTags : string; override;
182
182
end ;
183
183
184
184
@@ -312,7 +312,7 @@ function THTMLBuilder.TitleTag: string;
312
312
313
313
{ TXHTMLBuilder }
314
314
315
- function TXHTMLBuilder.HTMLTagAttrs : IHTMLAttributes;
315
+ class function TXHTMLBuilder.HTMLTagAttrs : IHTMLAttributes;
316
316
begin
317
317
Result := THTMLAttributes.Create(
318
318
[THTMLAttribute.Create(' xmlns' , ' https://www.w3.org/1999/xhtml' ),
@@ -321,7 +321,7 @@ function TXHTMLBuilder.HTMLTagAttrs: IHTMLAttributes;
321
321
);
322
322
end ;
323
323
324
- function TXHTMLBuilder.MetaTags : string;
324
+ class function TXHTMLBuilder.MetaTags : string;
325
325
begin
326
326
Result := TagGenerator.SimpleTag(
327
327
MetaTagName,
@@ -332,24 +332,24 @@ function TXHTMLBuilder.MetaTags: string;
332
332
);
333
333
end ;
334
334
335
- function TXHTMLBuilder.Preamble : string;
335
+ class function TXHTMLBuilder.Preamble : string;
336
336
begin
337
337
Result := XMLProcInstruction + EOL + XHTMLDocType;
338
338
end ;
339
339
340
- function TXHTMLBuilder.TagGenerator : THTMLClass;
340
+ class function TXHTMLBuilder.TagGenerator : THTMLClass;
341
341
begin
342
342
Result := TXHTML;
343
343
end ;
344
344
345
345
{ THTML5Builder }
346
346
347
- function THTML5Builder.HTMLTagAttrs : IHTMLAttributes;
347
+ class function THTML5Builder.HTMLTagAttrs : IHTMLAttributes;
348
348
begin
349
349
Result := THTMLAttributes.Create(' lang' , ' en' );
350
350
end ;
351
351
352
- function THTML5Builder.MetaTags : string;
352
+ class function THTML5Builder.MetaTags : string;
353
353
begin
354
354
// <meta charset="UTF-8">
355
355
Result := TagGenerator.SimpleTag(
@@ -358,12 +358,12 @@ function THTML5Builder.MetaTags: string;
358
358
);
359
359
end ;
360
360
361
- function THTML5Builder.Preamble : string;
361
+ class function THTML5Builder.Preamble : string;
362
362
begin
363
363
Result := HTML5DocType;
364
364
end ;
365
365
366
- function THTML5Builder.TagGenerator : THTMLClass;
366
+ class function THTML5Builder.TagGenerator : THTMLClass;
367
367
begin
368
368
Result := THTML5;
369
369
end ;
0 commit comments