add SERIES_TITLE template variable

Add a variable to hold the title of the series for a given
template. This is set to the name, regardless of whether the series is
the "latest" or not.

Change-Id: I3ca9b19b9e46478107f4c689f85772f15863557a
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Andreas Jaeger 2017-07-21 21:37:00 +02:00 committed by Doug Hellmann
parent f77fb23c63
commit e852bb5626
10 changed files with 22 additions and 19 deletions

View File

@ -311,10 +311,12 @@ def render_template(environment, project_data, regular_repos, infra_repos,
series_match = SERIES_PAT.match(template_file) series_match = SERIES_PAT.match(template_file)
if series_match: if series_match:
series = series_match.groups()[0] series = series_match.groups()[0]
series_title = series.title()
if series == SERIES_IN_DEVELOPMENT: if series == SERIES_IN_DEVELOPMENT:
series = 'latest' series = 'latest'
else: else:
series = None series = None
series_title = ''
logger.info('series = %s', series) logger.info('series = %s', series)
try: try:
@ -339,6 +341,7 @@ def render_template(environment, project_data, regular_repos, infra_repos,
CSSDIR=cssdir, CSSDIR=cssdir,
IMAGEDIR=imagedir, IMAGEDIR=imagedir,
SERIES=series, SERIES=series,
SERIES_TITLE=series_title,
**extra **extra
) )
if template_file.endswith('.html'): if template_file.endswith('.html'):

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Administrator Guides{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Administrator Guides{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org/">Documentation</a> &gt; Administrator Guides <a href="https://docs.openstack.org/">Documentation</a> &gt; Administrator Guides
{% endblock %} {% endblock %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} Administrator Guides</h1> <h1>OpenStack {{SERIES_TITLE}} Administrator Guides</h1>
<p> <p>
This page contains documentation about administering OpenStack services. This page contains documentation about administering OpenStack services.
</p> </p>

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}API references{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} API references{% endblock %}
{% block title %}API references{% endblock %} {% block title %}API references{% endblock %}
{% block header %} {% block header %}
{% endblock header %} {% endblock header %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} API Reference Documentation</h1> <h1>OpenStack {{SERIES_TITLE}} API Reference Documentation</h1>
<p> <p>
This page contains documentation about the OpenStack API and how to use it. This page contains documentation about the OpenStack API and how to use it.
</p> </p>

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Configuration Guides{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Configuration Guides{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org/">Documentation</a> &gt; Configuration Guides <a href="https://docs.openstack.org/">Documentation</a> &gt; Configuration Guides
{% endblock %} {% endblock %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} Configuration Guides</h1> <h1>OpenStack {{SERIES_TITLE}} Configuration Guides</h1>
<p> <p>
This page contains documentation about configuring OpenStack services. This page contains documentation about configuring OpenStack services.
</p> </p>

View File

@ -1,7 +1,7 @@
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Draft Deployment Guides{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Deployment Guides{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org">Documentation</a> &gt; Draft Deployment Guides <a href="https://docs.openstack.org">Documentation</a> &gt; {{SERIES_TITLE}} Deployment Guides
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Begin Page Content --> <!-- Begin Page Content -->
@ -9,7 +9,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if series != 'latest' %}{{series|title}}{% endif %} Deployment Guides</h1> <h1>OpenStack {{SERIES_TITLE}} Deployment Guides</h1>
<p>The following deployment guides support different installation <p>The following deployment guides support different installation
methods for core and optional OpenStack services.</p> methods for core and optional OpenStack services.</p>
<p>This is documentation in progress for the next release.</p> <p>This is documentation in progress for the next release.</p>

View File

@ -1,5 +1,5 @@
{% extends "templates/indexbase.tmpl" %} {% extends "templates/indexbase.tmpl" %}
{% block pagetitle %}Pike{% endblock %} {% block pagetitle %}{{SERIES_TITLE}}{% endblock %}
{% block title %}{% endblock %} {% block title %}{% endblock %}
{% block header %} {% block header %}
{% endblock header %} {% endblock header %}

View File

@ -1,8 +1,8 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Draft Installation Tutorials and Guides{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Installation Tutorials and Guides{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org">Documentation</a> &gt; Draft Installation Tutorials and Guides <a href="https://docs.openstack.org">Documentation</a> &gt; {{SERIES_TITLE}} Installation Tutorials and Guides
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Begin Page Content --> <!-- Begin Page Content -->
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} Installation Tutorials and Guides</h1> <h1>OpenStack {{SERIES_TITLE}} Installation Tutorials and Guides</h1>
<p> <p>
These documents cover installation procedures for OpenStack These documents cover installation procedures for OpenStack
services. services.

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Language bindings{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Language bindings{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org/">Documentation</a> &gt; Language Bindings and Python Clients <a href="https://docs.openstack.org/">Documentation</a> &gt; Language Bindings and Python Clients
{% endblock %} {% endblock %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} API Bindings</h1> <h1>OpenStack {{SERIES_TITLE}} API Bindings</h1>
<p> <p>
This page contains documentation about the Python This page contains documentation about the Python
bindings provided by OpenStack and how to use them. bindings provided by OpenStack and how to use them.

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}Services and Libraries{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} Services and Libraries{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org">Documentation</a> &gt; Services and Libraries <a href="https://docs.openstack.org">Documentation</a> &gt; Services and Libraries
{% endblock %} {% endblock %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} Projects</h1> <h1>OpenStack {{SERIES_TITLE}} Projects</h1>
<p> <p>
This page contains project-specific documentation for This page contains project-specific documentation for
OpenStack services and libraries. OpenStack services and libraries.

View File

@ -1,6 +1,6 @@
{% set projects = PROJECT_DATA[SERIES] %} {% set projects = PROJECT_DATA[SERIES] %}
{% extends "templates/base.tmpl" %} {% extends "templates/base.tmpl" %}
{% block pagetitle %}User Guides{% endblock %} {% block pagetitle %}{{SERIES_TITLE}} User Guides{% endblock %}
{% block title %} {% block title %}
<a href="https://docs.openstack.org">Documentation</a> &gt; User Guides <a href="https://docs.openstack.org">Documentation</a> &gt; User Guides
{% endblock %} {% endblock %}
@ -10,7 +10,7 @@
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-lg-8 col-md-8 col-sm-8"> <div class="col-lg-8 col-md-8 col-sm-8">
<h1>OpenStack {% if SERIES != 'latest' %}{{SERIES|title}}{% endif %} Project User Guides</h1> <h1>OpenStack {{SERIES_TITLE}} Project User Guides</h1>
<p> <p>
This page contains project-specific documentation for This page contains project-specific documentation for
using OpenStack services and libraries. using OpenStack services and libraries.