Browse Source

Dynamic setting of header markup

As the top level header in index.rst and get_started.rst depends on
cookiecutter.service the length of the header markups should also
depend on the length of cookiecutter.service.

Unfortunatelly I was not able to figure out how to include the macro
from a different template, so there is a copy-paste there.

Change-Id: Iff2255f10690f23de270b84c1bd0cd7de3c611a3
Signed-off-by: csatari <gergely.csatari@nokia.com>
changes/28/437228/2
csatari 6 years ago
parent
commit
7bdd14ad52
  1. 14
      {{cookiecutter.directory_name}}/source/get_started.rst
  2. 13
      {{cookiecutter.directory_name}}/source/index.rst

14
{{cookiecutter.directory_name}}/source/get_started.rst

@ -1,7 +1,13 @@
=========================
{{cookiecutter.service}} service overview
=========================
{%- macro set_header_markup(header_text_length) -%}
{%- set servicelength = cookiecutter.service|length -%}
{%- for _ in range(0, servicelength + header_text_length) -%}={%- endfor -%}
{%- endmacro -%}
{%- macro set_header(header_text) -%}
{{ set_header_markup(header_text|length) }}
{{cookiecutter.service}}{{header_text}}
{{ set_header_markup(header_text|length) }}
{%- endmacro -%}
{{ set_header(" service overview") }}
The {{cookiecutter.service}} service provides...
The {{cookiecutter.service}} service consists of the following components:

13
{{cookiecutter.directory_name}}/source/index.rst

@ -1,6 +1,13 @@
=====================
{{cookiecutter.service}} service
=====================
{%- macro set_header_markup(header_text_length) -%}
{%- set servicelength = cookiecutter.service|length -%}
{%- for _ in range(0, servicelength + header_text_length) -%}={%- endfor -%}
{%- endmacro -%}
{%- macro set_header(header_text) -%}
{{ set_header_markup(header_text|length) }}
{{cookiecutter.service}}{{header_text}}
{{ set_header_markup(header_text|length) }}
{%- endmacro -%}
{{ set_header(" service") }}
.. toctree::
:maxdepth: 2

Loading…
Cancel
Save