* Support for date in footer

git-svn-id: trunk@11043 -
This commit is contained in:
michael 2008-05-22 20:09:41 +00:00
parent 7d236da474
commit f7f2008447
3 changed files with 34 additions and 3 deletions

View File

@ -76,6 +76,7 @@ resourcestring
SDocSynopsis = 'Synopsis'; SDocSynopsis = 'Synopsis';
SDocVisibility = 'Visibility'; SDocVisibility = 'Visibility';
SDocOpaque = 'Opaque type'; SDocOpaque = 'Opaque type';
SDocDateGenerated = 'Documentation generated on: %s';
// Topics // Topics
SDocRelatedTopics = 'Related topics'; SDocRelatedTopics = 'Related topics';
@ -98,6 +99,7 @@ resourcestring
// HTML usage // HTML usage
SHTMLUsageFooter = 'Append xhtml from file as footer to html page'; SHTMLUsageFooter = 'Append xhtml from file as footer to html page';
SHTMLUsageFooterDate = 'Append footer with date. fmt is Optional format for FormatDateTime';
// CHM usage // CHM usage
SCHMUsageTOC = 'Use [File] as the table of contents. Usually a .hhc file.'; SCHMUsageTOC = 'Use [File] as the table of contents. Usually a .hhc file.';

View File

@ -104,7 +104,8 @@ type
HighlighterFlags: Byte; HighlighterFlags: Byte;
FooterFile: string; FooterFile: string;
FIDF : Boolean;
FDateFormat: String;
function ResolveLinkID(const Name: String): DOMString; function ResolveLinkID(const Name: String): DOMString;
function ResolveLinkWithinPackage(AElement: TPasElement; function ResolveLinkWithinPackage(AElement: TPasElement;
ASubpageIndex: Integer): String; ASubpageIndex: Integer): String;
@ -240,7 +241,8 @@ type
property Allocator: TFileAllocator read FAllocator; property Allocator: TFileAllocator read FAllocator;
property Package: TPasPackage read FPackage; property Package: TPasPackage read FPackage;
property PageCount: Integer read GetPageCount; property PageCount: Integer read GetPageCount;
Property IncludeDateInFooter : Boolean Read FIDF Write FIDF;
Property DateFormat : String Read FDateFormat Write FDateFormat;
property OnTest: TNotifyEvent read FOnTest write SetOnTest; property OnTest: TNotifyEvent read FOnTest write SetOnTest;
Function InterPretOption(Const Cmd,Arg : String) : boolean; override; Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
Procedure WriteDoc; override; Procedure WriteDoc; override;
@ -1949,9 +1951,24 @@ begin
end; end;
procedure THTMLWriter.AppendFooter; procedure THTMLWriter.AppendFooter;
Var
S : String;
F : TDomElement;
begin begin
if FooterFile<>'' then if FooterFile<>'' then
ReadXMLFragment(BodyElement, FooterFile); ReadXMLFragment(BodyElement, FooterFile)
else if IncludeDateInFooter then
begin
CreateEl(BodyElement, 'hr');
F:=CreateEl(BodyElement,'span');
F['class']:='footer';
If (FDateFormat='') then
S:=DateToStr(Date)
else
S:=FormatDateTime(FDateFormat,Date);
AppendText(F,Format(SDocDateGenerated,[S]));
end;
end; end;
procedure THTMLWriter.FinishElementPage(AElement: TPasElement); procedure THTMLWriter.FinishElementPage(AElement: TPasElement);
@ -2971,6 +2988,11 @@ begin
SearchPage := Arg SearchPage := Arg
else if Cmd = '--footer' then else if Cmd = '--footer' then
FooterFile := Arg FooterFile := Arg
else if Cmd = '--footer-date' then
begin
FIDF:=True;
FDateFormat:=Arg;
end
else else
Result:=False; Result:=False;
end; end;
@ -2985,6 +3007,8 @@ class procedure THTMLWriter.Usage(List: TStrings);
begin begin
List.add('--footer'); List.add('--footer');
List.Add(SHTMLUsageFooter); List.Add(SHTMLUsageFooter);
List.Add('--footer-date[=Fmt]');
List.Add(SHTMLUsageFooterDate);
end; end;
// private methods // private methods

View File

@ -132,3 +132,8 @@ span.bartitle {
font-style: italic; font-style: italic;
color: darkblue color: darkblue
} }
span.footer {
font-style: italic;
color: darkblue
}