class documentation

class Template(abc.ABC):

Known subclasses: pydoctor.templatewriter.HtmlTemplate, pydoctor.templatewriter.StaticTemplate

View In Hierarchy

Represents a pydoctor template file.

It holds references to template information.

It's an additionnal level of abstraction to hook to the writer class.

Use Template.fromfile or Template.fromdir to create Templates.

See Also
TemplateLookup, StaticTemplate and HtmlTemplate
Note

Directories are not Template. The Template.name attribute is the relative path to the template file, it may include subdirectories in it!

Currently, subdirectories should only contains static templates. This is because the subdirectory creation is handled in StaticTemplate.write().

Class Method fromdir Scan a directory for templates.
Class Method fromfile Create a concrete template object. Type depends on the file extension.
Method __init__ Undocumented
Instance Variable name Template filename, may include subdirectories.
@classmethod
def fromdir(cls, basedir, subdir=None):
Scan a directory for templates.
Parameters
basedir:Union[Traversable, Path]A Path or Traversable object that should point to the root directory of the template directory structure.
subdir:Optional[PurePath]The subdirectory inside the template directory structure that we want to scan, relative to the basedir. Scan the basedir if None.
Returns
Iterator[Template]Undocumented
Raises
FailedToCreateTemplateIf the path is not a directory or do not exist.
@classmethod
def fromfile(cls, basedir, templatepath):
Create a concrete template object. Type depends on the file extension.
Parameters
basedir:Union[Traversable, Path]A Path or Traversable object that should point to the root directory of the template directory structure.
templatepath:PurePathThe path to the template file, relative to the basedir.
Returns
Optional[Template]The template object or None if a the path entry is not a file.
Raises
FailedToCreateTemplateIf there is an error while creating the template.
def __init__(self, name):

Undocumented

Parameters
name:strUndocumented
name =
Template filename, may include subdirectories.