Wiki component: Support prefix "file:" in wikiget and HTML converter. Issue #28265, patch from wp.

git-svn-id: trunk@49311 -
This commit is contained in:
juha 2015-06-10 14:35:14 +00:00
parent 663e1b5ca2
commit 40732f021f
3 changed files with 6 additions and 18 deletions

View File

@ -320,7 +320,7 @@ var
URL:=''; // show category without link
exit;
end
else if Scheme='image' then begin
else if (Scheme='image') or (Scheme='file') then begin
URL:=copy(URL,p+1,length(URL));
URL:=UTF8Trim(URL);
URL:=WikiTitleToPage(URL);

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="9"/>
@ -45,17 +45,11 @@
<PackageName Value="LazUtils"/>
</Item3>
</RequiredPackages>
<Units Count="2">
<Units Count="1">
<Unit0>
<Filename Value="parsewikipage.lpr"/>
<IsPartOfProject Value="True"/>
<UnitName Value="parsewikipage"/>
</Unit0>
<Unit1>
<Filename Value="wikistructs.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="WikiStructs"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
@ -67,12 +61,6 @@
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">

View File

@ -30,7 +30,7 @@ uses
cthreads,
{$ENDIF}
Classes, SysUtils, LazFileUtils, laz2_XMLRead, laz2_DOM, laz2_XMLWrite,
LazLogger, LazUTF8, CodeToolsStructs, CustApp, AVL_Tree,
LazLogger, LazUTF8, CodeToolsStructs, CustApp, AVL_Tree, strutils,
{$IF FPC_FULLVERSION<20701}
myfphttpclient,
{$ELSE}
@ -523,7 +523,7 @@ begin
if ColonPos<1 then exit;
if ColonPos=length(Link) then exit;
Prefix:=lowercase(copy(Link,1,ColonPos-1));
if Prefix<>'image' then exit;
if (Prefix<>'image') and (Prefix<>'file') then exit;
Link:=UTF8Trim(copy(Link,ColonPos+1,length(Link)));
if Link='' then exit;
Filename:=ImageToFilename(Link,true,true);
@ -539,7 +539,7 @@ begin
try
Client:=TFPHTTPClient.Create(nil);
Response:=TMemoryStream.Create;
URL:=BaseURL+EscapeDocumentName('Image:'+WikiTitleToPage(Link));
URL:=BaseURL+EscapeDocumentName(AnsiPropercase(Prefix, StdWordDelims)+':'+WikiTitleToPage(Link));
writeln('getting image page "',URL,'" ...');
Client.Get(URL,Response);
//Client.ResponseHeaders.SaveToFile('responseheaders.txt');