[pluginlist-update] Updated templates to final version with many updates, made project-data plugin more robust, tweaked some css and ran webpack again.

This commit is contained in:
Joseph Nix 2018-05-07 15:18:41 -05:00
parent 064d3764bb
commit af90510192
6 changed files with 88 additions and 72 deletions

File diff suppressed because one or more lines are too long

View File

@ -52,9 +52,19 @@ class ProjectDataPlugin(Plugin):
resp = requests.get(url)
pkg = resp.json()
self.data.update(pkg['info'])
# rewrite description as rendered description
# Erase bad keys that are sometimes returned from the api
# to handle it in the template.
# To us, unknown is the same as non-existent.
for key in self.data:
val = self.data.get(key)
if type(val) is str and val.strip() == 'UNKNOWN':
self.data[key] = ''
self.data['short_name'] = name.split('lektor-')[1]
# Rewrite description as rendered description.
self.data['description'] = self.render(
self.data['description'], self.data['description_content_type'])
if not self.data.get('home_page'):
self.data['home_page'] = 'https://pypi.org/project/{}/'.format(name)
def github_data(self, owner=None, repo=None):
url = 'https://api.github.com/repos/{}/{}'.format(owner, repo)

View File

@ -9,7 +9,7 @@
{% macro render_plugin_list(category) %}
<ul>
{% for plugin in category.children.order_by('-official', 'title') %}
{% for plugin in category.children.order_by('-official', 'name') %}
{% set pd = project_data(plugin.name) %}
{% if plugin.summary %}
{% set summary = plugin.summary %}
@ -18,14 +18,14 @@
{% endif %}
{% if plugin.official %}
<li><a href="{{ plugin|url }}">* {{ plugin.name }}</a>: {{ summary }}</li>
<li><a href="{{ plugin|url }}">* {{ pd.short_name }}</a>: {{ summary }}</li>
{% if loop.nextitem %}
{% if not loop.nextitem.official %}
---
{% endif %}
{% endif %}
{% else %}
<li><a href="{{ plugin|url }}">{{ plugin.name }}</a>: {{ summary }}</li>
<li><a href="{{ plugin|url }}">{{ pd.short_name }}</a>: {{ summary }}</li>
{% endif %}
{% endfor %}
</ul>

View File

