Skip to content

Commit c74924c

Browse files
committed
Merge branch 'feature/87-add-html5-save-snippet+unit-option' into develop
Fixes #87
2 parents 1b54e43 + bd3b3ee commit c74924c

24 files changed

+463
-255
lines changed

Docs/Design/FileFormats/saved.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ <h2>
7676
<li>
7777
Pascal source files (either .inc or .pas files).
7878
</li>
79+
<li>
80+
HTML 5 files.
81+
</li>
7982
<li>
8083
XHTML files.
8184
</li>
@@ -85,7 +88,7 @@ <h2>
8588
</ul>
8689

8790
<p>
88-
There is no specific file format for these files, except that XHTML and RTF
91+
There is no specific file format for these files, except that HTML 5, XHTML and RTF
8992
files conform to published specifications.
9093
</p>
9194

@@ -135,6 +138,16 @@ <h2>
135138
</li>
136139
</ul>
137140
</dd>
141+
<dt>
142+
HTML 5 files
143+
</dt>
144+
<dd>
145+
<ul class="squashed">
146+
<li>
147+
UTF-8
148+
</li>
149+
</ul>
150+
</dd>
138151
<dt>
139152
XHTML files
140153
</dt>

Src/ActiveText.UHTMLRenderer.pas

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ procedure TActiveTextHTML.InitialiseTagInfoMap;
145145
function TActiveTextHTML.MakeClosingTag(const Elem: IActiveTextActionElem):
146146
string;
147147
begin
148-
Result := THTML.ClosingTag(fTagInfoMap[Elem.Kind].Name);
148+
Result := TXHTML.ClosingTag(fTagInfoMap[Elem.Kind].Name);
149149
end;
150150

151151
function TActiveTextHTML.MakeOpeningTag(const Elem: IActiveTextActionElem):
@@ -160,7 +160,7 @@ function TActiveTextHTML.MakeOpeningTag(const Elem: IActiveTextActionElem):
160160
Attrs := THTMLAttributes.Create;
161161
Attrs.Add('class', fCSSStyles.ElemClasses[Elem.Kind])
162162
end;
163-
Result := THTML.OpeningTag(fTagInfoMap[Elem.Kind].Name, Attrs);
163+
Result := TXHTML.OpeningTag(fTagInfoMap[Elem.Kind].Name, Attrs);
164164
end;
165165

166166
function TActiveTextHTML.Render(ActiveText: IActiveText): string;
@@ -242,7 +242,7 @@ function TActiveTextHTML.RenderText(const TextElem: IActiveTextTextElem):
242242
end
243243
else
244244
Result := '';
245-
Result := Result + THTML.Entities(TextElem.Text);
245+
Result := Result + TXHTML.Entities(TextElem.Text);
246246
end;
247247

248248
{ TActiveTextHTML.TCSSStyles }

