Web Templates

Problem

There isn’t a standardized base template that the authors(s) of websites and the author(s) of extentions for a given web framework can collectively reference. The website author specifies the base template for their website per their requirements, populating it with the components provided by framework extentions. The authors of framework extentions can not know the final structure of the base template for a given website and must assume which block such templates might provide.

graph RL A[extention/base.html] -->|?| B[base.html]

Objective

The package is to provide a standard structure/methodology for both the website and extention author(s) of the respective frameworks.

Scope

Web-Templates focuses primarily upon the Python web frameworks relying upon templating mechanism

Proposal

A skeleton template that both the authors of websites and of framework extentions can reference for their chosen framework. This has the following benefits :

  • The webiste author(s) using these frameworks, and their extention packages, can customize their base template, that extends the skeleton template, against a standardized set of guidelines.
  • The extention author(s) of these frameworks can, reasonably, presume the existance of a standardized base template.
graph RL A[extention/base.html] --> B[base.html] B --> C[skeleton.html] A --> C

Solution

Web-Templates provides a skeleton with the minimal structure necessary to produce a standardized scaffold for the HTML documents for use with Python’s respective Web Frameworks (Django/Tornado/Flask/etc.). The “ideal” skeleton should produce the following scaffold after being passed through ones template engine [1] :

Ideal skeleton and resulting scaffold.
Skeleton Scaffold
{% block html dtd %}
<!DOCTYPE html>
{% endblock dtd %}
{% block html %}
<html>
  {% block head %}
  <head>
  </head>
  {% endblock head %}
  {% block body %}
  <body>
  </body>
  {% endblock body %}
</html>
{% endblock html %}
<!DOCTYPE html>
<html>
    <head></head>
    <body></body>
</html>

Organization

The documentation is partitioned into sections that are pertinent to the package users or website authors, third parties providing framework extentions and package contributors.

Setup describes the installation and removal of Web-Templates. Then following section(s), each dedicated respectively to a framework, details the configuration and usage of Web-Templates within ones project(s). Each section prescribes a standardized base template, where possible, and details the underlying skeleton that it extends.

Third parties incorporating Web-Templates into their projects should read the extentions section along with the section relevant to the framework(s) they support. The rational, nomenclature and structure of the skeleton is described in Template.

Finally the package design is described and how one might constribute.

Note

This package only supports Python 3.4 and onwards as it relies upon name-spaced packages (See PEP 420 and Name Spaced Packages).

footnotes

[1]The package actually extends this “ideal” skeleton to provide a template with a more practical alternative.

Indices and tables