ePages 6.10 - DE_EPAGES/SourceDoc/API/SourceDoc.pm

Package SourceDoc

Helper functions to parse source code to build a source code documentation

Example
my $SourceDoc = DE_EPAGES::SourceDoc::API::SourceDoc->new(
    TemplateDir => 'Templates',
);
$SourceDoc->documentFile( 'MyModule.pm', 'Doc/MyModule.html' );

Package DE_EPAGES::SourceDoc::API::SourceDoc

Functions

buildDirectoryPages
documentDir
documentFile
getFileTree
getIndex
languageTypes
new
parseFile

buildDirectoryPages

Creates 'index.html' pages for each directory that contains at least one HTLM help file. The index file contains links to files and sub directories.

Syntax
$self->buildDirectoryPages( $hTreeVars, $TargetDir )
Input
$hTreeVars (hash ref)
directory tree as TLE structure from getFileTree
$TargetDir (string)
target help file directory

documentDir

Creates source code documentation for a directory of source files.

Syntax
$self->documentDir($aProcessDirs, $aExtensions)
Input
$aProcessDirs (ref.array.string)
directories to process
$aExtensions (array ref)
list of file extensions, for example ['pl', 'pm']

documentFile

Creates source code documentation for a sinlge file

Syntax
$self->documentFile($SourceFile, $TargetFile);
Input
$SourceFile (string)
source file name
$TargetFile (string)
target file name

getFileTree

Creates the structure of the table of contents tree.

Syntax
$hTreeVars = $self->getFileTree( $aResult );
Input
$aResult (array ref)
array of file syntax trees, created by parseCode
Return
$hTreeVars (hash ref)
TLE structure for the directory or table of contents tree

getIndex

Creates an index that contains all function names and package names.

Syntax
$aIndex = $self->getIndex( $aResult );
Input
$aResult (array ref)
array of file syntax trees, created by parseCode
Return
$aIndex (array ref)
array of index entries. Each element has the format

{
Name => $Name,
Link => $Link
}

languageTypes

returns all supported source code languages as extension => language hash.

Syntax
$hLanguages = $self->languageTypes;
Return
$hLanguages (hash ref)
language types { extension => language, ... }

new

Creates a new source documentation object.

Syntax
DE_EPAGES::SourceDoc::API::SourceDoc->new( %Options );
Input
%Options (hash)
The following options are supported:
  • TemplateDir - template directory
  • SourceDir - source directory
  • TargetDir - target directory
  • BuildWinHelp - build a CHM project
  • Project - extract documentation for the specific project
  • DefaultState - default state (public|private)
  • ProjectName - documentation project title
  • Date - creation date (optional scalar localtime) | string
  • Year - copyright year (optional 1900 + (localtime)[5]) | string
Return
$SourceDoc (object)
SourceDoc object

parseFile

Parses a source file and returns the syntax tree as TLE structure.

Syntax
$hVars = parseFile( $SourceFile );
Input
$SourceFile (string)
source file name
Return
$hVars (hash ref)
TLE structure of the syntax tree