⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uhtmldoc.pas

📁 DelphiDoc is a program for automatic generation of documentation on a Delphi-Project. At the momen
💻 PAS
📖 第 1 页 / 共 5 页
字号:
end;






{Generate the help on a GUI.
~param LogFiles the list of log files with the data about the GUI
~result if the documentation has been successfully generated and generation
        hasn't been aborted }
function THTMLDoc.DoGenerateGUIHelp(LogFiles: TStrings): Boolean;
var      F       :TextFile;       //the index file
begin
 StartDocumentation;              //start the generating of the documentation

 //create main index file
 CreateFile(F, 'index', Localize(dtIndexTitle), Localize(dtKeyWordMainIndex));
 try
   WriteLn(F, Localize(dtIndexThisIsTheIndex), '<br>');
   WriteLn(F, Localize(dtIndexDocumentationGeneratedAtPre), TimeToStr(Now),
              Localize(dtIndexDocumentationGeneratedAtMiddle),
              FormatDateTime('dddddd', Now),
              Localize(dtIndexDocumentationGeneratedAtPost), '<br>');
   WriteLn(F, '<br>');



   Progress.SetWorkText('Parsing Log Files');
   //parse all log files
   GUIHelpReader.ParseAllLogFiles(LogFiles);


   Progress.SetWorkText('Generating GUI Help');
   Progress.SetMaximum(GUIHelpReader.GUIHelpData.Count);
   WriteLn(F, '<ul>');                      //create list for all files

   WriteLn(F, GenerateGUIHelpDatas);        //generate the help and write links

   WriteLn(F, '</ul>');                     //end the list
   WriteLn(F, '<br>');



   Progress.SetWorkText('User Documentation');
   Progress.SetMaximum(1);

   //create the user documentation
   if CreateUserDocumentation then
    begin
     WriteLn(F, '<p>');
     WriteLn(F, Localize(dtIndexLinkUserDocumentationPre),
                '<a href="User_0.html">',
                Localize(dtDocumentationLinkUserIndex), '</a>',
                Localize(dtIndexLinkUserDocumentationPost), '<p>');
     WriteLn(F, UserDocIndexText, '<p>');
    end;

   Progress.StepProgress;
 finally
  EndFile(F);                    //close the index file
 end;


 //check for unused topics
 GUIHelpReader.CheckGUIDocumentationTopicUsage;


 EndDocumentation;                //end the documentation

 Result := True;                  //documentation successfully created
end;

{Generate only the user documentation.
~result if the documentation has been successfully generated and generation
        hasn't been aborted }
function THTMLDoc.DoGenerateOnlyUserDocumentation: Boolean;
var      F       :TextFile;       //the index file
begin
 StartDocumentation;              //start the generating of the documentation

 //create main index file
 CreateFile(F, 'index', Localize(dtIndexTitle), Localize(dtKeyWordMainIndex));
 try
   WriteLn(F, Localize(dtIndexThisIsTheIndex), '<br>');
   WriteLn(F, Localize(dtIndexDocumentationGeneratedAtPre), TimeToStr(Now),
              Localize(dtIndexDocumentationGeneratedAtMiddle),
              FormatDateTime('dddddd', Now),
              Localize(dtIndexDocumentationGeneratedAtPost), '<br>');
   WriteLn(F, '<br>');


   Progress.SetWorkText('User Documentation');
   //create the user documentation
   if CreateUserDocumentation then
    begin
     WriteLn(F, '<p>');
     WriteLn(F, Localize(dtIndexLinkUserDocumentationPre),
                '<a href="User_0.html">',
                Localize(dtDocumentationLinkUserIndex), '</a>',
                Localize(dtIndexLinkUserDocumentationPost), '<p>');
     WriteLn(F, UserDocIndexText, '<p>');
    end;

 finally
  EndFile(F);                    //close the index file
 end;


 EndDocumentation;                //postprocess the documentation

 Result := True;                  //documentation successfully created
end;

{Process parsed data; for instance generate some documentation about it.
~result if the documentation has been successfully generated and generation
        hasn't been aborted }
function THTMLDoc.DoGenerateDocumentation: Boolean;
var      F                 :TextFile;            //the index file
         //counter through all kinds of record-like types
         rk                :TRecordKind;
         SpecificList      :TIdentifierFileList; //list of special identifiers
         UsedDummy         :TextFile;            //file of long functions
begin
 StartDocumentation;              //start the generating of the documentation

 //create documentation about all files and their direct identifiers
 WriteFilesDocumentation;

 //create documentation about all record-like types
 for rk := low(rk) to high(rk) do
  WriteClassesDocumentation(rk);


 SetCommentIdent(nil, nil);       //no documentation of a special identifier

 Progress.SetWorkText('Write Index-Files...');
 Progress.SetMaximum(7);


 //create main index file
 CreateFile(F, 'index', Localize(dtIndexTitle), Localize(dtKeyWordMainIndex));
 try
   WriteLn(F, Localize(dtIndexThisIsTheIndex), '<br>');
   WriteLn(F, Localize(dtIndexDocumentationGeneratedAtPre),
              TimeToStr(Now),
              Localize(dtIndexDocumentationGeneratedAtMiddle),
              FormatDateTime('dddddd', Now),
              Localize(dtIndexDocumentationGeneratedAtPost), '<br>');
   WriteLn(F, '<br>');


   //create list for special identifiers
   SpecificList := TIdentifierFileList.Create;
   try
     Progress.SetProcessText('list of platform-specific identifiers');

     if not (ipPlatform in IgnoredPortabilityIssues) and
        not (dsfPlatform in DocumentationSectionsFilter) then
      begin
       //get all platform dependic (portability issue) identifiers and
       GetPortabilityIdents(SpecificList, ipPlatform);         //write the list
       if WriteListFile('Platform',
                        Localize(dtDocumentationIdentListHeaderPre) +
                        Localize(dtPortabilityPlatform) +
                        Localize(dtDocumentationIdentListHeaderPost),
                        Localize(dtPortabilityPlatform),
                        Localize(dtKeyWordListPlatform), SpecificList) then
        WriteLn(F, Localize(dtListsLinkPre), '<a href="Platform.html">',
                   Localize(dtPortabilityPlatform), '</a>',
                   Localize(dtListsLinkPost), '<br>');
      end;

     Progress.StepProgress;


     Progress.SetProcessText('list of library-specific identifiers');

     if not (ipLibrary in IgnoredPortabilityIssues) and
        not (dsfLibrary in DocumentationSectionsFilter) then
      begin
       SpecificList.RemoveAll;
       //get all library specific (portability issue) identifiers and
       GetPortabilityIdents(SpecificList, ipLibrary);          //write the list
       if WriteListFile('Library',
                        Localize(dtDocumentationIdentListHeaderPre) +
                        Localize(dtPortabilityLibrary) +
                        Localize(dtDocumentationIdentListHeaderPost),
                        Localize(dtPortabilityLibrary),
                        Localize(dtKeyWordListLibrary), SpecificList) then
        WriteLn(F, Localize(dtListsLinkPre), '<a href="Library.html">',
                   Localize(dtPortabilityLibrary), '</a>',
                   Localize(dtListsLinkPost), '<br>');
      end;

     Progress.StepProgress;


     Progress.SetProcessText('list of deprecated identifiers');

     if not (ipDeprecated in IgnoredPortabilityIssues) and
        not (dsfDeprecated in DocumentationSectionsFilter) then
      begin
       SpecificList.RemoveAll;
       //get all deprecated (portability issue) identifiers and write the list
       GetPortabilityIdents(SpecificList, ipDeprecated, FDeprecatedList);
       if WriteListFile('Deprecated',
                        Localize(dtDocumentationIdentListHeaderPre) +
                        Localize(dtPortabilityDeprecated) +
                        Localize(dtDocumentationIdentListHeaderPost),
                        Localize(dtPortabilityDeprecated),
                        Localize(dtKeyWordListDeprecated), SpecificList) then
        WriteLn(F, Localize(dtListsLinkPre), '<a href="Deprecated.html">',
                   Localize(dtPortabilityDeprecated), '</a>',
                   Localize(dtListsLinkPost), '<br>');
      end;

     Progress.StepProgress;
   finally
    SpecificList.Free;
   end;


   Progress.SetProcessText('list of unfinished identifiers');

   //write list of all unfinished (TODO) identifiers
   if not (dsfToDo in DocumentationSectionsFilter) and
      WriteListFile('TODO',
                    Localize(dtDocumentationIdentListHeaderPre) +
                    Localize(dtSpecialDescriptionToDo) +
                    Localize(dtDocumentationIdentListHeaderPost),
                    Localize(dtSpecialDescriptionToDo),
                    Localize(dtKeyWordListToDo), FTODOList) then
    WriteLn(F, Localize(dtListsLinkPre), '<a href="TODO.html">',
               Localize(dtSpecialDescriptionToDo), '</a>',
               Localize(dtListsLinkPost), '<br>');

   Progress.StepProgress;


   Progress.SetProcessText('list of feature-missing identifiers');

   //write list of all feature-missing identifiers
   if not (dsfFeature in DocumentationSectionsFilter) and
      WriteListFile('Feature',
                    Localize(dtDocumentationIdentListHeaderPre) +
                    Localize(dtSpecialDescriptionFeature) +
                    Localize(dtDocumentationIdentListHeaderPost),
                    Localize(dtSpecialDescriptionFeature),
                    Localize(dtKeyWordListFeature), FFeatureList) then
    WriteLn(F, Localize(dtListsLinkPre), '<a href="Feature.html">',
               Localize(dtSpecialDescriptionFeature), '</a>',
               Localize(dtListsLinkPost), '<br>');

   Progress.StepProgress;




   //write list of exported identifiers

   Progress.SetProcessText('exported identifiers');

   if not (dsfExporteds in DocumentationSectionsFilter) and
      WriteExportsList(UsedDummy) then
    begin
     WriteLn(F, '<br>');
     WriteLn(F, Localize(dtListExportedLinkPre),
                '<a href="Exported.html">',
                Localize(dtListExportedLinkLink), '</a>',
                Localize(dtListExportedLinkMiddle),
                '<a href="ExportedByFile.html">',
                Localize(dtListExportedLinkLinkFile), '</a>',
                Localize(dtListExportedLinkPost), '<br>');
    end;

   Progress.StepProgress;






   Progress.SetProcessText('List of long functions');

   //write list of all long functions
   if not (dsfLongFunctions in DocumentationSectionsFilter) and
      WriteLongFunctionList(UsedDummy) then
    begin
     WriteLn(F, '<br>');
     WriteLn(F, Localize(dtListLongFunctionsLinkPre), '<a href="LongFunctions.html">',
                Localize(dtListLongFunctionsLinkLink), '</a>',
                Localize(dtListLongFunctionsLinkPost), '<br>');
    end;

   Progress.StepProgress;






   if not (dsfIndex in DocumentationSectionsFilter) then
    begin
     //generate index of all identifiers
     GenerateIndex;
     WriteLn(F, '<br>');
     WriteLn(F, Localize(dtDocumentationIndexLinkPre),
                '<a href="Index_A.html">',
                Localize(dtDocumentationIndexLinkLink), '</a>',
                Localize(dtDocumentationIndexLinkPost), '<br>');
    end;




   Progress.SetWorkText('User Documentation');
   Progress.SetMaximum(1);

   //create the user documentation
   if CreateUserDocumentation then
    begin
     WriteLn(F, '<p>');
     WriteLn(F, Localize(dtIndexLinkUserDocumentationPre),
                '<a href="User_0.html">',
                Localize(dtDocumentationLinkUserIndex), '</a>',
                Localize(dtIndexLinkUserDocumentationPost), '<p>');
     WriteLn(F, UserDocIndexText, '<p>');
    end;

   Progress.StepProgress;
 finally
  EndFile(F);                     //close the index file
 end;


 EndDocumentation;                //end the documentation

 Result := True;                  //documentation successfully created
end;





initialization
{$IFOPT C+}
 THTMLDoc.Create.Destroy;         //generate warning, if class is abstract
{$ENDIF}
 AddGeneratorClass(THTMLDoc);     //register generator class

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -