mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-13 05:59:27 +02:00
* Added support for version tag (same level as errors or seealso tags
git-svn-id: trunk@15008 -
This commit is contained in:
parent
1d0db2cc85
commit
235c3be24a
@ -55,6 +55,7 @@ resourcestring
|
|||||||
SDocDeclaration = 'Declaration';
|
SDocDeclaration = 'Declaration';
|
||||||
SDocDescription = 'Description';
|
SDocDescription = 'Description';
|
||||||
SDocErrors = 'Errors';
|
SDocErrors = 'Errors';
|
||||||
|
SDocVersion = 'Version info';
|
||||||
SDocSeeAlso = 'See also';
|
SDocSeeAlso = 'See also';
|
||||||
SDocExample = 'Example';
|
SDocExample = 'Example';
|
||||||
SDocArguments = 'Arguments';
|
SDocArguments = 'Arguments';
|
||||||
@ -208,6 +209,8 @@ type
|
|||||||
members, and so on...
|
members, and so on...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{ TDocNode }
|
||||||
|
|
||||||
TDocNode = class
|
TDocNode = class
|
||||||
private
|
private
|
||||||
FFirstChild, FNextSibling: TDocNode;
|
FFirstChild, FNextSibling: TDocNode;
|
||||||
@ -222,6 +225,7 @@ type
|
|||||||
FLink: String;
|
FLink: String;
|
||||||
FTopicNode : Boolean;
|
FTopicNode : Boolean;
|
||||||
FRefCount : Integer;
|
FRefCount : Integer;
|
||||||
|
FVersion: TDomElement;
|
||||||
public
|
public
|
||||||
constructor Create(const AName: String; ANode: TDOMElement);
|
constructor Create(const AName: String; ANode: TDOMElement);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -239,6 +243,7 @@ type
|
|||||||
property ShortDescr: TDOMElement read FShortDescr;
|
property ShortDescr: TDOMElement read FShortDescr;
|
||||||
property Descr: TDOMElement read FDescr;
|
property Descr: TDOMElement read FDescr;
|
||||||
property ErrorsDoc: TDOMElement read FErrorsDoc;
|
property ErrorsDoc: TDOMElement read FErrorsDoc;
|
||||||
|
Property Version : TDomElement Read FVersion;
|
||||||
property SeeAlso: TDOMElement read FSeeAlso;
|
property SeeAlso: TDOMElement read FSeeAlso;
|
||||||
property FirstExample: TDOMElement read FFirstExample;
|
property FirstExample: TDOMElement read FFirstExample;
|
||||||
property Link: String read FLink;
|
property Link: String read FLink;
|
||||||
@ -1044,6 +1049,11 @@ procedure TFPDocEngine.AddDocFile(const AFilename: String);
|
|||||||
Result.FShortDescr := TDOMElement(Subnode)
|
Result.FShortDescr := TDOMElement(Subnode)
|
||||||
else if Subnode.NodeName = 'descr' then
|
else if Subnode.NodeName = 'descr' then
|
||||||
Result.FDescr := TDOMElement(Subnode)
|
Result.FDescr := TDOMElement(Subnode)
|
||||||
|
else if Subnode.NodeName = 'version' then
|
||||||
|
begin
|
||||||
|
Writeln('Detected version',ELement['name']);
|
||||||
|
Result.FVersion := TDOMElement(Subnode)
|
||||||
|
end
|
||||||
else if Subnode.NodeName = 'errors' then
|
else if Subnode.NodeName = 'errors' then
|
||||||
Result.FErrorsDoc := TDOMElement(Subnode)
|
Result.FErrorsDoc := TDOMElement(Subnode)
|
||||||
else if Subnode.NodeName = 'seealso' then
|
else if Subnode.NodeName = 'seealso' then
|
||||||
|
@ -2148,6 +2148,10 @@ begin
|
|||||||
if Assigned(DocNode.ErrorsDoc) then
|
if Assigned(DocNode.ErrorsDoc) then
|
||||||
AppendDescrSection(AElement, BodyElement, DocNode.ErrorsDoc, SDocErrors);
|
AppendDescrSection(AElement, BodyElement, DocNode.ErrorsDoc, SDocErrors);
|
||||||
|
|
||||||
|
// Append Version info
|
||||||
|
if Assigned(DocNode.Version) then
|
||||||
|
AppendDescrSection(AElement, BodyElement, DocNode.Version, SDocVersion);
|
||||||
|
|
||||||
// Append "See also" section
|
// Append "See also" section
|
||||||
AppendSeeAlsoSection(AElement,DocNode);
|
AppendSeeAlsoSection(AElement,DocNode);
|
||||||
|
|
||||||
|
@ -58,6 +58,7 @@ Type
|
|||||||
Procedure StartDescription; override;
|
Procedure StartDescription; override;
|
||||||
Procedure StartAccess; override;
|
Procedure StartAccess; override;
|
||||||
Procedure StartErrors; override;
|
Procedure StartErrors; override;
|
||||||
|
Procedure StartVersion; override;
|
||||||
Procedure StartSeealso; override;
|
Procedure StartSeealso; override;
|
||||||
Procedure EndSeealso; override;
|
Procedure EndSeealso; override;
|
||||||
procedure StartUnitOverview(AModuleName,AModuleLabel : String);override;
|
procedure StartUnitOverview(AModuleName,AModuleLabel : String);override;
|
||||||
@ -597,6 +598,11 @@ begin
|
|||||||
Writeln('\Errors');
|
Writeln('\Errors');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLaTeXWriter.StartVersion;
|
||||||
|
begin
|
||||||
|
Writeln('\VersionInfo');
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TLatexWriter.StartAccess;
|
Procedure TLatexWriter.StartAccess;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
|
@ -16,6 +16,7 @@ Type
|
|||||||
Module: TPasModule;
|
Module: TPasModule;
|
||||||
ModuleName: String;
|
ModuleName: String;
|
||||||
FLastURL : DomString;
|
FLastURL : DomString;
|
||||||
|
private
|
||||||
Protected
|
Protected
|
||||||
// Writing support.
|
// Writing support.
|
||||||
procedure Write(const s: String); virtual;
|
procedure Write(const s: String); virtual;
|
||||||
@ -54,6 +55,7 @@ Type
|
|||||||
Procedure StartDescription; Virtual;
|
Procedure StartDescription; Virtual;
|
||||||
Procedure StartAccess; Virtual;
|
Procedure StartAccess; Virtual;
|
||||||
Procedure StartErrors; Virtual;
|
Procedure StartErrors; Virtual;
|
||||||
|
Procedure StartVersion; Virtual;
|
||||||
Procedure StartSeealso; Virtual;
|
Procedure StartSeealso; Virtual;
|
||||||
Procedure EndSeealso; Virtual;
|
Procedure EndSeealso; Virtual;
|
||||||
// Procedures which MUST be overridden in descendents;
|
// Procedures which MUST be overridden in descendents;
|
||||||
@ -305,6 +307,13 @@ begin
|
|||||||
Writeln(SDocErrors+':');
|
Writeln(SDocErrors+':');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Procedure TLinearWriter.StartVersion;
|
||||||
|
|
||||||
|
begin
|
||||||
|
Writeln('');
|
||||||
|
Writeln(SDocVersion+':');
|
||||||
|
end;
|
||||||
|
|
||||||
Procedure TLinearWriter.StartSeealso;
|
Procedure TLinearWriter.StartSeealso;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -353,7 +362,12 @@ begin
|
|||||||
(not IsDescrNodeEmpty(DocNode.ShortDescr))) then
|
(not IsDescrNodeEmpty(DocNode.ShortDescr))) then
|
||||||
begin
|
begin
|
||||||
StartSubSection(SDocDescription);
|
StartSubSection(SDocDescription);
|
||||||
WriteDescr(ClassDecl);
|
WriteDescr(ClassDecl,DocNode);
|
||||||
|
If Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
StartSubSection(SDocVersion);
|
||||||
|
WriteDescr(ClassDecl,DocNode.Version);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// Write method overview
|
// Write method overview
|
||||||
@ -539,6 +553,7 @@ procedure TLinearWriter.WriteResourceStrings(ASection: TPasSection);
|
|||||||
var
|
var
|
||||||
ResStrDecl: TPasResString;
|
ResStrDecl: TPasResString;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
DocNode : TDocNode;
|
||||||
begin
|
begin
|
||||||
if ASection.ResStrings.Count > 0 then
|
if ASection.ResStrings.Count > 0 then
|
||||||
begin
|
begin
|
||||||
@ -551,7 +566,12 @@ begin
|
|||||||
EndListing;
|
EndListing;
|
||||||
WriteLabel(ResStrDecl);
|
WriteLabel(ResStrDecl);
|
||||||
WriteIndex(ResStrDecl);
|
WriteIndex(ResStrDecl);
|
||||||
WriteDescr(ResStrDecl);
|
DocNode:=WriteDescr(ResStrDecl);
|
||||||
|
If Assigned(DocNode) and Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
Writeln(Format('%s : ',[SDocVersion]));
|
||||||
|
WriteDescr(ResStrDecl, DocNode.Version);
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -743,8 +763,13 @@ begin
|
|||||||
WriteENumElements(TypeDecl as TPasEnumType);
|
WriteENumElements(TypeDecl as TPasEnumType);
|
||||||
end;
|
end;
|
||||||
WriteDescr(TypeDecl);
|
WriteDescr(TypeDecl);
|
||||||
|
If Assigned(DocNode) and Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
Writeln(Format('%s : ',[SDocVersion]));
|
||||||
|
WriteDescr(TypeDecl, DocNode.Version);
|
||||||
|
end;
|
||||||
DescrEndParaGraph;
|
DescrEndParaGraph;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -752,6 +777,8 @@ procedure TLinearWriter.WriteVars(ASection: TPasSection);
|
|||||||
var
|
var
|
||||||
VarDecl: TPasVariable;
|
VarDecl: TPasVariable;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
DocNode : TDocNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if ASection.Variables.Count > 0 then
|
if ASection.Variables.Count > 0 then
|
||||||
begin
|
begin
|
||||||
@ -765,7 +792,12 @@ begin
|
|||||||
EndListing;
|
EndListing;
|
||||||
WriteLabel(VarDecl);
|
WriteLabel(VarDecl);
|
||||||
WriteIndex(VarDecl);
|
WriteIndex(VarDecl);
|
||||||
WriteDescr(VarDecl);
|
DocNode:=WriteDescr(VarDecl);
|
||||||
|
If Assigned(DocNode) and Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
Writeln(Format('%s : ',[SDocVersion]));
|
||||||
|
WriteDescr(VarDecl, DocNode.Version);
|
||||||
|
end;
|
||||||
DescrEndParaGraph;
|
DescrEndParaGraph;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -817,19 +849,27 @@ begin
|
|||||||
StartVisibility;
|
StartVisibility;
|
||||||
Writeln(VisibilityNames[Visibility])
|
Writeln(VisibilityNames[Visibility])
|
||||||
end;
|
end;
|
||||||
if Assigned(DocNode) and Assigned(DocNode.Descr) then
|
if Assigned(DocNode) then
|
||||||
begin
|
begin
|
||||||
StartDescription;
|
If Assigned(DocNode.Descr) then
|
||||||
WriteDescr(ProcDecl);
|
begin
|
||||||
|
StartDescription;
|
||||||
|
WriteDescr(ProcDecl);
|
||||||
|
end;
|
||||||
|
if Assigned(DocNode.ErrorsDoc) then
|
||||||
|
begin
|
||||||
|
StartErrors;
|
||||||
|
WriteDescr(ProcDecl, DocNode.ErrorsDoc);
|
||||||
|
end;
|
||||||
|
if Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
StartVersion;
|
||||||
|
WriteDescr(ProcDecl, DocNode.Version);
|
||||||
|
end;
|
||||||
|
WriteSeeAlso(DocNode);
|
||||||
|
EndProcedure;
|
||||||
|
WriteExample(DocNode);
|
||||||
end;
|
end;
|
||||||
if Assigned(DocNode) and Assigned(DocNode.ErrorsDoc) then
|
|
||||||
begin
|
|
||||||
StartErrors;
|
|
||||||
WriteDescr(ProcDecl, DocNode.ErrorsDoc);
|
|
||||||
end;
|
|
||||||
WriteSeeAlso(DocNode);
|
|
||||||
EndProcedure;
|
|
||||||
WriteExample(DocNode);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -910,19 +950,27 @@ begin
|
|||||||
S:=S+'Write';
|
S:=S+'Write';
|
||||||
end;
|
end;
|
||||||
Writeln(S);
|
Writeln(S);
|
||||||
if Assigned(DocNode) and Assigned(DocNode.Descr) then
|
if Assigned(DocNode) then
|
||||||
begin
|
begin
|
||||||
StartDescription;
|
if Assigned(DocNode.Descr) then
|
||||||
WriteDescr(PropDecl);
|
begin
|
||||||
|
StartDescription;
|
||||||
|
WriteDescr(PropDecl);
|
||||||
|
end;
|
||||||
|
if Assigned(DocNode.ErrorsDoc) then
|
||||||
|
begin
|
||||||
|
StartErrors;
|
||||||
|
WriteDescr(PropDecl, DocNode.ErrorsDoc);
|
||||||
|
end;
|
||||||
|
if Assigned(DocNode.Version) then
|
||||||
|
begin
|
||||||
|
StartVersion;
|
||||||
|
WriteDescr(PropDecl, DocNode.Version);
|
||||||
|
end;
|
||||||
|
WriteSeeAlso(DocNode);
|
||||||
|
EndProperty;
|
||||||
|
WriteExample(DocNode);
|
||||||
end;
|
end;
|
||||||
if Assigned(DocNode) and Assigned(DocNode.ErrorsDoc) then
|
|
||||||
begin
|
|
||||||
StartErrors;
|
|
||||||
WriteDescr(PropDecl, DocNode.ErrorsDoc);
|
|
||||||
end;
|
|
||||||
WriteSeeAlso(DocNode);
|
|
||||||
EndProperty;
|
|
||||||
WriteExample(DocNode);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ type
|
|||||||
Function InterpretOption(Const Cmd,Arg : String) : Boolean; Virtual;
|
Function InterpretOption(Const Cmd,Arg : String) : Boolean; Virtual;
|
||||||
Class Procedure Usage(List : TStrings); virtual;
|
Class Procedure Usage(List : TStrings); virtual;
|
||||||
procedure WriteDoc; virtual; Abstract;
|
procedure WriteDoc; virtual; Abstract;
|
||||||
procedure WriteDescr(Element: TPasElement);
|
Function WriteDescr(Element: TPasElement) : TDocNode;
|
||||||
procedure WriteDescr(Element: TPasElement; DocNode: TDocNode);
|
procedure WriteDescr(Element: TPasElement; DocNode: TDocNode);
|
||||||
procedure WriteDescr(AContext: TPasElement; DescrNode: TDOMElement); virtual;
|
procedure WriteDescr(AContext: TPasElement; DescrNode: TDOMElement); virtual;
|
||||||
Procedure FPDocError(Msg : String);
|
Procedure FPDocError(Msg : String);
|
||||||
@ -1038,10 +1038,11 @@ begin
|
|||||||
Inherited;
|
Inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPDocWriter.WriteDescr(Element: TPasElement);
|
Function TFPDocWriter.WriteDescr(Element: TPasElement) : TDocNode;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
WriteDescr(ELement,Engine.FindDocNode(Element));
|
Result:=Engine.FindDocNode(Element);
|
||||||
|
WriteDescr(ELement,Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPDocWriter.WriteDescr(Element: TPasElement; DocNode: TDocNode);
|
procedure TFPDocWriter.WriteDescr(Element: TPasElement; DocNode: TDocNode);
|
||||||
|
Loading…
Reference in New Issue
Block a user