Skip to content

Commit

Permalink
More use of relurl in jinja templates
Browse files Browse the repository at this point in the history
  • Loading branch information
ZedThree committed Jan 4, 2024
1 parent 79ece3a commit 2a63af3
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 40 deletions.
2 changes: 1 addition & 1 deletion ford/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<div id="navbar" class="navbar-collapse collapse">
<ul class="navbar-nav">
{% if pages %}
<li class="nav-item"><a class="nav-link" href="{{ pages.url }}">{{ pages.title }}</a></li>
<li class="nav-item"><a class="nav-link" href="{{ pages.url | relurl(page_url) }}">{{ pages.title }}</a></li>
{% endif %}
{% if incl_src %}
{% if (project.files|length + project.extra_files|length) is more_than_one %}
Expand Down
8 changes: 4 additions & 4 deletions ford/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ <h4 class="card-text">{{ author }}</h4>
<h3>Source Files</h3>
<ul>
{%- for src in (project.allfiles|sort(attribute='name'))[:max_length] -%}
<li>{{ src }}</li>
<li>{{ src | relurl(page_url) }}</li>
{%- endfor -%}
</ul>
</div>
Expand All @@ -111,7 +111,7 @@ <h3>Source Files</h3>
<h3>Modules</h3>
<ul>
{%- for mod in (project.modules|sort(attribute='name'))[:max_length] -%}
<li>{{ mod }}</li>
<li>{{ mod | relurl(page_url) }}</li>
{%- endfor -%}
</ul>
</div>
Expand All @@ -128,7 +128,7 @@ <h3>Modules</h3>
<h3>Procedures</h3>
<ul>
{%- for proc in (project.procedures|sort(attribute='name'))[:max_length] -%}
<li>{{ proc }}</li>
<li>{{ proc | relurl(page_url) }}</li>
{%- endfor -%}
</ul>
</div>
Expand All @@ -145,7 +145,7 @@ <h3>Procedures</h3>
<h3>Derived Types</h3>
<ul>
{%- for dtype in (project.types|sort(attribute='name'))[:max_length] -%}
<li>{{ dtype }}</li>
<li>{{ dtype | relurl(page_url) }}</li>
{%- endfor -%}
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion ford/templates/info_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h1>{{ page.title }}</h1>
<nav aria-label="breadcrumb">
<ol class="breadcrumb justify-content-end mb-0">
{% for item in page.hierarchy %}
<li class="breadcrumb-item">{{ item }}</li>
<li class="breadcrumb-item">{{ item | relurl(page_url) }}</li>
{% endfor %}
<li class="breadcrumb-item active" aria-current="page">{{ page.title }}</li>
</ol>
Expand Down
34 changes: 17 additions & 17 deletions ford/templates/macros.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
<ol class="breadcrumb justify-content-end mb-0">
{% if incl_src %}
{% for item in entity.hierarchy %}
<li class="breadcrumb-item">{{ item }}</li>
<li class="breadcrumb-item">{{ item | relurl(page_url) }}</li>
{% endfor %}
{% else %}
{% for item in entity.hierarchy[1:] %}
<li class="breadcrumb-item">{{ item }}</li>
<li class="breadcrumb-item">{{ item | relurl(page_url) }}</li>
{% endfor %}
{%endif%}
<li class="breadcrumb-item active" aria-current="page">{{ entity.name }}</li>
Expand Down Expand Up @@ -193,7 +193,7 @@ <h3>Contents</h3>
{% if var.obj == 'variable' %}
<td>
<span class="anchor" {% if id %}id="{{ var.anchor }}"{% endif %}></span>
{{ var.full_type }}{{ add_comma((intent and var.intent) or var.optional or permission or var.parameter or var.attribs) }}
{{ var.full_type | relurl(page_url) }}{{ add_comma((intent and var.intent) or var.optional or permission or var.parameter or var.attribs) }}
</td>
{% if intent -%}
<td>
Expand Down Expand Up @@ -286,7 +286,7 @@ <h3>Contents</h3>
{% if proc.retvar %}
{{ header(4, small) }}
Return Value
<small>{{ proc.retvar.full_declaration }}</small>
<small>{{ proc.retvar.full_declaration | relurl(page_url) }}</small>
{{ close_header(4, small) }}
{{ docstring(proc.retvar, full_docstring) }}
{% endif %}
Expand Down Expand Up @@ -317,7 +317,7 @@ <h3>Contents</h3>
{% if proc.retvar %}
{{ header(4, small) }}
Return Value
<small>{{ proc.retvar.full_declaration }}</small>
<small>{{ proc.retvar.full_declaration | relurl(page_url) }}</small>
{{ close_header(4, small) }}
{{ proc.retvar.doc }}
{% endif %}
Expand All @@ -326,8 +326,8 @@ <h3>Contents</h3>

