浏览代码

* Patch from Andrew that allows to set CHM title on the cmdline. (Mantis 18246)

git-svn-id: trunk@16583 -
marco 14 年之前
父节点
当前提交
08a89597c6
共有 2 个文件被更改,包括 10 次插入1 次删除
  1. 1 0
      utils/fpdoc/dglobals.pp
  2. 9 1
      utils/fpdoc/dw_htmlchm.inc

+ 1 - 0
utils/fpdoc/dglobals.pp

@@ -119,6 +119,7 @@ resourcestring
   SCHMUsageAutoTOC = 'Automatically generate a Table of Contents. Ignores --toc-file';
   SCHMUsageAutoIDX = 'Automatically generate an Index. Ignores --index-file';
   SCHMUsageMakeSearch = 'Automatically generate a Search Index from filenames that match *.htm*';
+  SCHMUsageChmTitle= 'Title of the chm. Defaults to the value from --package';
 
   // Linear usage
   SLinearUsageDupLinkedDocsP1 = 'Duplicate linked element documentation in';

+ 9 - 1
utils/fpdoc/dw_htmlchm.inc

@@ -10,6 +10,7 @@ type
     FChm: TChmWriter;
     FTempUncompressed: TStream;
     FTempUncompressedName: String;
+    FChmTitle: String;
     FTOCName,
     FIndexName,
     FDefaultPage: String;
@@ -450,7 +451,7 @@ begin
   FTempUncompressedName := GetTempFileName+IntToStr(GetProcessID) +'.raw';
   FTempUncompressed := TFileStream.Create(FTempUncompressedName, fmOpenReadWrite  or fmCreate);
   FChm := TChmWriter.Create(FOutChm, False);
-  FChm.Title := Copy(Package.Name, 2, Length(Package.Name));
+  FChm.Title := FChmTitle;
   FChm.TempRawStream := FTempUncompressed;
   FChm.OnGetFileData := @RetrieveOtherFiles;
   FChm.OnLastFile := @LastFileAdded;
@@ -512,8 +513,13 @@ begin
     FNoBinIndex := True
   else if Cmd = '--make-searchable' then
     FMakeSearchable := True
+  else if Cmd = '--chm-title' then
+    FChmTitle := arg
   else
     Result:=inherited InterPretOption(Cmd, Arg);
+
+  if Length(FChmTitle) = 0 then
+    FChmTitle := Copy(Package.Name, 2, Length(Package.Name));
 end;
 
 class procedure TCHMHTMLWriter.Usage(List: TStrings);
@@ -535,6 +541,8 @@ begin
   List.Add(SCHMUsageAutoTOC);
   List.add('--make-searchable');
   List.Add(SCHMUsageMakeSearch);
+  List.Add('--chm-title');
+  List.Add(SCHMUsageChmTitle);
 end;