wiki: Fix categorylist of wikiconvert to be specific to each file (not cumulative)

git-svn-id: trunk@49392 -
This commit is contained in:
wp 2015-06-21 16:46:18 +00:00
parent f72ec12c26
commit f3e3b26250
2 changed files with 10 additions and 10 deletions

View File

@ -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;

View File

@ -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;