@ -9,80 +9,82 @@
{% endif %}
<!-- Place this tag in your head or just before your close body tag. -->
{# <script async defer src="https://buttons.github.io/buttons.js"></script>#}
<div class="row">
<div class="col-sm-12">
<h1>Plugin &ndash; {{ pd.name }} {{ pd.version }}</h1>
{# <script async defer src="https://buttons.github.io/buttons.js"></script>#}
<div class="plugin">
<div class="row">
<div class="col-sm-12">
<h1>Plugin &ndash; {{ pd.name }} {{ pd.version }}</h1>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-11">
<p>{{ summary }}<p>
<div class="row">
<div class="col-sm-1"></div>
<div class="col-sm-11">
<p>{{ summary }}<p>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-3 plugin-margin">
<h4>Project links</h4>
<ul class="tree-nav">
<li><a href="{{ pd.home_page }}">Homepage</a></li>
</ul>
{% if 'github' in pd.home_page %}
<div class="separator">
<h4>GitHub Statistics</h4>
</div>
<ul class="button-nav">
<li><p><a class="github-button" href="{{ pd.home_page }}" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star {{ this.name }} on GitHub">Star</a></p></li>
<li><p><a class="github-button" href="{{ pd.home_page }}/fork" data-icon="octicon-repo-forked" data-show-count="true" data-size="large" data-show="true" aria-label="Open Issues">Fork</a></p></li>
<li><p><a class="github-button" href="{{ pd.home_page }}/issues" data-icon="octicon-issue-opened" data-show-count="true" data-size="large" data-show="true" aria-label="Open Issues">Open Issues</a></p></li>
<div class="row">
<div class="col-sm-3 plugin-margin">
<h4>Project links</h4>
<ul class="tree-nav">
<li><a href="{{ pd.home_page }}" class="ext">Homepage</a></li>
</ul>
{% endif %}
<div class="separator">
<h4>Meta</h4>
</div>
<p><strong>Version:</strong> {{ pd.version }}</p>
<p><strong>Author:</strong>
{% if pd.author_email %}
<a href = "mailto:{{ pd.author_email }}">{{ pd.author }}</a>
{% else %}
{{ pd.author }}
{% if 'github' in pd.home_page %}
<div class="separator">
<h4>GitHub Statistics</h4>
</div>
<ul class="button-nav">
<li><p><a class="github-button" href="{{ pd.home_page }}" data-icon="octicon-star" data-size="large" data-show-count="true" aria-label="Star {{ this.name }} on GitHub" target="_blank">Star</a></p></li>
<li><p><a class="github-button" href="{{ pd.home_page }}/fork" data-icon="octicon-repo-forked" data-show-count="true" data-size="large" data-show="true" aria-label="Open Issues" target="_blank">Fork</a></p></li>
<li><p><a class="github-button" href="{{ pd.home_page }}/issues" data-icon="octicon-issue-opened" data-show-count="true" data-size="large" data-show="true" aria-label="Open Issues" target="_blank">Open Issues</a></p></li>
</ul>
{% endif %}
</p>
<div class="separator">
<h4>Meta</h4>
</div>
<p><strong>Version:</strong> {{ pd.version }}</p>
<p><strong>Author:</strong>
{% if pd.author_email %}
<a href = "mailto:{{ pd.author_email }}">{{ pd.author }}</a>
{% else %}
{{ pd.author }}
{% endif %}
</p>
<div class="separator">
<h4>Tags</h4>
<div class="separator">
<h4>Tags</h4>
</div>
{% if this.tags %}
{% for t in this.tags|sort %}
{{ "and " if (loop.last and this.tags|length > 1) }}
<a href="{{ ('/plugins/tag/' ~ t.lower() ~ '/')|url }}">{{ t }}</a>{{ ", " if not loop.last }}
{% endfor %}
{% else %}
<p>Plugin has no tags.</p>
{% endif %}
</div>
{% if this.tags %}
{% for t in this.tags %}
{{ "and " if loop.last }}
<a href="{{ ('/plugins/tag/' ~ t.lower() ~ '/')|url }}">{{ t }}</a>{{ ", " if not loop.last }}
{% endfor %}
{% else %}
<p>Plugin has no tags.</p>
{% endif %}
</div>
<div class="col-sm-9 doc-styling">
<h2>Project Description</h2>
{% if pd.description %}
{{ pd.description|safe }} {# comes out as a text string always #}
{% else %}
<i>Plugin has no long_description</i>
{% endif %}
<div class="col-sm-9 doc-styling">
<h2>Project Description</h2>
{% if pd.description %}
{{ pd.description|safe }} {# comes out as a text string always #}
{% else %}
<i>Plugin has no long_description</i>
{% endif %}
{% if this.allow_comments %}
<div class="comment-box">
<h2>Comments</h2>
{{ render_disqus_comments() }}
{% if this.allow_comments %}
<div class="comment-box">
<h2>Comments</h2>
{{ render_disqus_comments() }}
</div>
{% endif %}
</div>
{% endif %}
</div>
</div>
{% endblock %}

View File

@ -15,8 +15,10 @@
<h1>{{ this.title }}</h1>
{% call render_full_width_blocks(this.body.blocks, classes='col-md-12') %}
{% endcall %}
{% for category in site.query('/plugin-categories') %}
{% for category in site.query('/plugin-categories').order_by('title') %}
<h2><a href="{{ category|url }}">{{ category.title }}</a></h2>
{{ render_plugin_list(category) }}
<div class="plugin">
{{ render_plugin_list(category) }}
</div>
{% endfor %}
{% endblock %}

View File

@ -217,7 +217,7 @@ div.blog-snippet {
}
}
div.doc-styling, div.blog-post {
div.doc-styling, div.blog-post, div.plugin {
line-height: 1.75;
a.ref {
@ -225,6 +225,7 @@ div.doc-styling, div.blog-post {
}
a.ext {
white-space: nowrap;
&:before {
@extend .glyphicon;
@extend .glyphicon-link;
@ -675,12 +676,13 @@ div.plugin-margin {
h4 {
margin: 25px 0;
}
div.separator {
border-top: 1px solid #ddd;
margin: 25px 0;
}
}
div.separator {
border-top: 1px solid #ddd;
margin: 25px 0;
}
div.comment-box {
border-top: 1px solid #ddd;