Skip to content

Commit 8a738d7

Browse files
authored
Merge pull request #148 from QuLogic/template-cleanup
Cleanup parts of the template
2 parents 1e635ff + 91b5df1 commit 8a738d7

File tree

2 files changed

+29
-31
lines changed

2 files changed

+29
-31
lines changed

python/build.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@
121121

122122
if 'site' in package['badges']:
123123
if 'site' not in package:
124-
package['site'] = '{}.org'.format(package['repo_name'])
125-
package['site_protocol'] = 'https'
124+
package['site'] = f'https://{package["repo_name"]}.org'
126125
else:
127-
package['site_protocol'], package['site'] = package['site'].rstrip('/').split('://')
126+
package['site'] = package['site'].rstrip('/')
128127

129-
template = Template((here / 'template.rst').read_text())
128+
template = Template((here / 'template.rst').read_text(),
129+
lstrip_blocks=True, trim_blocks=True)
130130

131131
config = sorted(config, key = lambda i: i['name'])
132132

python/template.rst

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
.. raw:: html
22

33
<div>
4-
<table id="packages">
5-
{% for section in config %}
6-
<tr>
7-
<th colspan=5>
8-
{% with section_id = section.name | lower | replace(" ", "-") %}
9-
<h3 id="{{ section_id }}">
10-
{{ section.name }}
11-
<a class="headerlink" href="#{{ section_id }}" title="Permalink to this headline">#</a>
12-
</h3>
13-
{% endwith %}
14-
</th>
15-
</tr>
4+
<table id="packages">
5+
{% for section in config %}
6+
<tr>
7+
<th colspan=5>
8+
{% with section_id = section.name | lower | replace(" ", "-") %}
9+
<h3 id="{{ section_id }}">
10+
{{ section.name }}
11+
<a class="headerlink" href="#{{ section_id }}" title="Permalink to this headline">#</a>
12+
</h3>
13+
{% endwith %}
14+
</th>
15+
</tr>
1616

1717
{% for package in section.packages %}
1818
<tr>
19-
2019
<td>
2120
<a href="https://github.com/{{ package.repo }}">
2221
<img src="_static/badges/github-gray.svg">
@@ -36,22 +35,21 @@
3635
<img src="_static/badges/conda-blue.svg">
3736
</a>
3837
{% endif %}
39-
</td>
38+
</td>
4039

41-
<td>
42-
{% if 'site' in package.badges %}
43-
<a href="{{ package.site_protocol}}://{{ package.site }}">{{ package.name }}</a>
44-
{% else %}
45-
<a href="https://github.com/{{ package.repo }}">{{ package.name }}</a>
46-
{% endif %}
47-
</td>
48-
<td>
49-
{{ package.description }}
50-
</td>
51-
40+
<td>
41+
{% if 'site' in package.badges %}
42+
<a href="{{ package.site }}">{{ package.name }}</a>
43+
{% else %}
44+
<a href="https://github.com/{{ package.repo }}">{{ package.name }}</a>
45+
{% endif %}
46+
</td>
47+
<td>
48+
{{ package.description }}
49+
</td>
5250

5351
</tr>
5452
{% endfor %}
55-
{% endfor %}
53+
{% endfor %}
5654
</table>
57-
</div>
55+
</div>

0 commit comments

Comments
 (0)