* Patch from Reinier Olislaghers - some cosmetic changes (Bug ID 23506)

git-svn-id: trunk@23171 -
This commit is contained in:
michael 2012-12-18 11:06:01 +00:00
parent 0196c62ee8
commit 813b91a596
6 changed files with 80 additions and 49 deletions

View File

@ -82,6 +82,8 @@ resourcestring
SDocVisibility = 'Visibility';
SDocOpaque = 'Opaque type';
SDocDateGenerated = 'Documentation generated on: %s';
// The next line requires leading/trailing space due to XML comment layout:
SDocGeneratedByComment = ' Generated using FPDoc - (c) 2000-2012 FPC contributors and Sebastian Guenther, sg@freepascal.org ';
SDocNotes = 'Notes';
// Topics
@ -135,32 +137,37 @@ resourcestring
SCmdLineHelp = 'Usage: %s [options]';
SUsageOption010 = '--content Create content file for package cross-references';
SUsageOption020 = '--cputarget=value Set the target CPU for the scanner.';
SUsageOption030 = '--descr=name use name as description file. ';
SUsageOption030 = '--descr=file use file as description file, e.g.: ';
SUsageOption035 = ' --descr=c:\WIP\myzipperdoc.xml';
SUsageOption040 = ' This option is allowed more than once';
SUsageOption050 = '--format=fmt Select output format.';
SUsageOption060 = '--help Show this help.';
SUsageOption070 = '--hide-protected Do not show protected methods in overview';
SUsageOption080 = '--import=file Import content file for package cross-references';
SUsageOption090 = '--input=cmd use cmd as input for the parser.';
SUsageOption100 = ' At least one input option is required.';
SUsageOption110 = '--lang=lng Select output language.';
SUsageOption120 = '--ostarget=value Set the target OS for the scanner.';
SUsageOption130 = '--output=name use name as the output name.';
SUsageOption140 = ' Each backend interpretes this as needed.';
SUsageOption150 = '--package=name Set the package name for which to create output';
SUsageOption155 = '--project=file Use file as project file';
SUsageOption160 = '--show-private Show private methods.';
SUsageOption170 = '--warn-no-node Warn if no documentation node was found.';
SUsageOption180 = '--mo-dir=dir Set directory where language files reside to dir';
SUsageOption190 = '--parse-impl (Experimental) try to parse implementation too';
SUsageOption200 = '--dont-trim Don''t trim XML contents';
SUsageOption210 = '--write-project=file Do not write documentation, create project file instead';
SUsageOption220 = '--verbose Write more information on the screen';
SUsageOption230 = '--dry-run Only parse sources and XML, do not create output';
SUsageOption240 = '--descr-dir=Dir Add All XML files in Dir to list of description files';
SUsageOption250 = '--input-dir=Dir Add All *.pp and *.pas files in Dir to list of input files';
SUsageOption260 = '--write-project=file Write all command-line options to a project file';
SUsageOption050 = '--descr-dir=Dir Add All XML files in Dir to list of description files';
SUsageOption060 = '--format=fmt Select output format.';
SUsageOption070 = '--help Show this help.';
SUsageOption080 = '--hide-protected Do not show protected methods in overview';
SUsageOption090 = '--import=file Import content file for package cross-references';
SUsageOption100 = '--input=cmd use cmd as input for the parser, e.g.:';
SUsageOption110 = ' --input=C:\fpc\packages\paszlib\src\zipper.pp';
SUsageOption120 = ' At least one input option is required.';
SUsageOption130 = '--input-dir=Dir Add All *.pp and *.pas files in Dir to list of input files';
SUsageOption140 = '--lang=lng Select output language.';
SUsageOption150 = '--ostarget=value Set the target OS for the scanner.';
SUsageOption160 = '--output=name use name as the output name.';
SUsageOption170 = ' Each backend interpretes this as needed.';
SUsageOption180 = '--package=name Set the package name for which to create output,';
SUsageOption190 = ' e.g. --package=fcl';
SUsageOption200 = '--project=file Use file as project file';
SUsageOption210 = '--show-private Show private methods.';
SUsageOption220 = '--warn-no-node Warn if no documentation node was found.';
SUsageOption230 = '--mo-dir=dir Set directory where language files reside to dir';
SUsageOption240 = '--parse-impl (Experimental) try to parse implementation too';
SUsageOption250 = '--dont-trim Do not trim XML contents. Useful for preserving';
SUsageOption260 = ' formatting inside e.g <pre> tags';
SUsageOption270 = '--write-project=file';
SUsageOption280 = ' Do not write documentation, create project file instead';
SUsageOption290 = '--verbose Write more information on the screen';
SUsageOption300 = '--dry-run Only parse sources and XML, do not create output';
SUsageOption310 = '--write-project=file';
SUsageOption320 = ' Write all command-line options to a project file';
SUsageFormats = 'The following output formats are supported by this fpdoc:';
SUsageBackendHelp = 'Specify an output format, combined with --help to get more help for this backend.';
@ -171,6 +178,7 @@ resourcestring
SCmdLineOutputOptionMissing = 'Need an output filename, please specify one with --output=<filename>';
SWritingPages = 'Writing %d pages...';
SNeedPackageName = 'No package name specified. Please specify one using the --package option.';
SAvailablePackages = 'Available packages: ';
SDone = 'Done.';
SErrCouldNotCreateOutputDir = 'Could not create output directory "%s"';
SErrCouldNotCreateFile = 'Could not create file "%s": %s';

