Browse Source

* Fix memleak, additional list/indent, patch from Andrey Sobol

git-svn-id: trunk@48091 -
(cherry picked from commit cccff5826e2deb66371aaf7cbe359af9f62932b3)
michael 4 years ago
parent
commit
96fe2661fd
3 changed files with 6 additions and 18 deletions
  1. 3 2
      utils/fpdoc/dw_basemd.pp
  2. 2 15
      utils/fpdoc/dw_markdown.pp
  3. 1 1
      utils/fpdoc/dwriter.pp

+ 3 - 2
utils/fpdoc/dw_basemd.pp

@@ -21,8 +21,8 @@ uses
   Classes, SysUtils, dwriter, DOM, pastree, dglobals;
 
 Const
-  MaxIndents = 10;
-  MaxLists = 10;
+  MaxIndents = 32;
+  MaxLists = 32;
 
 Type
   THeaderLevel = 1..6;
@@ -842,6 +842,7 @@ end;
 destructor TBaseMarkdownWriter.Destroy;
 begin
   FreeAndNil(FMarkDown);
+  FreeAndNil(FMetadata);
   inherited Destroy;
 end;
 

+ 2 - 15
utils/fpdoc/dw_markdown.pp

@@ -124,7 +124,6 @@ type
     procedure WriteDocPage(const aFileName: String; aElement: TPasElement; aSubPageIndex: Integer); override;
 
     // Start producing html complete package documentation
-    function  ModuleForElement(AnElement:TPasElement):TPasModule;
 
     Function InterPretOption(Const Cmd,Arg : String) : boolean; override;
     Procedure WriteDoc; override;
@@ -326,18 +325,6 @@ begin
   Result:=FHeaderMarkDown;
 end;
 
-
-
-function  TMarkdownWriter.ModuleForElement(AnElement:TPasElement):TPasModule;
-
-begin
-  result:=TPasModule(AnElement);
-  while assigned(result) and not (result is TPasModule) do 
-        result:=TPasModule(result.parent);
-  if not (result is TPasModule) then
-   result:=nil;
-end;
-
 procedure TMarkdownWriter.AppendShortDescr(AContext: TPasElement; DocNode: TDocNode) ;
 
 Var
@@ -715,7 +702,7 @@ begin
 
       DescrEndTableCell;
       DescrBeginTableCell;
-      DescrEl:=Engine.FindShortDescr(ModuleForElement(AElement),UTF8Encode(aList[i]));
+      DescrEl:=Engine.FindShortDescr(AElement.GetModule(),UTF8Encode(aList[i]));
       if Assigned(DescrEl) then
         ConvertShort(AElement, DescrEl)
       else
@@ -882,7 +869,7 @@ type
     PE:=EN.Element;
     DescrBeginListItem;
     AppendHyperLink(PE);
-    PM:=ModuleForElement(PE);
+    PM:=PE.GetModule();
     if (PM<>Nil) then
       begin
       AppendText(' (');

+ 1 - 1
utils/fpdoc/dwriter.pp

@@ -282,7 +282,7 @@ Type
     procedure AllocateClassMemberPages(AModule: TPasModule; LinkList: TObjectList); virtual;
     procedure AllocateModulePages(AModule: TPasModule; LinkList: TObjectList); virtual;
     procedure AllocatePackagePages; virtual;
-    // Prefix every filename generated with the eesult of this.
+    // Prefix every filename generated with the result of this.
     function GetFileBaseDir(aOutput: String): String; virtual;
 
     function  ModuleHasClasses(AModule: TPasModule): Boolean;