mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-10-25 19:41:38 +02:00
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:
parent
663e1b5ca2
commit
40732f021f
@ -320,7 +320,7 @@ var
|
|||||||
URL:=''; // show category without link
|
URL:=''; // show category without link
|
||||||
exit;
|
exit;
|
||||||
end
|
end
|
||||||
else if Scheme='image' then begin
|
else if (Scheme='image') or (Scheme='file') then begin
|
||||||
URL:=copy(URL,p+1,length(URL));
|
URL:=copy(URL,p+1,length(URL));
|
||||||
URL:=UTF8Trim(URL);
|
URL:=UTF8Trim(URL);
|
||||||
URL:=WikiTitleToPage(URL);
|
URL:=WikiTitleToPage(URL);
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="9"/>
|
||||||
@ -45,17 +45,11 @@
|
|||||||
<PackageName Value="LazUtils"/>
|
<PackageName Value="LazUtils"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</RequiredPackages>
|
</RequiredPackages>
|
||||||
<Units Count="2">
|
<Units Count="1">
|
||||||
<Unit0>
|
<Unit0>
|
||||||
<Filename Value="parsewikipage.lpr"/>
|
<Filename Value="parsewikipage.lpr"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<UnitName Value="parsewikipage"/>
|
|
||||||
</Unit0>
|
</Unit0>
|
||||||
<Unit1>
|
|
||||||
<Filename Value="wikistructs.pas"/>
|
|
||||||
<IsPartOfProject Value="True"/>
|
|
||||||
<UnitName Value="WikiStructs"/>
|
|
||||||
</Unit1>
|
|
||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
@ -67,12 +61,6 @@
|
|||||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||||
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
|
||||||
</SearchPaths>
|
</SearchPaths>
|
||||||
<Other>
|
|
||||||
<CompilerMessages>
|
|
||||||
<MsgFileName Value=""/>
|
|
||||||
</CompilerMessages>
|
|
||||||
<CompilerPath Value="$(CompPath)"/>
|
|
||||||
</Other>
|
|
||||||
</CompilerOptions>
|
</CompilerOptions>
|
||||||
<Debugging>
|
<Debugging>
|
||||||
<Exceptions Count="3">
|
<Exceptions Count="3">
|
||||||
|
|||||||
@ -30,7 +30,7 @@ uses
|
|||||||
cthreads,
|
cthreads,
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Classes, SysUtils, LazFileUtils, laz2_XMLRead, laz2_DOM, laz2_XMLWrite,
|
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}
|
{$IF FPC_FULLVERSION<20701}
|
||||||
myfphttpclient,
|
myfphttpclient,
|
||||||
{$ELSE}
|
{$ELSE}
|
||||||
@ -523,7 +523,7 @@ begin
|
|||||||
if ColonPos<1 then exit;
|
if ColonPos<1 then exit;
|
||||||
if ColonPos=length(Link) then exit;
|
if ColonPos=length(Link) then exit;
|
||||||
Prefix:=lowercase(copy(Link,1,ColonPos-1));
|
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)));
|
Link:=UTF8Trim(copy(Link,ColonPos+1,length(Link)));
|
||||||
if Link='' then exit;
|
if Link='' then exit;
|
||||||
Filename:=ImageToFilename(Link,true,true);
|
Filename:=ImageToFilename(Link,true,true);
|
||||||
@ -539,7 +539,7 @@ begin
|
|||||||
try
|
try
|
||||||
Client:=TFPHTTPClient.Create(nil);
|
Client:=TFPHTTPClient.Create(nil);
|
||||||
Response:=TMemoryStream.Create;
|
Response:=TMemoryStream.Create;
|
||||||
URL:=BaseURL+EscapeDocumentName('Image:'+WikiTitleToPage(Link));
|
URL:=BaseURL+EscapeDocumentName(AnsiPropercase(Prefix, StdWordDelims)+':'+WikiTitleToPage(Link));
|
||||||
writeln('getting image page "',URL,'" ...');
|
writeln('getting image page "',URL,'" ...');
|
||||||
Client.Get(URL,Response);
|
Client.Get(URL,Response);
|
||||||
//Client.ResponseHeaders.SaveToFile('responseheaders.txt');
|
//Client.ResponseHeaders.SaveToFile('responseheaders.txt');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user