{% macro bound_declaration(tb, link_name=False) %}
{# Type-bound procedure declaration and bindings #}
{{ tb.full_declaration }} ::
<strong>{% if link_name %}{{ tb }}{% else %}{{ tb.name }}{% endif %}</strong>
{{ tb.full_declaration | relurl(page_url) }} ::
<strong>{% if link_name %}{{ tb | relurl(page_url) }}{% else %}{{ tb.name }}{% endif %}</strong>
{%- if tb.generic or (tb.name != tb.bindings[0].name and tb.name != tb.bindings[0]) %} => {{ tb.bindings | join(", ") }}{% endif %}
{% if tb.binding|length == 1 %}<small>{{ tb.bindings[0].proctype }}</small>{% endif %}
{% endmacro %}
Expand Down Expand Up @@ -394,7 +394,7 @@ <h3>interface {{ deprecated(bind) }}</h3>
<span class="anchor" id="{{ intr.anchor }}"></span>
<h3>{% if intr.parobj == 'module' and intr.generic %}{{ intr.permission }}{% endif %}
interface
{%- if intr.generic %} {{ intr }} {% endif -%}
{%- if intr.generic %} {{ intr | relurl(page_url) }} {% endif -%}
{{ deprecated(intr) }}
</h3>
</div>
Expand Down Expand Up @@ -503,7 +503,7 @@ <h3>
{%- if dtype.sequence %}, sequence {% endif -%}
{{ dtype.attribs | join(", ") }}
{%- if dtype.extends %}, extends({{ dtype.extends | relurl(page_url) }}){% endif -%}&nbsp;::&nbsp;
{{ dtype }}
{{ dtype | relurl(page_url) }}
{{ deprecated(dtype) }}
</h3>
</div>
Expand Down Expand Up @@ -570,7 +570,7 @@ <h4>Type-Bound Procedures</h4>
{% for tb in dtype.boundprocs %}
<tr>
<td>{{ bound_declaration(tb, link_name=True) }}</td>
<td>{{ tb | meta('summary') }}</td>
<td>{{ tb | meta('summary') | relurl(page_url) }}</td>
</tr>
{% endfor %}
</tbody>
Expand Down Expand Up @@ -655,7 +655,7 @@ <h4>Description</h4>
<div class="card">
<div class="card-header codesum">
<span class="anchor" id="{{ namelist.anchor }}"></span>
<h3>Namelist {{ namelist }}</h3>
<h3>Namelist {{ namelist | relurl(page_url) }}</h3>
</div>
<div class="card-body">
{{ namelist_summary(namelist, False) }}
Expand Down Expand Up @@ -697,7 +697,7 @@ <h2>Variables</h2>
{% else %}
<tr id="{{ variable.anchor }}">
<td><a href="#{{ variable.anchor }}">{{ variable.name }}</a></td>
<td>{{ variable.full_type }}</td>
<td>{{ variable.full_type | relurl(page_url) }}</td>
<td>{{ variable.initial | e }}</td>
<td>{{ docstring(variable, full_docstring) }}</td>
</tr>
Expand All @@ -714,7 +714,7 @@ <h3 class="card-header card-title bg-light">Uses</h3>
<li class="list-group-item">
<ul class="list-inline">
{% for use in obj.uses %}
<li class="list-inline-item">{{ use }}</li>
<li class="list-inline-item">{{ use | relurl(page_url) }}</li>
{% endfor %}
</ul>
</li>
Expand All @@ -723,8 +723,8 @@ <h3 class="card-header card-title bg-light">Uses</h3>
<li class="list-group-item">
<ul class="list-inline">
<li><h5>Ancestors:</h5></li>
{% for anc in obj.ancestry %}
<li class="list-inline-item">{{ anc }}</li>
{% for ancestor in obj.ancestry %}
<li class="list-inline-item">{{ ancestor | relurl(page_url) }}</li>
{% if not loop.last -%}<li>:</li>{%- endif %}
{% endfor %}
</ul>
Expand Down Expand Up @@ -752,8 +752,8 @@ <h3 class="card-header card-title bg-light">Used by</h3>
<li class="list-group-item">
<ul class="list-inline">
<li class="list-inline-item"><h5>Descendants:</h5></li>
{% for anc in obj.descendants %}
<li class="list-inline-item">{{ anc }}</li>
{% for ancestor in obj.descendants %}
<li class="list-inline-item">{{ ancestor | relurl(page_url) }}</li>
{% endfor %}
</ul>
</li>
Expand Down
4 changes: 2 additions & 2 deletions ford/templates/proc_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ <h2>{{ macros.proc_line(procedure,False) }}</h2>

{% if procedure.binding %}
<h3>Type Bound</h3>
<p>{{ procedure.binding.parent }}</p>
<p>{{ procedure.binding.parent | relurl(page_url) }}</p>
{% endif %}

<h3>Arguments</h3>
Expand All @@ -42,7 +42,7 @@ <h3>Arguments</h3>
<h3>Return Value
<small>
<span class="anchor" id="{{ procedure.retvar.anchor }}"></span>
{{ procedure.retvar.full_declaration }}
{{ procedure.retvar.full_declaration | relurl(page_url) }}
</small>
</h3>
{{ procedure.retvar.doc }}
Expand Down
36 changes: 21 additions & 15 deletions ford/templates/type_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,34 @@ <h1>{{ dtype.name }}
</div>

<div class="col-md-9" id='text'>
<h2>type{% if dtype.parobj == 'module' %}, {{ dtype.permission }}{% endif %}{% for attr in dtype.attributes%}, {{ attr }}{% endfor %}{% if dtype.extends %}, extends({{ dtype.extends }}){% endif %} :: {{ dtype.name }}{% if dtype.sequence%}<br>sequence{% endif %}</h2>
<h2>
type
{%- if dtype.parobj == 'module' %}, {{ dtype.permission }}{% endif -%}
{{ dtype.attribs | join(", ") }}
{%- if dtype.extends %}, extends({{ dtype.extends | relurl(page_url) }}){% endif %} :: {{ dtype.name }}
{%- if dtype.sequence%}<br>sequence{% endif -%}
</h2>
{{ dtype.doc }}
{% if dtype.inherbygraph or dtype.inhergraph %}<br>{% endif %}
{% if dtype.inhergraph %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Inherits</h3>
<div class="card">
<div class="card-header">
<h3 class="card-title">Inherits</h3>
</div>
<div class="card-body">
{{ dtype.inhergraph }}
</div>
</div>
<div class="card-body">
{{ dtype.inhergraph }}
</div>
</div>
{% endif %}
{% if dtype.inherbygraph %}
<div class="card">
<div class="card-header">
<h3 class="card-title">Inherited by</h3>
<div class="card">
<div class="card-header">
<h3 class="card-title">Inherited by</h3>
</div>
<div class="card-body">
{{ dtype.inherbygraph }}
</div>
</div>
<div class="card-body">
{{ dtype.inherbygraph }}
</div>
</div>
{% endif %}
<br>

Expand Down

0 comments on commit 2a63af3

Please sign in to comment.