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