diff --git a/components/wiki/lazwiki/wiki2xhtmlconvert.pas b/components/wiki/lazwiki/wiki2xhtmlconvert.pas
index 086eaf3e8d..ce520dd7ef 100644
--- a/components/wiki/lazwiki/wiki2xhtmlconvert.pas
+++ b/components/wiki/lazwiki/wiki2xhtmlconvert.pas
@@ -145,14 +145,14 @@ var
category, url, txt: String;
i: Integer;
begin
- if FCategoryList.Count = 0 then
- exit;
-
doc := Page.XHTML;
url := Page.WikiPage.BaseURL;
if (url <> '') and (url[Length(url)] <> '/') then
url += '/';
+ if Page.CategoryList.Count = 0 then
+ exit;
+
CategoriesNode := doc.CreateElement('div');
CategoriesNode.SetAttribute('class', 'categories');
Page.BodyDOMNode.AppendChild(CategoriesNode);
@@ -165,8 +165,8 @@ begin
if not FIndexInternalLinksOnly then
AddIndexItem('Categories (external)', url+'Special:Categories');
- for i:=0 to FCategoryList.Count-1 do begin
- category := FCategoryList[i];
+ for i:=0 to Page.CategoryList.Count-1 do begin
+ category := Page.CategoryList[i];
// Add link to category
node := doc.CreateElement('a');
node.SetAttribute('href', url + category);
@@ -177,7 +177,7 @@ begin
AddIndexItem('Category: '+txt+' (external)', url+category);
// Add separator
- if i < FCategoryList.Count-1 then
+ if i < Page.CategoryList.Count-1 then
CategoriesNode.AppendChild(doc.CreateTextNode(' | '));
end;
end;
@@ -532,7 +532,7 @@ var
exit;
end
else if Scheme='category' then begin
- FCategoryList.Add(URL);
+ Page.CategoryList.Add(URL);
URL:='';
Caption := '';
exit;
diff --git a/components/wiki/lazwiki/wikiformat.pas b/components/wiki/lazwiki/wikiformat.pas
index 8d767194b7..06c632cc8d 100644
--- a/components/wiki/lazwiki/wikiformat.pas
+++ b/components/wiki/lazwiki/wikiformat.pas
@@ -39,6 +39,7 @@ type
TW2FormatPage = class
public
Converter: TWiki2FormatConverter;
+ CategoryList: TStringList;
WikiFilename: string;
WikiErrorMsg: string;
WikiDoc: TXMLDocument;
@@ -72,7 +73,6 @@ type
fPagesSortFilename: TAvgLvlTree; // TW2FormatPage sorted for WikiFilename
fPagesSortDocumentName: TAvgLvlTree; // TW2FormatPage sorted for WikiDocumentName
FPageClass: TW2FormatPageClass;
- FCategoryList: TStringList;
function GetPages(Index: integer): TW2FormatPage;
procedure SetOutputDir(AValue: string);
procedure SetImagesDir(AValue: string);
@@ -169,13 +169,11 @@ begin
FTitle:='FPC/Lazarus Wiki (offline, generated '+DatetoStr(Now)+')';
FImagesDir:='images';
FNoWarnBaseURLs:=TStringToStringTree.Create(true);
- FCategoryList := TStringList.Create;
end;
destructor TWiki2FormatConverter.Destroy;
begin
Clear;
- FreeAndNil(FCategoryList);
FreeAndNil(FNoWarnBaseURLs);
FreeAndNil(fPagesSortFilename);
FreeAndNil(fPagesSortDocumentName);
@@ -312,12 +310,14 @@ end;
constructor TW2FormatPage.Create(TheConverter: TWiki2FormatConverter);
begin
Converter:=TheConverter;
+ CategoryList := TStringList.Create;
end;
destructor TW2FormatPage.Destroy;
begin
ClearPageConnections;
ClearConversion;
+ FreeAndNil(CategoryList);
FreeAndNil(WikiDoc);
FreeAndNil(WikiPage);
inherited Destroy;