Skip to content

Commit 3ef4f1e

Browse files
committed
Merge branch 'release/4.26.0'
Release v4.26.0
2 parents a8e706c + 9dde2c6 commit 3ef4f1e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+3334
-370
lines changed

CHANGELOG.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@ Releases are listed in reverse version number order.
66

77
> Note that _CodeSnip_ v4 was developed in parallel with v3 for a while. As a consequence some v3 releases have later release dates than early v4 releases.
88
9+
## Release v4.26.0 of 02 May 2025
10+
11+
* Updated the dialogue box displayed when saving units and annotated source code [issue #166]:
12+
* The _File Encoding_ drop down list control is disabled if there is only one encoding option.
13+
* Updated and clarified the naming of encodings in the _File Encoding_ drop down list.
14+
* The sole encoding option displayed for the _Rich text file_ file type was changed from the erroneous ANSI to the correct ASCII.
15+
* Fixed bug where, when ANSI encoding was selected in the _Save Unit_ and _Save Annotated Source_ dialogue boxes, snippets containing characters not supported in the default locale's code page were being rendered diffently in the Preview dialogue box to when saved to file [issue #164]. The previewed code is now the same as that of the saved source code.
16+
* Updated file formats available when the _File | Save Snippet Information_ menu option is selected:
17+
* Syntax highlighting of the existing RTF format output is now optional.
18+
* Added the option to save snippet information in the following new formats:
19+
* Plain text, in UTF-8, UTF-16LE, UTF-16BE and the system locale's default ANSI code page. [issue #162]
20+
* HMTL 5 with optional syntax highlighting, in UTF-8 format [issue #153].
21+
* XHTML with optional syntax highlighting, in UTF-8 format [issue #153].
22+
* Markdown, in UTF-8, UTF-16LE, UTF-16BE and the system locale's default ANSI code page [issue #155].
23+
* Changed the _Save Snippet Information_ dialogue box:
24+
* It is now based on that used for saving unit and annotated source code in that file encoding and snippet highlighting can be customised where relevant, although the _Comment style_ controls are disabled since they are not relevant.
25+
* The suggested file name was changed from "SnippetInfo" to the display name of the selected snippet.
26+
* The dialogue box caption now contains the display name of the selected snippet.
27+
* Changed the title of the _Save Annotated Source_ dialogue box when displaying snippets.
28+
* Added option to prevent descriptive comments from appearing in the implementation section of generated units. A check box for this option has been added to the _Code Formatting_ tab of the _Preferences_ dialogue box [issue #85].
29+
* The _Help | CodeSnip News Blog_ menu item was changed to link to the [DelphiDabbler Blog](https://delphidabbler.blogspot.com/) instead of the CodeSnip Blog, because the latter is to be closed down. The menu item was renamed to _Help | CodeSnip News On DelphiDabbler Blog_ [issue #161].
30+
* Improved how the CSS used in generated HTML 5 and XHTML files is generated:
31+
* The ordering of CSS selectors can now be pre-determined.
32+
* CSS lengths and sizes can now be specified in units, such as `em`, instead of just pixels.
33+
* Refactored the `USourceGen` unit to remove an unnecessary dependency on user preferences [issue #167].
34+
* Updated the help file:
35+
* Re changes when saving snippet information [issue #163].
36+
* Re changes to the _Save Unit_ and _Save Annotated Source_ dialogue boxes.
37+
* Re changes to the blog linked from the _Help_ menu.
38+
* Re the new option to inhibit comments in the implementation sections of generated units.
39+
* Updated documentation:
40+
* File format documentation was changed re the addition of the Markdown file format and the changes to the encodings used in saved files.
41+
* Read-me files were updated re the change of news blog.
42+
943
## Release v4.25.0 of 19 April 2025
1044

1145
* Added new feature to save snippet information to file in RTF format using the new _File | Save Snippet Information_ menu option [issue #140].
@@ -15,7 +49,7 @@ Releases are listed in reverse version number order.
1549
* Overhauled rich text format processing:
1650
* Fixed bug where Unicode characters that don't exist in the system code page were not being displayed correctly [issue #157].
1751
* Fixed potential bug where some reserved ASCII characters may not be escaped properly [issue #159].
18-
* Refactored and improved the rich text handling code [issue #100].
52+
* Refactored and improved the rich text handling code [issue #100].
1953
* Corrected the copyright date displayed in the About Box to include 2025 [issue #149].
2054
* Documentation changes:
2155
* Fixed error in the export file formation documentation and related help topic [issue #151].

Docs/Design/FileFormats/config.html

+8-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ <h3>
167167
</p>
168168

169169
<p>
170-
There have been several versions of this file. The current one is version 19. The change to version 19 came with CodeSnip v4.21.0 and the addition of the [Compilers] section and the <code class="key">CanAutoInstall</code> key in the [Cmp:XXX] sections.
170+
There have been several versions of this file. The current one is version 20. The change to version 20 came with CodeSnip v4.26.0 and the addition of the <code class="key">UseCommentsInUnitImpl</code> key in the <code>[Prefs:SourceCode]</code> section.
171171
</p>
172172

173173
<p>
@@ -771,7 +771,7 @@ <h4>
771771
The version number of the config file. Incremented whenever the file format changes. If this section or this value is missing then the default value is <code class="value">1</code>.
772772
</div>
773773
<div class="half-spaced">
774-
The current value is <code class="value">19</code>.
774+
The current value is <code class="value">20</code>.
775775
</div>
776776
</dd>
777777
<dt>
@@ -1262,6 +1262,12 @@ <h4>
12621262
<dd>
12631263
Flag indicating whether multi-paragraph snippet descriptions are to be truncated to the first paragraph only in documentation comments. <code class="value">True</code> &rArr; truncate the description; <code class="value">False</code> &rArr; use the full description.
12641264
</dd>
1265+
<dt>
1266+
<code class="key">UseCommentsInUnitImpl</code> (Boolean)
1267+
</dt>
1268+
<dd>
1269+
Flag indicating whether source code comments are repeated in a generated unit's implementation section. <code class="value">True</code> &rArr; emit comments in both the interface and implementation sections; <code class="value">False</code> &rArr; emit comments in the interface section only.
1270+
</dd>
12651271
<dt>
12661272
<code class="key">UseSyntaxHiliting</code> (Boolean)
12671273
</dt>

Docs/Design/FileFormats/saved.html

+46-13
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,38 @@ <h2>
5151

5252
<ol>
5353
<li>
54-
By saving snippet information to file from the <em>File | Save Snippet Information</em> menu option.
54+
By saving snippet information using the <em>File | Save Snippet Information</em> menu option.
5555
</li>
5656
<li>
57-
By saving snippets to file from the <em>File | Save Snippet</em> menu option.
57+
By saving snippets using the <em>File | Save Snippet</em> menu option.
5858
</li>
5959
<li>
60-
By saving units to file from the <em>File | Save Unit</em> menu option.
60+
By saving units using the <em>File | Save Unit</em> menu option.
6161
</li>
6262
</ol>
6363

6464
<p>
65-
In the first case the snippet is always saved in rich text format.
65+
In the first case the snippet information can be saved as one of the following file types:
6666
</p>
6767

68+
<ul>
69+
<li>
70+
Plain text.
71+
</li>
72+
<li>
73+
HTML 5 files.
74+
</li>
75+
<li>
76+
XHTML files.
77+
</li>
78+
<li>
79+
Rich text files.
80+
</li>
81+
<li>
82+
Markdown files.
83+
</li>
84+
</ul>
85+
6886
<p>
6987
In the second two cases the following file types can be chosen by the user:
7088
</p>
@@ -88,7 +106,7 @@ <h2>
88106
</ul>
89107

90108
<p>
91-
There is no specific file format for these files, except that HTML 5, XHTML and RTF
109+
There is no specific file format for these files, except that HTML 5, XHTML, RTF and Markdown
92110
files conform to published specifications.
93111
</p>
94112

@@ -97,11 +115,7 @@ <h2>
97115
</h2>
98116

99117
<p>
100-
In the first case the RTF is always saved in ASCII format.
101-
</p>
102-
103-
<p>
104-
In the 2nd and 3rd cases the encodings used depend on the file type and user choice. Different file
118+
The available encodings depend on the file type and user choice. Different file
105119
types have different encoding choices, as follows:
106120
</p>
107121

@@ -118,10 +132,10 @@ <h2>
118132
UTF-8
119133
</li>
120134
<li>
121-
Unicode little endian (UTF16-LE)
135+
UTF-16LE
122136
</li>
123137
<li>
124-
Unicode big endian (UTF16-BE)
138+
UTF-16BE
125139
</li>
126140
</ul>
127141
</dd>
@@ -164,7 +178,26 @@ <h2>
164178
<dd>
165179
<ul class="squashed">
166180
<li>
167-
ANSI (system default code page). ASCII format is actually used.
181+
ASCII
182+
</li>
183+
</ul>
184+
</dd>
185+
<dt>
186+
Markdown
187+
</dt>
188+
<dd>
189+
<ul class="squashed">
190+
<li>
191+
ANSI (system default code page)
192+
</li>
193+
<li>
194+
UTF-8
195+
</li>
196+
<li>
197+
UTF-16LE
198+
</li>
199+
<li>
200+
UTF-16BE
168201
</li>
169202
</ul>
170203
</dd>

Docs/ReadMe-portable.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ Updating the Program
144144
Updates are published on GitHub. See
145145
https://github.com/delphidabbler/codesnip/releases
146146

147-
News of new updates is published on the CodeSnip Blog:
148-
https://codesnip-app.blogspot.com/.
147+
News of new updates is published on the DelphiDabbler Blog:
148+
https://delphidabbler.blogspot.com/.
149149

150150

151151
Known Installation and Upgrading Issues
@@ -248,6 +248,9 @@ Thanks to:
248248
+ The authors of the third party source code and images used by the program. See
249249
the program's about box or License.html for details.
250250

251+
+ SirRufo for helping to fix a long standing bug where CodeSnip would crash on
252+
resuming from hibernation.
253+
251254
+ Various contributors to the DelphiDabbler Code Snippets database. Names of
252255
contributors are listed in the program's About Box (use the "Help | About"
253256
menu option then select the "About the Database" tab). The list will be empty

Docs/ReadMe-standard.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,8 @@ Updating the Program
179179
Updates are published on GitHub. See
180180
https://github.com/delphidabbler/codesnip/releases
181181

182-
News of new updates is published on the CodeSnip Blog:
183-
https://codesnip-app.blogspot.com/.
182+
News of new updates is published on the DelphiDabbler Blog:
183+
https://delphidabbler.blogspot.com/.
184184

185185

186186
Known Installation and Upgrading Issues
@@ -293,6 +293,9 @@ Thanks to:
293293
+ geoffsmith82 and an anonymous contributor for information about getting
294294
CodeSnip to work with Delphi XE2.
295295

296+
+ SirRufo for helping to fix a long standing bug where CodeSnip would crash on
297+
resuming from hibernation.
298+
296299
+ The authors of the third party source code and images used by the program. See
297300
the program's about box or License.html for details.
298301

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The following support is available to CodeSnip users:
3535
* A comprehensive help file.
3636
* A read-me file that discusses installation, configuration, updating and known issues. There are different versions of this file for each edition of CodeSnip: one for the [standard edition](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe-standard.txt) and another for the [portable edition](https://raw.githubusercontent.com/delphidabbler/codesnip/master/Docs/ReadMe-portable.txt). [^1]
3737
* The [Using CodeSnip FAQ](https://github.com/delphidabbler/codesnip-faq/blob/master/UsingCodeSnip.md).
38-
* The [CodeSnip Blog](https://codesnip-app.blogspot.co.uk/).
38+
* The [DelphiDabbler Blog](https://delphidabbler.blogspot.co.uk/) that provides CodeSnip news.
3939
* CodeSnip's own [Web Page](https://delphidabbler.com/software/codesnip).
4040

4141
There's also plenty of info available on how to compile CodeSnip from source - see below.

Src/ActiveText.UHTMLRenderer.pas

+11-5
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ TCSSStyles = class(TObject)
6565
fTagInfoMap: TTagInfoMap;
6666
fIsStartOfTextLine: Boolean;
6767
fLINestingDepth: Cardinal;
68+
fTagGen: THTMLClass;
6869
const
6970
IndentMult = 2;
7071
procedure InitialiseTagInfoMap;
@@ -73,7 +74,7 @@ TCSSStyles = class(TObject)
7374
function MakeOpeningTag(const Elem: IActiveTextActionElem): string;
7475
function MakeClosingTag(const Elem: IActiveTextActionElem): string;
7576
public
76-
constructor Create;
77+
constructor Create(const ATagGenerator: THTMLClass = nil);
7778
destructor Destroy; override;
7879
function Render(ActiveText: IActiveText): string;
7980
end;
@@ -87,13 +88,18 @@ implementation
8788

8889
{ TActiveTextHTML }
8990

90-
constructor TActiveTextHTML.Create;
91+
constructor TActiveTextHTML.Create(const ATagGenerator: THTMLClass);
9192
begin
9293
inherited Create;
9394
fCSSStyles := TCSSStyles.Create;
9495
fBuilder := TStringBuilder.Create;
9596
fLINestingDepth := 0;
9697
InitialiseTagInfoMap;
98+
if not Assigned(ATagGenerator) then
99+
// default behaviour before ATagGenerator parameter was added
100+
fTagGen := TXHTML
101+
else
102+
fTagGen := ATagGenerator;
97103
end;
98104

99105
destructor TActiveTextHTML.Destroy;
@@ -145,7 +151,7 @@ procedure TActiveTextHTML.InitialiseTagInfoMap;
145151
function TActiveTextHTML.MakeClosingTag(const Elem: IActiveTextActionElem):
146152
string;
147153
begin
148-
Result := TXHTML.ClosingTag(fTagInfoMap[Elem.Kind].Name);
154+
Result := fTagGen.ClosingTag(fTagInfoMap[Elem.Kind].Name);
149155
end;
150156

151157
function TActiveTextHTML.MakeOpeningTag(const Elem: IActiveTextActionElem):
@@ -160,7 +166,7 @@ function TActiveTextHTML.MakeOpeningTag(const Elem: IActiveTextActionElem):
160166
Attrs := THTMLAttributes.Create;
161167
Attrs.Add('class', fCSSStyles.ElemClasses[Elem.Kind])
162168
end;
163-
Result := TXHTML.OpeningTag(fTagInfoMap[Elem.Kind].Name, Attrs);
169+
Result := fTagGen.OpeningTag(fTagInfoMap[Elem.Kind].Name, Attrs);
164170
end;
165171

166172
function TActiveTextHTML.Render(ActiveText: IActiveText): string;
@@ -242,7 +248,7 @@ function TActiveTextHTML.RenderText(const TextElem: IActiveTextTextElem):
242248
end
243249
else
244250
Result := '';
245-
Result := Result + TXHTML.Entities(TextElem.Text);
251+
Result := Result + fTagGen.Entities(TextElem.Text);
246252
end;
247253

248254
{ TActiveTextHTML.TCSSStyles }

0 commit comments

Comments
 (0)