diff --git a/content/plugins/disqus-comments/contents.lr b/content/plugins/disqus-comments/contents.lr deleted file mode 100644 index 09391027..00000000 --- a/content/plugins/disqus-comments/contents.lr +++ /dev/null @@ -1,5 +0,0 @@ -title: Disqus Comments ---- -official: yes ---- -categories: templates diff --git a/content/plugins/flask/contents.lr b/content/plugins/flask/contents.lr new file mode 100644 index 00000000..dca335c4 --- /dev/null +++ b/content/plugins/flask/contents.lr @@ -0,0 +1,3 @@ +name: flask +--- +categories: content diff --git a/content/plugins/jinja-content/contents.lr b/content/plugins/jinja-content/contents.lr deleted file mode 100644 index 06c3b6a3..00000000 --- a/content/plugins/jinja-content/contents.lr +++ /dev/null @@ -1,4 +0,0 @@ -title: Jinja Content ---- -categories: content ---- diff --git a/content/plugins/lektor-htmlmin/contents.lr b/content/plugins/lektor-htmlmin/contents.lr new file mode 100644 index 00000000..5f180048 --- /dev/null +++ b/content/plugins/lektor-htmlmin/contents.lr @@ -0,0 +1,3 @@ +name: lektor-htmlmin +--- +categories: build diff --git a/content/plugins/lektor-i18n/contents.lr b/content/plugins/lektor-i18n/contents.lr new file mode 100644 index 00000000..c28f59a9 --- /dev/null +++ b/content/plugins/lektor-i18n/contents.lr @@ -0,0 +1,3 @@ +name: lektor-i18n +--- +categories: build diff --git a/content/plugins/lektor-jinja-content/contents.lr b/content/plugins/lektor-jinja-content/contents.lr new file mode 100644 index 00000000..a36115fe --- /dev/null +++ b/content/plugins/lektor-jinja-content/contents.lr @@ -0,0 +1,3 @@ +name: lektor-jinja-content +--- +categories: content diff --git a/content/plugins/lektor-make/contents.lr b/content/plugins/lektor-make/contents.lr new file mode 100644 index 00000000..93d65c7f --- /dev/null +++ b/content/plugins/lektor-make/contents.lr @@ -0,0 +1,3 @@ +name: lektor-make +--- +categories: build diff --git a/content/plugins/lektor-npm-support/contents.lr b/content/plugins/lektor-npm-support/contents.lr new file mode 100644 index 00000000..0a955e79 --- /dev/null +++ b/content/plugins/lektor-npm-support/contents.lr @@ -0,0 +1,3 @@ +name: lektor-npm-support +--- +categories: build diff --git a/content/plugins/lektor-webpack-support/contents.lr b/content/plugins/lektor-webpack-support/contents.lr new file mode 100644 index 00000000..9c2359bf --- /dev/null +++ b/content/plugins/lektor-webpack-support/contents.lr @@ -0,0 +1,5 @@ +name: lektor-webpack-support +--- +categories: build +--- +official: yes diff --git a/content/plugins/markdown-admonition/contents.lr b/content/plugins/markdown-admonition/contents.lr deleted file mode 100644 index 16570399..00000000 --- a/content/plugins/markdown-admonition/contents.lr +++ /dev/null @@ -1,7 +0,0 @@ -title: Markdown Admonition ---- -categories: content ---- -link: https://pypi.org/project/lektor-markdown-admonition/ ---- -official: yes diff --git a/content/plugins/markdown-highlighter/contents.lr b/content/plugins/markdown-highlighter/contents.lr deleted file mode 100644 index f9c3815e..00000000 --- a/content/plugins/markdown-highlighter/contents.lr +++ /dev/null @@ -1,7 +0,0 @@ -title: Markdown Highlighter ---- -categories: content ---- -link: https://pypi.org/project/lektor-markdown-highlighter/ ---- -official: yes diff --git a/content/plugins/webpack-support/contents.lr b/content/plugins/webpack-support/contents.lr deleted file mode 100644 index a28afc66..00000000 --- a/content/plugins/webpack-support/contents.lr +++ /dev/null @@ -1,7 +0,0 @@ -title: Webpack Support ---- -categories: build ---- -link: https://pypi.org/project/lektor-webpack-support/ ---- -official: yes diff --git a/models/plugin.ini b/models/plugin.ini index 581b3cb1..e04cac11 100644 --- a/models/plugin.ini +++ b/models/plugin.ini @@ -1,13 +1,12 @@ [model] name = Plugin -inherit = page label = {{ this.title }} [children] enabled = no -[fields.title] -label = Title +[fields.name] +label = Plugin Name (as it appears when you install it) type = string size = large @@ -17,10 +16,6 @@ type = boolean checkbox_label = If true, then the plugin will be marked as official. default = false -[fields.link] -label = PyPI Link. We use this to scrape information about your project and display it on this site. -type = url - [fields.categories] label = Categories type = select diff --git a/packages/project-data/.gitignore b/packages/project-data/.gitignore new file mode 100644 index 00000000..463960b8 --- /dev/null +++ b/packages/project-data/.gitignore @@ -0,0 +1,5 @@ +dist +build +*.pyc +*.pyo +*.egg-info diff --git a/packages/project-data/lektor_project_data.py b/packages/project-data/lektor_project_data.py new file mode 100644 index 00000000..0847ae4c --- /dev/null +++ b/packages/project-data/lektor_project_data.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +from qypi.api import QyPI + +from lektor.pluginsystem import Plugin + +class ProjectDataPlugin(Plugin): + name = 'Project Data' + description = u'Retrieve project information from PyPI.' + + data = {} + + def package_data(self, name, entry_point=None): + if not entry_point: + entry_point = 'https://pypi.org/pypi' + + q = QyPI(entry_point) + pkg = q.get_package(name) + self.data.update(pkg['info']) + + def project_data(self, name): + self.package_data(name) + # self.github_data + # self.bitbucket_data + return self.data + + def on_setup_env(self, **extra): + self.env.jinja_env.globals['project_data'] = self.project_data diff --git a/packages/project-data/setup.py b/packages/project-data/setup.py new file mode 100644 index 00000000..58cd2edf --- /dev/null +++ b/packages/project-data/setup.py @@ -0,0 +1,18 @@ +from setuptools import setup + +setup( + name='lektor-project-data', + version='0.1', + author='Joseph Nix', + author_email='nixjdm@terminallabs.com', + license='MIT', + py_modules=['lektor_project_data'], + install_requires=[ + 'qypi==0.4.1', + ], + entry_points={ + 'lektor.plugins': [ + 'project-data = lektor_project_data:ProjectDataPlugin', + ] + } +) diff --git a/templates/macros/plugins.html b/templates/macros/plugins.html index 75fe4430..bc3d02d1 100644 --- a/templates/macros/plugins.html +++ b/templates/macros/plugins.html @@ -8,19 +8,22 @@ {% endmacro %} {% macro render_plugin_list(plugins, active=none) %} -