%
var
aTopicList: THndTopicsInfoArray;
var
aKeywordList: THndKeywordsInfoArray;
var
nBlocLevel: integer = 0;
var
nCurTopic, nTopicKind, nCurTopicLevel, nDif, nClose, nCurTopicChildrenCnt, nCurTopicIcon: integer;
var
nCurKeyword, nCurKeywordLevel, nCurKeywordChildrenCnt, nCurKeywordTopic: integer;
var
sTopicUrl, sCurrentKeyword, sTopicClass, sTopicIconData, sKeywordClass, sKeywordLink, sKeywordOnClick, sKeywordOnCData: string;
var
aAssociatedTopics: array of string;
// Return the topic extension, starting with a dot
function GetTopicExtension: string;
begin
Result := Trim(HndGeneratorInfo.TemplateInfo.TopicExtension);
if ((Length(Result) > 0) and (Result[1] <> '.')) then
Result := '.' + Result;
end;
begin
// Need BOM for UTF8 files
HndGeneratorInfo.BOMOutput := True;
HndGeneratorInfo.CurrentFile := 'toc' + GetTopicExtension();
%>
<% print(HTMLEncode(HndProjects.GetProjectTitle())); %> - Table of Contents
<% if HndGeneratorInfo.GetCustomSettingValue('TocShow') then begin %>
');
nBlocLevel := nBlocLevel + 1;
end
else begin
print('
');
end;
// Close the last topic
if (HndTopicsEx.GetTopicNextGenerated(HndGeneratorInfo.CurrentTopic, True) = '') then
begin
while nBlocLevel > 0 do
begin
print('');
nBlocLevel := nBlocLevel - 1;
end;
end;
end;
%>
<%
end;
// --- Keywords TAB --- //
if HndGeneratorInfo.GetCustomSettingValue('TocKeywordsShow') then begin
%>
<%
nBlocLevel := 0;
aKeywordList := HndKeywords.GetKeywordList(False);
for nCurKeyword := 0 to length(aKeywordList) - 1 do
begin
sCurrentKeyword := aKeywordList[nCurKeyword].id;
nCurKeywordLevel := HndKeywords.GetKeywordLevel(sCurrentKeyword);
nCurKeywordChildrenCnt := HndKeywords.GetKeywordDirectChildrenCount(sCurrentKeyword);
aAssociatedTopics := HndTopicsKeywordsEx.GetGeneratedTopicsAssociatedWithKeyword(sCurrentKeyword);
if Length(aAssociatedTopics) > 0 then
begin
sKeywordLink := format('%s%s', [HndTopics.GetTopicHelpId(aAssociatedTopics[0]), GetTopicExtension()]);
sKeywordOnCData := '[';
sKeywordOnClick := '[';
for nCurKeywordTopic := 0 to Length(aAssociatedTopics) - 1 do
begin
if nCurKeywordTopic > 0 then
begin
sKeywordOnCData := sKeywordOnCData + ',';
sKeywordOnClick := sKeywordOnClick + ',';
end;
sKeywordOnCData := sKeywordOnCData + format('[\''%s\'',\''%s%s\'']', [StringReplace(HTMLEncode(HndTopics.GetTopicCaption(aAssociatedTopics[nCurKeywordTopic])), '''', '\\\''', [rfReplaceAll]), HndTopics.GetTopicHelpId(aAssociatedTopics[nCurKeywordTopic]), GetTopicExtension()]);
sKeywordOnClick := sKeywordOnClick + format('[''%s'',''%s%s'']', [StringReplace(HTMLEncode(HndTopics.GetTopicCaption(aAssociatedTopics[nCurKeywordTopic])), '''', '\''', [rfReplaceAll]), HndTopics.GetTopicHelpId(aAssociatedTopics[nCurKeywordTopic]), GetTopicExtension()]);
end;
sKeywordOnCData := sKeywordOnCData + ']';
sKeywordOnClick := sKeywordOnClick + ']';
end
else begin
sKeywordLink := '#';
sKeywordOnCData := '[]';
sKeywordOnClick := '[]';
end;
// Close the previous keywords
if ((nCurKeyword > 0) and (nCurKeywordLevel < HndKeywords.GetKeywordLevel(aKeywordList[nCurKeyword - 1].id))) then
begin
nDif := HndKeywords.GetKeywordLevel(aKeywordList[nCurKeyword - 1].id) - nCurKeywordLevel;
for nClose := 0 to nDif - 1 do
begin
print('
');
nBlocLevel := nBlocLevel - 1;
end;
end;
// Keyword class
if nCurKeywordChildrenCnt > 0 then sKeywordClass := 'folder'
else sKeywordClass := 'file';
%>
');
nBlocLevel := nBlocLevel + 1;
end
else begin
print('
');
end;
// Close the last keyword
if (HndKeywords.GetKeywordNext(sCurrentKeyword) = '') then
begin
while nBlocLevel > 0 do
begin
print('');
nBlocLevel := nBlocLevel - 1;
end;
end;
end;
%>
<%
end;
// --- Search TAB --- //
if HndGeneratorInfo.GetCustomSettingValue('TocSearchShow') then begin
%>