Migrating scripts from V6 to V7
HelpNDoc 7.0 introduces a completely new script engine. It is still based on the Pascal language but some differences with previous versions are listed bellow. If upgrading from an earlier version, other modifications need to be applied: Migrating scripts and templates
HelpNDoc v6 |
HelpNDoc v7 |
Remarks |
var |
var |
Variables with different types must use the var keyword for each type |
const |
const |
Constants with different types must use the const keyword for each type |
SetLength(ARRAY_OR_STRING, NEW_LENGTH) |
ARRAY_OR_STRING.SetLength(NEW_LENGTH) |
The SetLength() method can't be used for arrays anymore |
Print 'VALUE' |
Print('VALUE') |
The Print() method requires parenthesis |
procedure proc1(); |
procedure proc2(); |
If a procedure calls another one, it must be declared before that method. Alternatively, proc2 can be declared before proc1 as a forward method: procedure proc2; forward; |
HndGeneratorInfo.AssetsList: TStringList |
HndGeneratorInfo.GetAssetsList(): TStringDynArray |
Method return type has changed from TStringList to TStringDynArray |
HndGeneratorInfo.GeneratedFiles: TStringList |
HndGeneratorInfo.GetGeneratedFiles(): TStringDynArray |
Method return type has changed from TStringList to TStringDynArray |
HndBuildsEx.GetBuildByName(const aBuildName: string) |
HndBuilds.GetBuildWithName(const aBuildName: string) |
Method has moved to another object and has been renamed |
Code only template files
Template files which only contains code must now encapsulate code within the <% and %> delimiters.
Frequent errors in custom templates
Here are some possible errors that you might see with custom templates after you upgrade. Refer to the table above to update custom templates and remove those errors:
- [Error] aliases.pas.html(4, 5): Unknown name "nCurTopic"
- [Error] context.pas.html(4, 5): Unknown name "nCurTopic"
- [Error] keywords.pas.hhk(4, 2): Unknown name "nBlocLevel"
- [Error] topics.pas.html(4,5): unknown name sDefaultTopicId