mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-25 17:11:08 +02:00
* Added support for the url tag to include arbitrary links
git-svn-id: trunk@14167 -
This commit is contained in:
parent
f326302a12
commit
9fff5d989c
@ -154,6 +154,7 @@ resourcestring
|
|||||||
SDone = 'Done.';
|
SDone = 'Done.';
|
||||||
SErrCouldNotCreateOutputDir = 'Could not create output directory "%s"';
|
SErrCouldNotCreateOutputDir = 'Could not create output directory "%s"';
|
||||||
SErrCouldNotCreateFile = 'Could not create file "%s": %s';
|
SErrCouldNotCreateFile = 'Could not create file "%s": %s';
|
||||||
|
SSeeURL = '(See %s)'; // For lineair text writers.
|
||||||
|
|
||||||
Const
|
Const
|
||||||
SVisibility: array[TPasMemberVisibility] of string =
|
SVisibility: array[TPasMemberVisibility] of string =
|
||||||
|
@ -149,6 +149,8 @@ type
|
|||||||
procedure DescrWriteVarEl(const AText: DOMString); override;
|
procedure DescrWriteVarEl(const AText: DOMString); override;
|
||||||
procedure DescrBeginLink(const AId: DOMString); override;
|
procedure DescrBeginLink(const AId: DOMString); override;
|
||||||
procedure DescrEndLink; override;
|
procedure DescrEndLink; override;
|
||||||
|
procedure DescrBeginURL(const AURL: DOMString); override;
|
||||||
|
procedure DescrEndURL; override;
|
||||||
procedure DescrWriteLinebreak; override;
|
procedure DescrWriteLinebreak; override;
|
||||||
procedure DescrBeginParagraph; override;
|
procedure DescrBeginParagraph; override;
|
||||||
procedure DescrEndParagraph; override;
|
procedure DescrEndParagraph; override;
|
||||||
@ -1088,6 +1090,16 @@ begin
|
|||||||
PopOutputNode;
|
PopOutputNode;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure THTMLWriter.DescrBeginURL(const AURL: DOMString);
|
||||||
|
begin
|
||||||
|
PushOutputNode(CreateLink(CurOutputNode, AURL));
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure THTMLWriter.DescrEndURL;
|
||||||
|
begin
|
||||||
|
PopOutputNode;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure THTMLWriter.DescrWriteLinebreak;
|
procedure THTMLWriter.DescrWriteLinebreak;
|
||||||
begin
|
begin
|
||||||
CreateEl(CurOutputNode, 'br');
|
CreateEl(CurOutputNode, 'br');
|
||||||
|
@ -92,6 +92,8 @@ Type
|
|||||||
procedure DescrWriteVarEl(const AText: DOMString); override;
|
procedure DescrWriteVarEl(const AText: DOMString); override;
|
||||||
procedure DescrBeginLink(const AId: DOMString); override;
|
procedure DescrBeginLink(const AId: DOMString); override;
|
||||||
procedure DescrEndLink; override;
|
procedure DescrEndLink; override;
|
||||||
|
procedure DescrBeginURL(const AURL: DOMString); override; // Provides a default implementation
|
||||||
|
procedure DescrEndURL; override;
|
||||||
procedure DescrWriteLinebreak; override;
|
procedure DescrWriteLinebreak; override;
|
||||||
procedure DescrBeginParagraph; override;
|
procedure DescrBeginParagraph; override;
|
||||||
procedure DescrBeginCode(HasBorder: Boolean; const AHighlighterName: String); override;
|
procedure DescrBeginCode(HasBorder: Boolean; const AHighlighterName: String); override;
|
||||||
@ -273,6 +275,18 @@ begin
|
|||||||
WriteF(' (\pageref{%s})',[StripText(Flink)]);
|
WriteF(' (\pageref{%s})',[StripText(Flink)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLaTeXWriter.DescrBeginURL(const AURL: DOMString);
|
||||||
|
begin
|
||||||
|
Inherited; // Save link
|
||||||
|
Write('\htmladdnormallink{');
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLaTeXWriter.DescrEndURL;
|
||||||
|
begin
|
||||||
|
WriteF('}{%s}',[LastURL]);
|
||||||
|
LastURL:='';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLaTeXWriter.DescrWriteLinebreak;
|
procedure TLaTeXWriter.DescrWriteLinebreak;
|
||||||
begin
|
begin
|
||||||
WriteLn('\\');
|
WriteLn('\\');
|
||||||
|
@ -15,8 +15,8 @@ Type
|
|||||||
PackageName: String;
|
PackageName: String;
|
||||||
Module: TPasModule;
|
Module: TPasModule;
|
||||||
ModuleName: String;
|
ModuleName: String;
|
||||||
|
FLastURL : DomString;
|
||||||
Protected
|
Protected
|
||||||
|
|
||||||
// Writing support.
|
// Writing support.
|
||||||
procedure Write(const s: String); virtual;
|
procedure Write(const s: String); virtual;
|
||||||
procedure WriteLn(const s: String); virtual;
|
procedure WriteLn(const s: String); virtual;
|
||||||
@ -27,6 +27,8 @@ Type
|
|||||||
procedure WriteLabel(El: TPasElement);
|
procedure WriteLabel(El: TPasElement);
|
||||||
procedure WriteIndex(El: TPasElement);
|
procedure WriteIndex(El: TPasElement);
|
||||||
// Auxiliary routines
|
// Auxiliary routines
|
||||||
|
procedure DescrBeginURL(const AURL: DOMString); override; // Provides a default implementation
|
||||||
|
procedure DescrEndURL; override;
|
||||||
procedure SortElementList(List : TList);
|
procedure SortElementList(List : TList);
|
||||||
procedure StartListing(Frames: Boolean);
|
procedure StartListing(Frames: Boolean);
|
||||||
Function ShowMember(M : TPasElement) : boolean;
|
Function ShowMember(M : TPasElement) : boolean;
|
||||||
@ -75,6 +77,7 @@ Type
|
|||||||
procedure WriteUnitEntry(UnitRef : TPasType);virtual; Abstract;
|
procedure WriteUnitEntry(UnitRef : TPasType);virtual; Abstract;
|
||||||
procedure EndUnitOverview; virtual; Abstract;
|
procedure EndUnitOverview; virtual; Abstract;
|
||||||
Class Function FileNameExtension : String;virtual; Abstract;
|
Class Function FileNameExtension : String;virtual; Abstract;
|
||||||
|
Property LastURL : DomString Read FLastURL Write FLastURL;
|
||||||
Public
|
Public
|
||||||
Constructor Create(APackage: TPasPackage; AEngine: TFPDocEngine); override;
|
Constructor Create(APackage: TPasPackage; AEngine: TFPDocEngine); override;
|
||||||
procedure WriteDoc; override;
|
procedure WriteDoc; override;
|
||||||
@ -196,6 +199,18 @@ begin
|
|||||||
WriteIndex(EL.Name);
|
WriteIndex(EL.Name);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLinearWriter.DescrBeginURL(const AURL: DOMString);
|
||||||
|
begin
|
||||||
|
FLastURL:=AURL;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TLinearWriter.DescrEndURL;
|
||||||
|
begin
|
||||||
|
If (FLastURL<>'') then
|
||||||
|
Writeln(Format(SSeeURL,[EscapeText(FLastURL)]));
|
||||||
|
FLastURL:='';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLinearWriter.StartListing(Frames: Boolean);
|
procedure TLinearWriter.StartListing(Frames: Boolean);
|
||||||
begin
|
begin
|
||||||
StartListing(Frames,'');
|
StartListing(Frames,'');
|
||||||
|
@ -71,6 +71,7 @@ type
|
|||||||
FPackage : TPasPackage;
|
FPackage : TPasPackage;
|
||||||
FTopics : TList;
|
FTopics : TList;
|
||||||
FImgExt : String;
|
FImgExt : String;
|
||||||
|
procedure ConvertURL(AContext: TPasElement; El: TDOMElement);
|
||||||
|
|
||||||
protected
|
protected
|
||||||
procedure Warning(AContext: TPasElement; const AMsg: String);
|
procedure Warning(AContext: TPasElement; const AMsg: String);
|
||||||
@ -111,6 +112,8 @@ type
|
|||||||
procedure DescrWriteVarEl(const AText: DOMString); virtual; abstract;
|
procedure DescrWriteVarEl(const AText: DOMString); virtual; abstract;
|
||||||
procedure DescrBeginLink(const AId: DOMString); virtual; abstract;
|
procedure DescrBeginLink(const AId: DOMString); virtual; abstract;
|
||||||
procedure DescrEndLink; virtual; abstract;
|
procedure DescrEndLink; virtual; abstract;
|
||||||
|
procedure DescrBeginURL(const AURL: DOMString); virtual; abstract;
|
||||||
|
procedure DescrEndURL; virtual; abstract;
|
||||||
procedure DescrWriteLinebreak; virtual; abstract;
|
procedure DescrWriteLinebreak; virtual; abstract;
|
||||||
procedure DescrBeginParagraph; virtual; abstract;
|
procedure DescrBeginParagraph; virtual; abstract;
|
||||||
procedure DescrEndParagraph; virtual; abstract;
|
procedure DescrEndParagraph; virtual; abstract;
|
||||||
@ -428,6 +431,7 @@ begin
|
|||||||
if Node.NodeType = ELEMENT_NODE then
|
if Node.NodeType = ELEMENT_NODE then
|
||||||
if (Node.NodeName <> 'br') and
|
if (Node.NodeName <> 'br') and
|
||||||
(Node.NodeName <> 'link') and
|
(Node.NodeName <> 'link') and
|
||||||
|
(Node.NodeName <> 'url') and
|
||||||
(Node.NodeName <> 'b') and
|
(Node.NodeName <> 'b') and
|
||||||
(Node.NodeName <> 'file') and
|
(Node.NodeName <> 'file') and
|
||||||
(Node.NodeName <> 'i') and
|
(Node.NodeName <> 'i') and
|
||||||
@ -457,6 +461,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
||||||
ConvertLink(AContext, TDOMElement(Node))
|
ConvertLink(AContext, TDOMElement(Node))
|
||||||
|
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'url') then
|
||||||
|
ConvertURL(AContext, TDOMElement(Node))
|
||||||
else
|
else
|
||||||
if not ConvertBaseShort(AContext, Node) then
|
if not ConvertBaseShort(AContext, Node) then
|
||||||
exit;
|
exit;
|
||||||
@ -596,6 +602,16 @@ begin
|
|||||||
DescrEndLink;
|
DescrEndLink;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TFPDocWriter.ConvertURL(AContext: TPasElement; El: TDOMElement);
|
||||||
|
begin
|
||||||
|
DescrBeginURL(El['href']);
|
||||||
|
if not IsDescrNodeEmpty(El) then
|
||||||
|
ConvertBaseShortList(AContext, El, True)
|
||||||
|
else
|
||||||
|
DescrWriteText(El['href']);
|
||||||
|
DescrEndURL;
|
||||||
|
end;
|
||||||
|
|
||||||
function TFPDocWriter.ConvertExtShort(AContext: TPasElement;
|
function TFPDocWriter.ConvertExtShort(AContext: TPasElement;
|
||||||
Node: TDOMNode): Boolean;
|
Node: TDOMNode): Boolean;
|
||||||
begin
|
begin
|
||||||
@ -605,6 +621,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'link') then
|
||||||
ConvertLink(AContext, TDOMElement(Node))
|
ConvertLink(AContext, TDOMElement(Node))
|
||||||
|
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'url') then
|
||||||
|
ConvertURL(AContext, TDOMElement(Node))
|
||||||
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'br') then
|
else if (Node.NodeType = ELEMENT_NODE) and (Node.NodeName = 'br') then
|
||||||
DescrWriteLinebreak
|
DescrWriteLinebreak
|
||||||
else
|
else
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<PathDelim Value="/"/>
|
<Version Value="7"/>
|
||||||
<Version Value="6"/>
|
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
|
<SaveClosedFiles Value="False"/>
|
||||||
<SaveOnlyProjectUnits Value="True"/>
|
<SaveOnlyProjectUnits Value="True"/>
|
||||||
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
<MainUnitHasUsesSectionForAllUnits Value="False"/>
|
||||||
<MainUnitHasCreateFormStatements Value="False"/>
|
<MainUnitHasCreateFormStatements Value="False"/>
|
||||||
<MainUnitHasTitleStatement Value="False"/>
|
<MainUnitHasTitleStatement Value="False"/>
|
||||||
|
<LRSInOutputDirectory Value="False"/>
|
||||||
</Flags>
|
</Flags>
|
||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<IconPath Value="./"/>
|
|
||||||
<TargetFileExt Value=""/>
|
<TargetFileExt Value=""/>
|
||||||
</General>
|
</General>
|
||||||
<VersionInfo>
|
<VersionInfo>
|
||||||
|
Loading…
Reference in New Issue
Block a user