mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 10:30:15 +02:00
* --example-dir support
This commit is contained in:
parent
3cfec8f905
commit
45c6833258
@ -37,7 +37,7 @@ Var
|
||||
Const
|
||||
SVisibility: array[TPasMemberVisibility] of string =
|
||||
('Default', 'Private', 'Protected', 'Public',
|
||||
'Published', 'Automated','Strict Private','Strict Protected',
|
||||
'Published', 'Automated','Strict Private','Strict Protected',
|
||||
'Required', 'Optional' // ObjCClass
|
||||
);
|
||||
|
||||
@ -146,6 +146,7 @@ type
|
||||
TFPDocEngine = class(TPasTreeContainer)
|
||||
private
|
||||
FDocLogLevels: TFPDocLogLevels;
|
||||
FExamplesPath: String;
|
||||
FOnParseUnit: TOnParseUnitEvent;
|
||||
function ResolveLinkInPackages(AModule: TPasModule; const ALinkDest: String; Strict: Boolean=False): String;
|
||||
function ResolveLinkInUsedUnits(AModule: TPasModule; const ALinkDest: String; Strict: Boolean=False): String;
|
||||
@ -210,6 +211,7 @@ type
|
||||
property RootDocNode: TDocNode read FRootDocNode;
|
||||
Property DocLogLevels : TFPDocLogLevels Read FDocLogLevels Write FDocLogLevels;
|
||||
Property OnParseUnit : TOnParseUnitEvent Read FOnParseUnit Write FOnParseUnit;
|
||||
Property ExamplesPath : String Read FExamplesPath Write FExamplesPath;
|
||||
end;
|
||||
|
||||
|
||||
@ -1541,16 +1543,23 @@ var
|
||||
|
||||
begin
|
||||
Result:='';
|
||||
for i := 0 to DescrDocs.Count - 1 do
|
||||
Fn:=UTF8Encode(ExElement['file']);
|
||||
if FN='' then
|
||||
exit;
|
||||
if ExamplesPath<>'' then
|
||||
Result:=IncludeTrailingPathDelimiter(ExamplesPath)+FN
|
||||
else
|
||||
begin
|
||||
Fn:=UTF8Encode(ExElement['file']);
|
||||
if (FN<>'') and (TDOMDocument(DescrDocs[i]) = ExElement.OwnerDocument) then
|
||||
I:=0;
|
||||
While (Result='') and (I<DescrDocs.Count) do
|
||||
begin
|
||||
Result := ExtractFilePath(DescrDocNames[i]) + FN;
|
||||
if (ExtractFileExt(Result)='') then
|
||||
Result:=Result+'.pp';
|
||||
if (TDOMDocument(DescrDocs[i]) = ExElement.OwnerDocument) then
|
||||
Result := ExtractFilePath(DescrDocNames[i]) + FN;
|
||||
Inc(I);
|
||||
end;
|
||||
end;
|
||||
if (ExtractFileExt(Result)='') then
|
||||
Result:=Result+'.pp';
|
||||
end;
|
||||
|
||||
|
||||
|
@ -85,6 +85,7 @@ begin
|
||||
Writeln(SUsageOption035);
|
||||
Writeln(SUsageOption040);
|
||||
Writeln(SUsageOption050);
|
||||
Writeln(SUsageOption055);
|
||||
Writeln(SUsageOption060);
|
||||
Writeln(SUsageOption070);
|
||||
Writeln(SUsageOption080);
|
||||
@ -349,6 +350,8 @@ begin
|
||||
FProjectFile:=True;
|
||||
FCreator.LoadProjectFile(Arg);
|
||||
end
|
||||
else if (Cmd = '--examples-dir') then
|
||||
FCreator.ExamplesPath:=Arg
|
||||
else if (Cmd = '--descr') then
|
||||
AddToFileList(SelectedPackage.Descriptions, Arg)
|
||||
else if (Cmd = '--descr-dir') then
|
||||
|
@ -153,6 +153,7 @@ resourcestring
|
||||
SUsageOption035 = ' --descr=c:\WIP\myzipperdoc.xml';
|
||||
SUsageOption040 = ' This option is allowed more than once';
|
||||
SUsageOption050 = '--descr-dir=Dir Add All XML files in Dir to list of description files';
|
||||
SUsageOption055 = '--example-dir=DIR Look for examples in directory DIR';
|
||||
SUsageOption060 = '--format=fmt Select output format.';
|
||||
SUsageOption070 = '--help Show this help.';
|
||||
SUsageOption080 = '--hide-protected Do not show protected methods in overview';
|
||||
|
@ -27,6 +27,7 @@ Type
|
||||
FBaseDescrDir: String;
|
||||
FBaseInputDir: String;
|
||||
FCurPackage : TFPDocPackage;
|
||||
FExamplesPath: String;
|
||||
FProcessedUnits : TStrings;
|
||||
FOnLog: TPasParserLogHandler;
|
||||
FPParserLogEvents: TPParserLogEvents;
|
||||
@ -39,6 +40,7 @@ Type
|
||||
function GetPackages: TFPDocPackages;
|
||||
procedure SetBaseDescrDir(AValue: String);
|
||||
procedure SetBaseInputDir(AValue: String);
|
||||
procedure SetExamplesPath(AValue: String);
|
||||
procedure SetProjectMacros(AValue: TStrings);
|
||||
Protected
|
||||
Function FixInputFile(Const AFileName : String) : String;
|
||||
@ -68,6 +70,7 @@ Type
|
||||
// When set, they will be prepended to non-absolute filenames.
|
||||
Property BaseInputDir : String Read FBaseInputDir Write SetBaseInputDir;
|
||||
Property BaseDescrDir : String Read FBaseDescrDir Write SetBaseDescrDir;
|
||||
Property ExamplesPath : String Read FExamplesPath Write SetExamplesPath;
|
||||
// Macros used when loading the project file
|
||||
Property ProjectMacros : TStrings Read FProjectMacros Write SetProjectMacros;
|
||||
end;
|
||||
@ -188,6 +191,14 @@ begin
|
||||
FBaseInputDir:=IncludeTrailingPathDelimiter(FBaseInputDir);
|
||||
end;
|
||||
|
||||
procedure TFPDocCreator.SetExamplesPath(AValue: String);
|
||||
begin
|
||||
if FExamplesPath=AValue then Exit;
|
||||
FExamplesPath:=AValue;
|
||||
If FExamplesPath<>'' then
|
||||
FExamplesPath:=IncludeTrailingPathDelimiter(FExamplesPath);
|
||||
end;
|
||||
|
||||
procedure TFPDocCreator.SetProjectMacros(AValue: TStrings);
|
||||
begin
|
||||
if FProjectMacros=AValue then Exit;
|
||||
@ -260,7 +271,7 @@ begin
|
||||
Engine.WriteContentFile(APackage.ContentFile);
|
||||
end;
|
||||
|
||||
Function TFPDocCreator.GetLogLevels : TFPDocLogLevels;
|
||||
function TFPDocCreator.GetLogLevels: TFPDocLogLevels;
|
||||
|
||||
Procedure DoOpt(doSet : Boolean; aLevel: TFPDocLogLevel);
|
||||
|
||||
@ -290,8 +301,9 @@ begin
|
||||
Cmd:='';
|
||||
FCurPackage:=APackage;
|
||||
Engine:=TFPDocEngine.Create;
|
||||
Engine.OnLog:= @DoLogSender;
|
||||
try
|
||||
Engine.OnLog:= @DoLogSender;
|
||||
Engine.ExamplesPath:=Self.ExamplesPath;
|
||||
// get documentation Writer html, latex, and other
|
||||
WriterClass:=GetWriterClass(Options.Backend);
|
||||
For J:=0 to Apackage.Imports.Count-1 do
|
||||
|
Loading…
Reference in New Issue
Block a user