Src/Browser.UHighlighter.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ function TWBHighlighter.HighlightWord(const Word: string;
194194
begin
195195
// Apply highlight to found text by spanning it with highlight style
196196
SpanAttrs := THTMLAttributes.Create('style', fHighLightStyle);
197-
Range.pasteHTML(THTML.CompoundTag('span', SpanAttrs, Range.htmlText));
197+
Range.pasteHTML(TXHTML.CompoundTag('span', SpanAttrs, Range.htmlText));
198198
Inc(Result);
199199
end
200200
else

Src/FmAboutDlg.pas

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,15 @@ function TAboutDlg.ContribListHTML(ContribList: IStringList):
312312
begin
313313
for Contributor in ContribList do
314314
Result := Result
315-
+ THTML.CompoundTag('div', THTML.Entities(Contributor))
315+
+ TXHTML.CompoundTag('div', TXHTML.Entities(Contributor))
316316
+ EOL;
317317
end
318318
else
319319
begin
320320
// List couldn't be found: display warning message
321321
DivAttrs := THTMLAttributes.Create('class', 'warning');
322-
Result := THTML.CompoundTag(
323-
'div', DivAttrs, THTML.Entities(sNoContributors)
322+
Result := TXHTML.CompoundTag(
323+
'div', DivAttrs, TXHTML.Entities(sNoContributors)
324324
);
325325
end;
326326
end;
@@ -484,15 +484,15 @@ procedure TAboutDlg.InitHTMLFrames;
484484
'DBLicense',
485485
StrIf(
486486
fMetaData.GetLicenseInfo.URL <> '',
487-
THTML.CompoundTag(
487+
TXHTML.CompoundTag(
488488
'a',
489489
THTMLAttributes.Create([
490490
THTMLAttribute.Create('href', fMetaData.GetLicenseInfo.URL),
491491
THTMLAttribute.Create('class', 'external-link')
492492
]),
493-
THTML.Entities(fMetaData.GetLicenseInfo.Name)
493+
TXHTML.Entities(fMetaData.GetLicenseInfo.Name)
494494
),
495-
THTML.Entities(fMetaData.GetLicenseInfo.Name)
495+
TXHTML.Entities(fMetaData.GetLicenseInfo.Name)
496496
)
497497
);
498498
Tplt.ResolvePlaceholderHTML(

Src/FmCompErrorDlg.pas

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ function TCompErrorDlg.TCompilerLog.LogListHTML: string;
341341
begin
342342
Result := '';
343343
for Line in fLog do
344-
Result := Result + THTML.CompoundTag('li', THTML.Entities(Line)) + EOL;
344+
Result := Result + TXHTML.CompoundTag('li', TXHTML.Entities(Line)) + EOL;
345345
end;
346346

347347
end.

Src/FrSourcePrefs.pas

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ implementation
121121

122122
resourcestring
123123
// File type descriptions
124-
sHTMLFileDesc = 'HTML';
124+
sHTML5FileDesc = 'HTML 5';
125+
sXHTMLFileDesc = 'XHTML';
125126
sRTFFileDesc = 'Rich text';
126127
sPascalFileDesc = 'Pascal';
127128
sTextFileDesc = 'Plain text';
@@ -130,7 +131,7 @@ implementation
130131
const
131132
// Maps source code file types to descriptions
132133
cFileDescs: array[TSourceFileType] of string = (
133-
sTextFileDesc, sPascalFileDesc, sHTMLFileDesc, sRTFFileDesc
134+
sTextFileDesc, sPascalFileDesc, sHTML5FileDesc, sXHTMLFileDesc, sRTFFileDesc
134135
);
135136

136137

Src/Help/HTML/dlg_savesnippet.htm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,13 @@ <h1>
7575
file except that the extension is .txt rather than .inc.
7676
</li>
7777
<li>
78-
An HTML file (.html) &ndash; This option writes the source code out as a
78+
A HTML 5 file (.html) &ndash; This option writes the source code out as a
79+
valid HTML 5 document that uses embedded CSS to format the code. The
80+
source code will be syntax highlighted if the <em>Use syntax
81+
highlighting</em> check box is checked.
82+
</li>
83+
<li>
84+
An XHTML file (.html) &ndash; This option writes the source code out as a
7985
valid XHTML document that uses embedded CSS to format the code. The
8086
source code will be syntax highlighted if the <em>Use syntax
8187
highlighting</em> check box is checked.

Src/Help/HTML/dlg_saveunit.htm

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,13 @@ <h1>
6060
file except that the extension is .txt rather than .pas.
6161
</li>
6262
<li>
63-
An HTML file (.html) &ndash; This option writes the source code out as a
63+
A HTML 5 file (.html) &ndash; This option writes the source code out as a
64+
valid HTML 5 document that uses embedded CSS to format the code. The
65+
source code will be syntax highlighted if the <em>Use syntax
66+
highlighting</em> check box is checked.
67+
</li>
68+
<li>
69+
An XHTML file (.html) &ndash; This option writes the source code out as a
6470
valid XHTML document that uses embedded CSS to format the code. The
6571
source code will be syntax highlighted if the <em>Use syntax
6672
highlighting</em> check box is checked.

Src/Help/HTML/menu_file.htm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ <h1>
3737
to a file. The file contains an annotated fragment of Pascal code. The
3838
<a href="dlg_savesnippet.htm">Save Annotated Source</a> dialogue box
3939
is displayed and is used to determine the format of the file being
40-
saved. This can be plain text, a Pascal include file, HTML or RTF. The
41-
latter two options can be syntax highlighted. This option is available
40+
saved. This can be plain text, a Pascal include file, HTML 5, XHTML or RTF. The
41+
latter three options can be syntax highlighted. This option is available
4242
only for <a href="snippet_routine.htm">routine</a> snippets or
4343
categories containing routines. Any snippets in a category that are
4444
not routines are ignored.
@@ -74,7 +74,7 @@ <h1>
7474
snippets and saves it to file. The <a href="dlg_saveunit.htm">Save
7575
Unit</a> dialogue box is displayed and is used to determine the format
7676
of the file being saved. The format can be plain text, a Pascal unit
77-
file, HTML or RTF. The latter two options can be syntax highlighted.
77+
file, HTML 5, XHTML or RTF. The latter three options can be syntax highlighted.
7878
<a href="snippet_freeform.htm">Freeform</a> snippets are not included
7979
in the unit.
8080
</td>

Src/Hiliter.UFileHiliter.pas

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ function TFileHiliter.Hilite(const SourceCode, DocTitle: string): TEncodedData;
9999
begin
100100
case fFileType of
101101
sfRTF: HilitedDocCls := TRTFDocumentHiliter;
102-
sfHTML: HilitedDocCls := TXHTMLDocumentHiliter;
102+
sfXHTML: HilitedDocCls := TXHTMLDocumentHiliter;
103+
sfHTML5: HilitedDocCls := THTML5DocumentHiliter;
103104
else HilitedDocCls := TNulDocumentHiliter;
104105
end;
105106
if fWantHiliting and IsHilitingSupported(fFileType) then
@@ -116,7 +117,7 @@ class function TFileHiliter.IsHilitingSupported(
116117
@return True if file type supports highlighting, false if not.
117118
}
118119
begin
119-
Result := FileType in [sfHTML, sfRTF];
120+
Result := FileType in [sfHTML5, sfXHTML, sfRTF];
120121
end;
121122

122123
end.

0 commit comments

Comments
 (0)