class TemplateLookup:
The TemplateLookup
handles the HTML template files locations. A little bit like mako.lookup.TemplateLookup but more simple.
The location of the files depends wether the users set a template directory with the option --template-dir and/or with the option --theme, any files in a template directory will be loaded.
This object allow the customization of any templates.
For HTML templates, this can lead to warnings when upgrading pydoctor, then, please update your template from our repo.
See Also | |
Template , StaticTemplate , HtmlTemplate | |
Notes | |
The HTML templates versions are independent of the pydoctor version and are idependent from each other. | |
Template operations are case insensitive. |
Method | __init__ |
Loads all templates from the given path into the lookup. |
Method | add_template |
Add a template to the lookup. The custom template override the default. |
Method | add_templatedir |
Scan a directory and add all templates in the given directory to the lookup. |
Method | get_loader |
Lookup a HTML template loader based on its filename. |
Method | get_template |
Lookup a template based on its filename. |
Property | templates |
All templates that can be looked up. For each name, the custom template will be included if it exists, otherwise the default template. |
Method | _add_overriding_html_template |
Undocumented |
Method | _raise_if_overrides_directory |
Undocumented |
Instance Variable | _templates |
Undocumented |
Parameters | |
path:Union[ | A Path or Traversable object pointing to a directory to load the default set of templates from. |
Add a template to the lookup. The custom template override the default.
If the file doesn't already exist in the lookup, we assume it is additional data used by the custom template.
For HTML, compare the new Template version with the currently loaded template, issue warnings if template are outdated.
Parameters | |
template:Template | Undocumented |
Raises | |
UnsupportedTemplateVersion | If the custom template is designed for a newer version of pydoctor. |
OverrideTemplateNotAllowed | If this template path overrides a path of a different type (HTML/static/directory). |
Parameters | |
path:Union[ | Undocumented |
Parameters | |
filename:str | Undocumented |
Returns | |
ITemplateLoader | Undocumented |
Raises | |
ValueError | If the template is not an HTML file. |
Lookup a template based on its filename.
Return the custom template if provided, else the default template.
Parameters | |
filename:str | File name, (ie 'index.html') |
Returns | |
Template | The Template object |
Raises | |
KeyError | If no template file is found with the given name |
Undocumented
Parameters | |
template:HtmlTemplate | Undocumented |
current_template:HtmlTemplate | Undocumented |