mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-13 00:29:48 +02:00
* Move chm writer to separate unit
git-svn-id: trunk@47868 -
This commit is contained in:
parent
185f20b9ec
commit
f1db695809
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -19286,9 +19286,9 @@ utils/fpdoc/Makefile.fpc.fpcmake svneol=native#text/plain
|
||||
utils/fpdoc/README.txt svneol=native#text/plain
|
||||
utils/fpdoc/css.inc svneol=native#text/plain
|
||||
utils/fpdoc/dglobals.pp svneol=native#text/plain
|
||||
utils/fpdoc/dw_chm.pp svneol=native#text/plain
|
||||
utils/fpdoc/dw_dxml.pp svneol=native#text/plain
|
||||
utils/fpdoc/dw_html.pp svneol=native#text/plain
|
||||
utils/fpdoc/dw_htmlchm.inc svneol=native#text/plain
|
||||
utils/fpdoc/dw_ipflin.pas svneol=native#text/plain
|
||||
utils/fpdoc/dw_latex.pp svneol=native#text/plain
|
||||
utils/fpdoc/dw_linrtf.pp svneol=native#text/plain
|
||||
|
@ -1,5 +1,10 @@
|
||||
{%mainunit dw_html}
|
||||
{$IFDEF chmInterface}
|
||||
unit dw_chm;
|
||||
|
||||
interface
|
||||
|
||||
uses Classes, DOM, DOM_HTML,
|
||||
dGlobals, PasTree, dwriter, dw_html, ChmWriter, chmtypes;
|
||||
|
||||
type
|
||||
|
||||
{ TFpDocChmWriter }
|
||||
@ -42,7 +47,10 @@ type
|
||||
Class Function FileNameExtension : String; override;
|
||||
Class procedure SplitImport(var AFilename, ALinkPrefix: String); override;
|
||||
end;
|
||||
{$ELSE} // implementation
|
||||
|
||||
implementation
|
||||
|
||||
uses SysUtils, HTMWrite, chmsitemap;
|
||||
|
||||
{ TFpDocChmWriter }
|
||||
|
||||
@ -470,7 +478,7 @@ var
|
||||
i: Integer;
|
||||
PageDoc: TXMLDocument;
|
||||
FileStream: TMemoryStream;
|
||||
FileName: String;
|
||||
IFileName,FileName: String;
|
||||
FilePath: String;
|
||||
begin
|
||||
FileName := Engine.Output;
|
||||
@ -520,16 +528,16 @@ begin
|
||||
|
||||
//write any found images to CHM stream
|
||||
FileStream := TMemoryStream.Create;
|
||||
for i := 0 to FImageFileList.Count - 1 do
|
||||
for iFilename in ImageFileList do
|
||||
begin
|
||||
{$ifdef imagetest} DoLog(' adding image: '+FImageFileList[i]); {$endif}
|
||||
if FileExists(FImageFileList[i]) then
|
||||
{$ifdef imagetest} DoLog(' adding image: '+iFileName); {$endif}
|
||||
if FileExists(iFileName) then
|
||||
begin
|
||||
{$ifdef imagetest} DoLog(' - found'); {$endif}
|
||||
FileName := ExtractFileName(FImageFileList[i]);
|
||||
FilePath := '/'+FixHTMLpath(ExtractFilePath(FImageFileList[i]));
|
||||
FileName := ExtractFileName(iFileName);
|
||||
FilePath := '/'+FixHTMLpath(ExtractFilePath(iFileName));
|
||||
|
||||
FileStream.LoadFromFile(FImageFileList[i]);
|
||||
FileStream.LoadFromFile(iFileName);
|
||||
FChm.AddStreamToArchive(FileName, FilePath, FileStream, True);
|
||||
FileStream.Size := 0;
|
||||
end
|
||||
@ -629,4 +637,8 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{$ENDIF}
|
||||
initialization
|
||||
RegisterWriter(TCHMHTMLWriter,'chm','Compressed HTML file output using fpdoc.css stylesheet.');
|
||||
finalization
|
||||
UnRegisterWriter('chm');
|
||||
end.
|
@ -19,7 +19,7 @@ unit dw_html;
|
||||
{$WARN 5024 off : Parameter "$1" not used}
|
||||
interface
|
||||
|
||||
uses Classes, DOM, DOM_HTML, dGlobals, PasTree, dWriter, ChmWriter, chmtypes;
|
||||
uses Classes, DOM, DOM_HTML, dGlobals, PasTree, dWriter;
|
||||
|
||||
const
|
||||
// Subpage indices for modules
|
||||
@ -273,16 +273,15 @@ type
|
||||
Property IndexColCount : Integer Read FIndexColCount write FIndexColCount;
|
||||
Property BaseImageURL : String Read FBaseImageURL Write FBaseImageURL;
|
||||
Property UseMenuBrackets : Boolean Read FUseMenuBrackets write FUseMenuBrackets;
|
||||
Property ImageFileList : TStrings Read FImageFileList;
|
||||
end;
|
||||
|
||||
{$DEFINE chmInterface}
|
||||
{$I dw_htmlchm.inc}
|
||||
{$UNDEF chmInterface}
|
||||
|
||||
Function FixHTMLpath(S : String) : STring;
|
||||
|
||||
implementation
|
||||
|
||||
uses SysUtils, XMLRead, HTMWrite, sh_pas, fpdocclasstree,
|
||||
chmsitemap;
|
||||
uses SysUtils, XMLRead, HTMWrite, sh_pas, fpdocclasstree;
|
||||
|
||||
{$i css.inc}
|
||||
{$i plusimage.inc}
|
||||
@ -294,7 +293,6 @@ begin
|
||||
Result:=StringReplace(S,'\','/',[rfReplaceAll]);
|
||||
end;
|
||||
|
||||
{$I dw_htmlchm.inc}
|
||||
|
||||
procedure TFileAllocator.AllocFilename(AElement: TPasElement;
|
||||
ASubindex: Integer);
|
||||
@ -3955,9 +3953,8 @@ end;
|
||||
initialization
|
||||
// Do not localize.
|
||||
RegisterWriter(THTMLWriter,'html','HTML output using fpdoc.css stylesheet.');
|
||||
RegisterWriter(TCHMHTMLWriter,'chm','Compressed HTML file output using fpdoc.css stylesheet.');
|
||||
|
||||
finalization
|
||||
UnRegisterWriter('html');
|
||||
UnRegisterWriter('chm');
|
||||
|
||||
end.
|
||||
|
@ -31,6 +31,8 @@ uses
|
||||
dw_XML, // XML writer
|
||||
dw_dxml, // Delphi XML doc.
|
||||
dw_HTML, // HTML writer
|
||||
dw_chm, // CHM Writer
|
||||
// dw_markdown, // Markdown writer
|
||||
dw_ipflin, // IPF writer (new linear output)
|
||||
dw_man, // Man page writer
|
||||
dw_linrtf, // linear RTF writer
|
||||
|
Loading…
Reference in New Issue
Block a user