[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:
parent
064d3764bb
commit
af90510192
File diff suppressed because one or more lines are too long
|
@ -52,9 +52,19 @@ class ProjectDataPlugin(Plugin):
|
||||||
resp = requests.get(url)
|
resp = requests.get(url)
|
||||||
pkg = resp.json()
|
pkg = resp.json()
|
||||||
self.data.update(pkg['info'])
|
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.render(
|
||||||
self.data['description'], self.data['description_content_type'])
|
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):
|
def github_data(self, owner=None, repo=None):
|
||||||
url = 'https://api.github.com/repos/{}/{}'.format(owner, repo)
|
url = 'https://api.github.com/repos/{}/{}'.format(owner, repo)
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
{% macro render_plugin_list(category) %}
|
{% macro render_plugin_list(category) %}
|
||||||
<ul>
|
<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) %}
|
{% set pd = project_data(plugin.name) %}
|
||||||
{% if plugin.summary %}
|
{% if plugin.summary %}
|
||||||
{% set summary = plugin.summary %}
|
{% set summary = plugin.summary %}
|
||||||
|
@ -18,14 +18,14 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if plugin.official %}
|
{% 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 loop.nextitem %}
|
||||||
{% if not loop.nextitem.official %}
|
{% if not loop.nextitem.official %}
|
||||||
---
|
---
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<li><a href="{{ plugin|url }}">{{ plugin.name }}</a>: {{ summary }}</li>
|
<li><a href="{{ plugin|url }}">{{ pd.short_name }}</a>: {{ summary }}</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -9,80 +9,82 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- Place this tag in your head or just before your close body tag. -->
|
<!-- Place this tag in your head or just before your close body tag. -->
|
||||||
{# <script async defer src="https://buttons.github.io/buttons.js"></script>#}
|
{# <script async defer src="https://buttons.github.io/buttons.js"></script>#}
|
||||||
<div class="row">
|
<div class="plugin">
|
||||||
<div class="col-sm-12">
|
<div class="row">
|
||||||
<h1>Plugin – {{ pd.name }} {{ pd.version }}</h1>
|
<div class="col-sm-12">
|
||||||
|
<h1>Plugin – {{ pd.name }} {{ pd.version }}</h1>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-1"></div>
|
<div class="col-sm-1"></div>
|
||||||
<div class="col-sm-11">
|
<div class="col-sm-11">
|
||||||
<p>{{ summary }}<p>
|
<p>{{ summary }}<p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-3 plugin-margin">
|
<div class="col-sm-3 plugin-margin">
|
||||||
<h4>Project links</h4>
|
<h4>Project links</h4>
|
||||||
<ul class="tree-nav">
|
<ul class="tree-nav">
|
||||||
<li><a href="{{ pd.home_page }}">Homepage</a></li>
|
<li><a href="{{ pd.home_page }}" class="ext">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>
|
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<div class="separator">
|
{% if 'github' in pd.home_page %}
|
||||||
<h4>Meta</h4>
|
<div class="separator">
|
||||||
</div>
|
<h4>GitHub Statistics</h4>
|
||||||
<p><strong>Version:</strong> {{ pd.version }}</p>
|
</div>
|
||||||
<p><strong>Author:</strong>
|
<ul class="button-nav">
|
||||||
{% if pd.author_email %}
|
<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>
|
||||||
<a href = "mailto:{{ pd.author_email }}">{{ pd.author }}</a>
|
<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>
|
||||||
{% else %}
|
<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>
|
||||||
{{ pd.author }}
|
</ul>
|
||||||
{% endif %}
|
{% 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">
|
<div class="separator">
|
||||||
<h4>Tags</h4>
|
<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>
|
</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">
|
<div class="col-sm-9 doc-styling">
|
||||||
<h2>Project Description</h2>
|
<h2>Project Description</h2>
|
||||||
{% if pd.description %}
|
{% if pd.description %}
|
||||||
{{ pd.description|safe }} {# comes out as a text string always #}
|
{{ pd.description|safe }} {# comes out as a text string always #}
|
||||||
{% else %}
|
{% else %}
|
||||||
<i>Plugin has no long_description</i>
|
<i>Plugin has no long_description</i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if this.allow_comments %}
|
{% if this.allow_comments %}
|
||||||
<div class="comment-box">
|
<div class="comment-box">
|
||||||
<h2>Comments</h2>
|
<h2>Comments</h2>
|
||||||
{{ render_disqus_comments() }}
|
{{ render_disqus_comments() }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -15,8 +15,10 @@
|
||||||
<h1>{{ this.title }}</h1>
|
<h1>{{ this.title }}</h1>
|
||||||
{% call render_full_width_blocks(this.body.blocks, classes='col-md-12') %}
|
{% call render_full_width_blocks(this.body.blocks, classes='col-md-12') %}
|
||||||
{% endcall %}
|
{% 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>
|
<h2><a href="{{ category|url }}">{{ category.title }}</a></h2>
|
||||||
{{ render_plugin_list(category) }}
|
<div class="plugin">
|
||||||
|
{{ render_plugin_list(category) }}
|
||||||
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -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;
|
line-height: 1.75;
|
||||||
|
|
||||||
a.ref {
|
a.ref {
|
||||||
|
@ -225,6 +225,7 @@ div.doc-styling, div.blog-post {
|
||||||
}
|
}
|
||||||
|
|
||||||
a.ext {
|
a.ext {
|
||||||
|
white-space: nowrap;
|
||||||
&:before {
|
&:before {
|
||||||
@extend .glyphicon;
|
@extend .glyphicon;
|
||||||
@extend .glyphicon-link;
|
@extend .glyphicon-link;
|
||||||
|
@ -675,12 +676,13 @@ div.plugin-margin {
|
||||||
h4 {
|
h4 {
|
||||||
margin: 25px 0;
|
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 {
|
div.comment-box {
|
||||||
border-top: 1px solid #ddd;
|
border-top: 1px solid #ddd;
|
||||||
|
|
Loading…
Reference in New Issue