%
var
aTopicList: THndTopicsInfoArray;
sDefaultTopicId: string;
nCurTopic, nHeaderKind, nFooterKind: integer;
sTopicHeader, sTopicFooter, sTopicContent: string;
sTocContent: string;
sSitemapData: string;
isNextDefaultTheIndex, isGeneratingIndex: Boolean;
isDefaultSearchDataProcessed, doAddSearchDataForThisTopic: Boolean;
// Generate the CSS for the whole project
procedure GenerateContentCss();
var
sCssContent: string;
begin
HndGeneratorInfo.CurrentFile := 'css\hnd.content.css';
sCssContent := HndProjects.GetProjectCssContent();
sCssContent := StringReplace(sCssContent, 'body, table,', '.main-content, .main-content table', [rfIgnoreCase]);
print(sCssContent);
end;
// Generate the search data
procedure GenerateSearchData();
begin
HndGeneratorInfo.CurrentFile := 'js\hndsd.min.js';
print(HndJsSearchEngine.GetJsData());
// Clear the search engine
HndJsSearchEngine.ClearSearchData();
end;
// Generate the sitemap
procedure SitemapGenerate();
begin
// Do we need to generate it ?
if not HndGeneratorInfo.GetCustomSettingValue('SitemapGenerate') then
Exit;
// Add the home URL
SitemapAdd('', True);
// Generate the file
HndGeneratorInfo.CurrentFile := 'sitemap.xml';
print('';
// Add link
if aLogoLink <> '' then
begin
Result := '' + Result + '';
end;
end;
finally
aLogoContent.Free;
end;
end;
end;
// Returns the theme CSS
function GetThemeAsHtml: string;
var
aThemeName: string;
begin
aThemeName := LowerCase(HndGeneratorInfo.GetCustomSettingValue('Theme'));
Result := Format('', [aThemeName]);
end;
// Returns HTML/CSS to customize the width of the Toc
function GetTocWidthAsHtml: string;
var
aSize: integer;
begin
Result := '';
// Get value
aSize := StrToIntDef(HndGeneratorInfo.GetCustomSettingValue('TocWidth'), 0);
// Return content
if (aSize > 0) then
begin
Result := Format('', [aSize, aSize, aSize + 14]);
end;
end;
// Returns a list of keywords
function GetTopicKeywordsAsHtml: string;
var
aTopicKeywords: array of string;
nCurKeyword: integer;
begin
Result := '';
aTopicKeywords := HndTopicsKeywords.GetKeywordsAssociatedWithTopic(HndGeneratorInfo.CurrentTopic);
for nCurKeyword := 0 to High(aTopicKeywords) do
begin
if nCurKeyword > 0 then Result := Result + ',';
Result := Result + HTMLEncode(HndKeywords.GetKeywordCaption(aTopicKeywords[nCurKeyword]));
end;
end;
// Returns the formatted breadcrumb for the current topic
function GetTopicBreadCrumbAsHtml: string;
var
aBreadCrumb: array of string;
sRelativeTopic: string;
nCurParent: Integer;
begin
Result := '';
// Create the breadcrumb
SetLength(aBreadCrumb, 0);
if HndGeneratorInfo.GetCustomSettingValue('ShowBreadCrumbs') then
begin
sRelativeTopic := HndTopics.GetTopicParent(HndGeneratorInfo.CurrentTopic);
while (sRelativeTopic <> '') and (sRelativeTopic <> HndTopics.GetProjectTopic()) do
begin
SetLength(aBreadCrumb, Length(aBreadCrumb) + 1);
aBreadCrumb[Length(aBreadCrumb) - 1] := sRelativeTopic;
sRelativeTopic := HndTopics.GetTopicParent(sRelativeTopic);
end;
end;
// Return it if any
if (Length(aBreadCrumb) > 0) then
begin
for nCurParent := Length(aBreadCrumb) - 1 downto 0 do
begin
// Empty topic
if (HndTopics.GetTopicKind(aBreadCrumb[nCurParent]) = 1) then
begin
Result := Result + format('