Change template variable names to be more descriptive

This commit is contained in:
Franciszek Stachura 2024-07-18 12:06:21 +02:00
parent fabbc52d36
commit dbc7191060
6 changed files with 36 additions and 33 deletions

View file

@ -406,20 +406,17 @@ def generate_source_page(q, basedir, parsed_path):
**template_ctx,
'baseurl': '/' + project + '/',
'tag': tag,
'version': version,
'url': url,
'project': project,
'projects': get_directories(basedir),
'ident': '',
'family': 'A',
'current_project': project,
'current_tag': tag,
'current_tag_urlencoded': version,
'breadcrumb_links': breadcrumb_links,
'title': title,
'versions': q.query('versions'),
'url': url,
'current_tag': tag,
'projects': get_directories(basedir),
}
return (status, template.render(data))
@ -496,19 +493,19 @@ def generate_ident_page(q, basedir, parsed_path):
data = {
'baseurl': '/' + project + '/',
'tag': tag,
'version': version,
'url': url,
'project': project,
'projects': get_directories(basedir),
'current_project': project,
'current_tag': tag,
'current_tag_urlencoded': version,
'ident': ident,
'family': family,
'title': ident+' identifier - '+title_suffix,
'projects': get_directories(basedir),
'versions': q.query('versions'),
'url': url,
'current_tag': tag,
'symbol_sections': symbol_sections,
}

View file

@ -12,7 +12,7 @@
<ul>
{% for symbol in symbols %}
<li>
<a href="{{ version }}/source/{{ symbol.path }}#L{{ symbol.line[0] }}">
<a href="{{ current_tag_urlencoded }}/source/{{ symbol.path }}#L{{ symbol.line[0] }}">
<strong>{{ symbol.path }}</strong>
{%- if symbol.line|length == 1 %},
line {{ symbol.line[0] }}
@ -26,7 +26,7 @@
{% if symbol.line|length > 1 and symbols|length <= 100 %}
<ul>
{% for l in symbol.line %}
<li><a href="{{ version }}/source/{{ symbol.path }}#L{{ l }}">line {{ l }}</a>
<li><a href="{{ current_tag_urlencoded }}/source/{{ symbol.path }}#L{{ l }}">line {{ l }}</a>
{% endfor %}
</ul>
{% endif %}

View file

@ -31,13 +31,19 @@
{% include "sidebar.html" %}
</main>
<footer class="footer">
<span class="version"><a href="{{ version }}/source">{{ project }}</a> <em class="icon-tag">{{ tag }}</em></span>
<a title="Go to top of the page" class="go-top icon-up screenreader" href="{{ version }}/{{ url }}#">Top</a>
<span class="version">
<a href="{{ current_tag_urlencoded }}/source">{{ current_project }}</a>
<em class="icon-tag">{{ current_tag }}</em>
</span>
<a title="Go to top of the page" class="go-top icon-up screenreader"
href="{{ current_tag_urlencoded }}/{{ url }}#">
Top
</a>
<span class="poweredby">powered by <a target="_blank" href="https://github.com/bootlin/elixir">Elixir 2.2</a></span>
</footer>
</div>
<script src="/script.js?v=3"></script>
<script src="/dynamic-references.js?v=3"></script>
<script src="/autocomplete.js" project="{{ project }}"></script>
<script src="/autocomplete.js" project="{{ current_project }}"></script>
</body>
</html>

View file

@ -1,14 +1,14 @@
<aside class="sidebar" id="menu">
<select class="select-projects" onchange="window.location.href=this.value">
{%- for p in projects %}
<option {% if p == project -%} selected {%- endif %} value="/{{p}}/latest/source">{{ p }}</option>
<option {% if p == current_project -%} selected {%- endif %} value="/{{p}}/latest/source">{{ p }}</option>
{%- endfor %}
</select>
<nav>
<h3 class="screenreader">Projects</h3>
<ul class="projects">
{%- for p in projects %}
<li {%- if p == project %} class="active" {% endif -%}><a href="/{{p}}/latest/source">{{ p }}</a></li>
<li {%- if p == current_project %} class="active" {% endif -%}><a href="/{{p}}/latest/source">{{ p }}</a></li>
{%- endfor %}
</ul>

View file

@ -1,23 +1,23 @@
<header class="topbar">
<div class="breadcrumb">
<a href="{{ version }}/{{ url }}#menu" class="open-menu icon-menu screenreader" title="Open Menu">Open Menu</a>
<a class="project" href="{{ version }}/source">/</a>
<a href="{{ current_tag_urlencoded }}/{{ url }}#menu" class="open-menu icon-menu screenreader" title="Open Menu">Open Menu</a>
<a class="project" href="{{ current_tag_urlencoded }}/source">/</a>
{% for name, url in breadcrumb_links %}
<a href="{{ url }}">{{ name }}</a>
{{ '/' if not loop.last else '' }}
{% endfor %}
</div>
<div class="search">
<form method="post" action="{{ version }}/ident">
<form method="post" action="{{ current_tag_urlencoded }}/ident">
<select name="f" title="Restricts search to specific file families">
<option value="A" {% if family=="A" %} selected="selected"{% endif %}>All symbols</option>
<option value="C" {% if family=="C" %} selected="selected"{% endif %}>C/CPP/ASM</option>
<option value="K" {% if family=="K" %} selected="selected"{% endif %}>Kconfig</option>
<option value="D" {% if family=="D" %} selected="selected"{% endif %}>Devicetree</option>
<option value="B" {% if family=="B" %} selected="selected"{% endif %}>DT compatible</option>
<option value="A" {{ 'selected' if family == 'A' or family is not defined else '' }}>All symbols</option>
<option value="C" {{ 'selected' if family == 'C' else '' }}>C/CPP/ASM</option>
<option value="K" {{ 'selected' if family == 'K' else '' }}>Kconfig</option>
<option value="D" {{ 'selected' if family == 'D' else '' }}>Devicetree</option>
<option value="B" {{ 'selected' if family == 'B' else '' }}>DT compatible</option>
</select>
<input placeholder="Search Identifier" type="text" id="search-input" name="i" value="{{ ident }}" autofocus/>
<input placeholder="Search Identifier" type="text" id="search-input" name="i" value="{{ ident|default('') }}" autofocus/>
<button class="icon-search"><span class="screenreader">Go get it</span></button>
</form>
</div>

View file

@ -7,14 +7,14 @@
<tbody>
{% if current_path != '' %}
<tr>
<td><a class="tree-icon icon-back" href="{{- version -}}/source{{- back_path -}}">Parent directory</a></td>
<td><a class="tree-icon icon-back" href="{{- current_tag_urlencoded -}}/source{{- back_path -}}">Parent directory</a></td>
</tr>
{% endif %}
{% for type, name, path, size in dir_entries %}
<tr>
<td>
<a class="tree-icon icon-{{- type if type != 'symlink' else 'blob' -}}"
href="{{- version -}}/source{{- path -}}">
href="{{- current_tag_urlencoded -}}/source{{- path -}}">
{% if type == 'symlink' %}
{{ name }} -> {{ path }}
{% else %}
@ -22,7 +22,7 @@
{% endif %}
</a>
</td>
<td><a tabindex="-1" class="size" href="{{- version -}}/source{{- path -}}">{{ size }} bytes</a></td>
<td><a tabindex="-1" class="size" href="{{- current_tag_urlencoded -}}/source{{- path -}}">{{ size }} bytes</a></td>
</tr>
{% endfor %}
</tbody>