View File

@ -3,6 +3,8 @@
FPDoc - Free Pascal Documentation Tool
Copyright (C) 2000 - 2003 by
Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org
2005-2012 by
various FPC contributors
* 'XML struct' output generator
@ -21,7 +23,7 @@ unit dw_XML;
interface
uses DOM, PasTree, dwriter, xmlWrite, SysUtils;
uses DOM, PasTree, dGlobals, dwriter, xmlWrite, SysUtils;
Type
@ -93,7 +95,7 @@ var
begin
Result := TXMLDocument.Create;
Result.AppendChild(Result.CreateComment(' Generated using FPDoc - (c) 2000-2003 Sebastian Guenther, sg@freepascal.org '));
Result.AppendChild(Result.CreateComment(SDocGeneratedByComment));
Result.AppendChild(Result.CreateElement('fp-refdoc'));
ModuleElement := Result.CreateElement('unit');
ModuleElement['name'] := AModule.Name;

View File

@ -3,6 +3,8 @@
FPDoc - Free Pascal Documentation Tool
Copyright (C) 2000 - 2003 by
Areca Systems GmbH / Sebastian Guenther, sg@freepascal.org
2005-2012 by
various FPC contributors
* Output string definitions
* Basic writer (output generator) class

View File

@ -22,7 +22,7 @@ uses
cwstring,
{$endif}
SysUtils, Classes, Gettext, custapp,
dGlobals, // GLobal definitions, constants.
dGlobals, // Global definitions, constants.
dwriter, // TFPDocWriter definition.
dwlinear, // Linear (abstract) writer
dw_LaTeX, // TLaTex writer
@ -32,14 +32,15 @@ uses
dw_ipflin, // IPF writer (new linear output)
dw_man, // Man page writer
dw_linrtf, // linear RTF writer
dw_txt, fpdocproj, mkfpdoc; // TXT writer
dw_txt, // TXT writer
fpdocproj, mkfpdoc;
Type
{ TFPDocAplication }
{ TFPDocApplication }
TFPDocAplication = Class(TCustomApplication)
TFPDocApplication = Class(TCustomApplication)
private
FCreator : TFPDocCreator;
FPackage : TFPDocPackage;
@ -49,7 +50,7 @@ Type
Protected
procedure OutputLog(Sender: TObject; const Msg: String);
procedure ParseCommandLine;
procedure Parseoption(const S: String);
procedure ParseOption(const S: String);
Procedure Usage(AnExitCode : Byte);
Procedure DoRun; override;
Public
@ -59,7 +60,7 @@ Type
end;
Procedure TFPDocAplication.Usage(AnExitCode : Byte);
Procedure TFPDocApplication.Usage(AnExitCode : Byte);
Var
I,P : Integer;
@ -73,6 +74,7 @@ begin
Writeln(SUsageOption010);
Writeln(SUsageOption020);
Writeln(SUsageOption030);
Writeln(SUsageOption035);
Writeln(SUsageOption040);
Writeln(SUsageOption050);
Writeln(SUsageOption060);
@ -85,7 +87,6 @@ begin
Writeln(SUsageOption130);
Writeln(SUsageOption140);
Writeln(SUsageOption150);
Writeln(SUsageOption155);
Writeln(SUsageOption160);
Writeln(SUsageOption170);
Writeln(SUsageOption180);
@ -97,6 +98,12 @@ begin
Writeln(SUsageOption240);
Writeln(SUsageOption250);
Writeln(SUsageOption260);
Writeln(SUsageOption270);
Writeln(SUsageOption280);
Writeln(SUsageOption290);
Writeln(SUsageOption300);
Writeln(SUsageOption310);
Writeln(SUsageOption320);
L:=TStringList.Create;
Try
Backend:=FCreator.OPtions.Backend;
@ -132,29 +139,40 @@ begin
Halt(AnExitCode);
end;
destructor TFPDocAplication.Destroy;
destructor TFPDocApplication.Destroy;
begin
FreeAndNil(FCreator);
Inherited;
end;
function TFPDocAplication.SelectedPackage: TFPDocPackage;
function TFPDocApplication.SelectedPackage: TFPDocPackage;
var
i:integer;
begin
Result:=FPackage;
if (FPackage=Nil) or (FPackage.Name='') then
begin
Writeln(SNeedPackageName);
if FCreator.Packages.Count>0 then
begin
if (FCreator.Packages[0].Name<>'') then
Writeln(SAvailablePackages);
for i:=0 to FCreator.Packages.Count-1 do
begin
Writeln(FCreator.Packages[i].Name);
end;
end;
Usage(1);
end;
end;
procedure TFPDocAplication.OutputLog(Sender: TObject; const Msg: String);
procedure TFPDocApplication.OutputLog(Sender: TObject; const Msg: String);
begin
Writeln(StdErr,Msg);
end;
procedure TFPDocAplication.ParseCommandLine;
procedure TFPDocApplication.ParseCommandLine;
Function ProjectOpt(Const s : string) : boolean;
@ -185,8 +203,8 @@ begin
Fpackage:=FCreator.Packages.FindPackage(FCreator.Options.DefaultPackageName);
end;
If FCreator.Project.Packages.Count=0 then
begin
FPackage:=FCreator.Packages.Add as TFPDocPackage;
begin // Add default package if none defined
FPackage:=FCreator.Packages.Add as TFPDocPackage;
end;
// Check package
for i := 1 to ParamCount do
@ -204,7 +222,7 @@ begin
SelectedPackage; // Will print error if none available.
end;
procedure TFPDocAplication.Parseoption(Const S : String);
procedure TFPDocApplication.ParseOption(Const S : String);
procedure AddDirToFileList(List: TStrings; const ADirName, AMask: String);
@ -268,7 +286,7 @@ begin
else if s = '--stop-on-parser-error' then
FCreator.Options.StopOnParseError := True
else if s = '--dont-trim' then
FCreator.Options.donttrim := True
FCreator.Options.DontTrim := True
else
begin
i := Pos('=', s);
@ -345,7 +363,7 @@ begin
end;
end;
Procedure TFPDocAplication.DoRun;
Procedure TFPDocApplication.DoRun;
begin
{$IFDEF Unix}
@ -367,7 +385,7 @@ begin
Terminate;
end;
constructor TFPDocAplication.Create(AOwner: TComponent);
constructor TFPDocApplication.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
StopOnException:=true;
@ -376,7 +394,7 @@ begin
end;
begin
With TFPDocAplication.Create(Nil) do
With TFPDocApplication.Create(Nil) do
try
Run;
finally

View File

@ -15,8 +15,8 @@ Type
private
FContent: String;
FDescriptions: TStrings;
FIMports: TStrings;
FinPuts: TStrings;
FImports: TStrings;
FInputs: TStrings;
FName: String;
FOutput: String;
Public

View File

@ -38,8 +38,8 @@ Type
Public
Constructor Create(AOwner : TComponent); override;
Destructor Destroy; override;
Procedure CreateDocumentation(APackage : TFPDocPackage; ParseOnly : Boolean); virtual;
Procedure CreateProjectFile(Const AFileName : string);
Procedure CreateDocumentation(APackage : TFPDocPackage; ParseOnly : Boolean); virtual; //Writes out documentation in selected format
Procedure CreateProjectFile(Const AFileName : string); //Writes out project file with the chosen options
Procedure LoadProjectFile(Const AFileName: string);
Property Project : TFPDocProject Read FProject;
Property ScannerLogEvents : TPScannerLogEvents Read FScannerLogEvents Write FScannerLogEvents;
@ -189,6 +189,7 @@ var
WriterClass: TFPDocWriterClass;
begin
Cmd:='';
FCurPackage:=APackage;
Engine:=TFPDocEngine.Create;
try