@@ -158,47 +158,75 @@ destructor TSWAGImporter.Destroy;
158
158
end ;
159
159
160
160
function TSWAGImporter.ExtraBoilerplate : IActiveText;
161
- resourcestring
162
- sStatementPrefix = ' This snippet was imported from a packet in the ' ;
163
- sStatementLinkText = ' SWAG Pascal Archive' ;
164
- sStatementPostfix = ' . ' ;
165
- sLicense = ' The code packets in the archive pages are generally freeware or '
166
- + ' public domain as defined by any accompanying comments and copyright '
167
- + ' statements. Contact the author if in doubt.' ;
168
- // TODO: Check license wording against SWAG docs
169
- // URL of web page referenced from links in boilerplate
170
- SWAGDBURI = ' https://github.com/delphidabbler/swag' ;
171
- var
172
- // Active text attributes for link included in boilerplate
173
- SWAGDBURIAttr: IActiveTextAttrs;
174
- begin
175
- if not Assigned(fExtraBoilerplate) then
161
+
162
+ procedure AddText (const Text: string);
176
163
begin
177
- SWAGDBURIAttr := TActiveTextFactory.CreateAttrs(
178
- TActiveTextAttr.Create(' href' , SWAGDBURI)
179
- );
180
- fExtraBoilerplate := TActiveTextFactory.CreateActiveText;
181
164
fExtraBoilerplate.AddElem(
182
- TActiveTextFactory.CreateActionElem(ekPara, fsOpen )
165
+ TActiveTextFactory.CreateTextElem(Text )
183
166
);
184
- fExtraBoilerplate.AddElem(
185
- TActiveTextFactory.CreateTextElem(sStatementPrefix)
167
+ end ;
168
+
169
+ procedure AddLink (const Text, URI: string);
170
+ var
171
+ HRefAttr: IActiveTextAttrs;
172
+ begin
173
+ HRefAttr := TActiveTextFactory.CreateAttrs(
174
+ TActiveTextAttr.Create(' href' , URI)
186
175
);
187
176
fExtraBoilerplate.AddElem(
188
- TActiveTextFactory.CreateActionElem(ekLink, SWAGDBURIAttr , fsOpen)
177
+ TActiveTextFactory.CreateActionElem(ekLink, HRefAttr , fsOpen)
189
178
);
179
+ AddText(Text);
190
180
fExtraBoilerplate.AddElem(
191
- TActiveTextFactory.CreateTextElem(sStatementLinkText )
181
+ TActiveTextFactory.CreateActionElem(ekLink, HRefAttr, fsClose )
192
182
);
183
+ end ;
184
+
185
+ resourcestring
186
+ sStatementPrefix = ' This snippet was imported from a packet in the ' ;
187
+ sStatementLinkText = ' SWAG Pascal Code Collection' ;
188
+ sStatementPostfix = ' . ' ;
189
+ sLicense1 = ' Unless the snippet states otherwise it is deemed to be licensed '
190
+ + ' under either the ' ;
191
+ sLGPLLinkText = ' GNU Lesser General Public License v2.1' ;
192
+ sLicense2 = ' (source code) or the ' ;
193
+ sFDLLinkText = ' GNU Free Documentation License v1.2' ;
194
+ sLicense3 = ' (other documents), as appropriate. For further information '
195
+ + ' please see the ' ;
196
+ sSWAGLicenseLinkText = ' SWAG License document' ;
197
+ sLicense4 = ' .' ;
198
+ const
199
+ // URLs of web pages referenced from links in boilerplate
200
+ SWAGProjectURL = ' https://github.com/delphidabbler/swag' ;
201
+ SWAGLicenseURL = SWAGProjectURL + ' /blob/master/LICENSE.md' ;
202
+ LGPLLicenseURL = ' https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html' ;
203
+ FDPLicenseURL = ' https://www.gnu.org/licenses/old-licenses/fdl-1.2.html' ;
204
+
205
+ begin
206
+ if not Assigned(fExtraBoilerplate) then
207
+ begin
208
+ fExtraBoilerplate := TActiveTextFactory.CreateActiveText;
209
+ // Intro para
193
210
fExtraBoilerplate.AddElem(
194
- TActiveTextFactory.CreateActionElem(ekLink, SWAGDBURIAttr, fsClose )
211
+ TActiveTextFactory.CreateActionElem(ekPara, fsOpen )
195
212
);
213
+ AddText(sStatementPrefix);
214
+ AddLink(sStatementLinkText, SWAGProjectURL);
215
+ AddText(sStatementPostfix);
196
216
fExtraBoilerplate.AddElem(
197
- TActiveTextFactory.CreateTextElem(sStatementPostfix )
217
+ TActiveTextFactory.CreateActionElem(ekPara, fsClose )
198
218
);
219
+ // License para
199
220
fExtraBoilerplate.AddElem(
200
- TActiveTextFactory.CreateTextElem(sLicense )
221
+ TActiveTextFactory.CreateActionElem(ekPara, fsOpen )
201
222
);
223
+ AddText(sLicense1);
224
+ AddLink(sLGPLLinkText, LGPLLicenseURL);
225
+ AddText(sLicense2);
226
+ AddLink(sFDLLinkText, FDPLicenseURL);
227
+ AddText(sLicense3);
228
+ AddLink(sSWAGLicenseLinkText, SWAGLicenseURL);
229
+ AddText(sLicense4);
202
230
fExtraBoilerplate.AddElem(
203
231
TActiveTextFactory.CreateActionElem(ekPara, fsClose)
204
232
);
0 commit comments