From e2b4261852f28c37ad598c33e9065b3d77f71fb6 Mon Sep 17 00:00:00 2001 From: wp Date: Wed, 17 Jun 2015 08:28:56 +0000 Subject: [PATCH] wiki: Fix links to local wiki files git-svn-id: trunk@49357 - --- components/wiki/lazwiki/wiki2xhtmlconvert.pas | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/components/wiki/lazwiki/wiki2xhtmlconvert.pas b/components/wiki/lazwiki/wiki2xhtmlconvert.pas index 88c95fdc73..3ac83d65bf 100644 --- a/components/wiki/lazwiki/wiki2xhtmlconvert.pas +++ b/components/wiki/lazwiki/wiki2xhtmlconvert.pas @@ -526,10 +526,19 @@ var URL:=GetPageLink(TargetPage); if Anchor<>'' then URL+='#'+Anchor; - end else if ((FileName <> '') and not FileExistsUTF8(Filename)) then begin - if WarnMissingPageLinks and WarnURL(LinkToken.Link) then - Log('WARNING: TWiki2XHTMLConverter.InsertLink "'+dbgstr(LinkToken.Link)+'": file not found: "'+Filename+'" at '+W.PosToStr(LinkToken.LinkStartPos,true)); - URL:=''; + end else + if (FileName <> '') then begin + if FileExistsUTF8(OutputDir+Filename) or + (GetPageWithDocumentName(DocumentName) <> nil) // will be converted lated + then + URL := Filename + else begin + if WarnMissingPageLinks and WarnURL(LinkToken.Link) then + Log('WARNING: TWiki2XHTMLConverter.InsertLink "'+ + dbgstr(LinkToken.Link)+'": file not found: "'+Filename+'" at '+ + W.PosToStr(LinkToken.LinkStartPos,true)+'. Linking to online version.'); + URL := Page.WikiPage.BaseURL + '/' + DocumentName; + end; end; end; end;