Skip to content
Permalink
Browse files
Add v8 plugins support to the site
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 9, 2017
1 parent 32008cb commit 7e5caac67f3328da4908faed0cfdb035bd0c4401
@@ -29,21 +29,25 @@

# Package index configuration
PKGINDEX_DIRS = {
'v7': ('v7', 'plugin.tmpl')
'v7': ('v7', 'plugin.tmpl'),
'v8': ('v8', 'plugin.tmpl')
}

PKGINDEX_HANDLERS = {
'v7': ['dirname_as_title', 'parse_plugin_file']
'v7': ['dirname_as_title', 'parse_plugin_file', 'add_dummy_multiver'],
'v8': ['dirname_as_title', 'parse_plugin_file', 'add_dummy_multiver']
}
PKGINDEX_CONFIG = {
'extension': '.plugin',
'versions_supported': [7],
'versions_supported': [7, 8],
'json_filename': 'plugins.json',
}

plugins_submenu = (
('/', 'Plugins Home'),
('/categories/', 'Categories'),
('/v7/', 'Version 7'),
('/v8/', 'Version 8'),
)

# Output folder -- change if using locally
@@ -1211,7 +1215,7 @@

# If you hate "Filenames with Capital Letters and Spaces.md", you should
# set this to true.
UNSLUGIFY_TITLES = True
FILE_METADATA_UNSLUGIFY_TITLES = True

# Additional metadata that is added to a post when creating a new_post
# ADDITIONAL_METADATA = {}

This file was deleted.

@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: Command
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: Compiler
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: CompilerExtension
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: ConfigPlugin
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: LateTask
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: PostScanner
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: ShortcodePlugin
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: SignalHandler
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: Task
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: TaskMultiplier
:post_type: pages
:template: plugin_list.tmpl
@@ -4,7 +4,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: TemplateSystem
:post_type: pages
:template: plugin_list.tmpl
@@ -9,7 +9,7 @@
.. category: category_page
.. post-list::
:sort: slug
:sort: slug_sortable
:categories: {0}
:post_type: pages
:template: plugin_list.tmpl
@@ -31,7 +31,7 @@ All available plugins
=====================

.. post-list::
:sort: slug
:sort: slug_sortable
:tags: plugin
:post_type: pages
:template: plugin_list.tmpl
@@ -6,7 +6,7 @@
.. url_type: full_path
.. post-list::
:sort: slug
:sort: slug_sortable
:tags: plugin
:post_type: pages
:template: sidemenu_list.tmpl
@@ -4,7 +4,7 @@
.. category: version_page
.. post-list::
:sort: slug
:tags: plugin, v7
:sort: slug_sortable
:tags: v7
:post_type: pages
:template: plugin_list.tmpl
@@ -0,0 +1,10 @@
.. title: Version 8
.. slug: v8
.. date: 1970-01-01 00:00:00 UTC
.. category: version_page
.. post-list::
:sort: slug_sortable
:tags: v8
:post_type: pages
:template: plugin_list.tmpl
@@ -20,9 +20,9 @@
${post.meta('author')}
% endif
<p class="minverline">Supports Nikola v${post.meta('minver')}
% if post.meta('maxver'):
% if post.meta('maxver') and post.meta('maxver') != post.meta('minver'):
through ${post.meta('maxver')}
% else:
% elif not post.meta('maxver'):
or newer
% endif
</p>
@@ -64,5 +64,5 @@
</article>
</div>
<div class="col-md-3 hidden-xs hidden-sm" id="sidemenu-container"></div>
<script>var pkgindex_item_name = "${post.meta('slug')}";</script>
<script>var pkgindex_item_name = "${post.meta('slug_versioned')}";</script>
</%block>
@@ -6,8 +6,12 @@
<ul class="post-list">
% for post in posts:
<li class="post-list-item">
% if post.meta('multiver'):
<a href="${post.permalink(lang)}"><span class="text-muted">v${post.meta('dirver')}/</span>${post.title(lang)|h}</a> — ${post.meta('description')}
% else:
<a href="${post.permalink(lang)}">${post.title(lang)|h}</a> — ${post.meta('description')}
</li>
% endif
% endfor
</ul>
%endif
@@ -3,7 +3,11 @@
%if posts:
<div class="list-group">
% for post in posts:
<a class="list-group-item sidemenu-item" data-name="${post.meta('slug')}" href="${post.permalink(lang)}">${post.title(lang)|h}</a>
% if post.meta('multiver'):
<a class="list-group-item sidemenu-item" data-name="${post.meta('slug_versioned')}" href="${post.permalink(lang)}"><span class="text-muted">v${post.meta('dirver')}/</span>${post.title(lang)|h}</a>
% else:
<a class="list-group-item sidemenu-item" data-name="${post.meta('slug_versioned')}" href="${post.permalink(lang)}">${post.title(lang)|h}</a>
% endif
% endfor
</div>
%endif
@@ -4,8 +4,6 @@ Module = helloworld
Tests = test_helloworld

[Nikola]
MinVersion = 6.0.0
MaxVersion = 7.0.0
PluginCategory = Task

[Documentation]
@@ -9,13 +9,13 @@ external file, or embedded in your document.
Example with external file:

```
{{% calendar file=my_event.ical %}}
{{% raw %}}{{% calendar file=my_event.ical %}}{{% /raw %}}
```

Example with embedded calendar:

```
{{% calendar %}}
{{% raw %}}{{% calendar %}}
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
@@ -28,7 +28,7 @@ DTEND:19970715T035959Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR
{{% /calendar %}}
{{% /calendar %}}{{% /raw %}}
```

@@ -37,5 +37,5 @@ a different template, just use the ``template`` argument (it will be loaded from
or from ``templates/``:

```
{{% calendar file=my_event.ical template=my_fancy_template.tmpl %}}
{{% raw %}}{{% calendar file=my_event.ical template=my_fancy_template.tmpl %}}{{% /raw %}}
```
@@ -4,7 +4,7 @@ adapting an existing notebook into a post with additional markup.
Usage:

```
{{% notebook path/to/notebook.ipynb %}}
{{% raw %}}{{% notebook path/to/notebook.ipynb %}}{{% /raw %}}
```

Note: `ipynb` must be enabled and configured (COMPILERS, POSTS/PAGES) for CSS to appear properly. If you are using math
@@ -48,6 +48,11 @@ def _version_from_path(path):
return int(path.split('/')[0].split('v')[-1])


def add_dummy_multiver(post, pkg_dir, config):
"""Add a dummy multiver=False value."""
return {'multiver': False}


def _cp_try_get(config, section, option):
try:
return config.get(section, option)
@@ -76,20 +81,25 @@ def parse_plugin_file(post, pkg_dir, config):
data['website'] = _cp_try_get(c, 'Documentation', 'Website')
data['minver'] = _cp_try_get(c, 'Nikola', 'MinVersion')
data['maxver'] = _cp_try_get(c, 'Nikola', 'MaxVersion')
data['dirver'] = _version_from_path(pkg_dir)
data['slug_versioned'] = 'v{0}/{1}'.format(data['dirver'], plugin)
data['slug_sortable'] = '{1} v{0}'.format(data['dirver'], plugin)

category = c.get('Nikola', 'PluginCategory')
data['category'] = category

if data['minver']:
minver = data['minver'].split('.')[0]
else:
minver = _version_from_path(pkg_dir)
minver = data['dirver']
data['minver'] = minver
if data['maxver']:
maxver = data['maxver'].split('.')[0]
else:
maxver = config['versions_supported'][-1]

# Plugins may specify older versions
minver = max(int(minver), config['versions_supported'][0])
data['allver'] = list(range(int(minver), int(maxver) + 1))

tags = ['plugin', category]
@@ -218,7 +228,8 @@ def add_category(post, pkg_dir, config, args):
'dirname_as_title': dirname_as_title,
'parse_plugin_file': parse_plugin_file,
'parse_theme_info': parse_theme_info,
'add_category': add_category
'add_category': add_category,
'add_dummy_multiver': add_dummy_multiver,
}


@@ -238,6 +249,7 @@ class CompilePackageIndexEntries(PageCompiler):
friendly_name = "pkgindex_compiler"
markdown_compiler = None
pi_enabled = False
supports_metadata = True

def set_site(self, site):
"""Set site for the compiler."""

0 comments on commit 7e5caac

Please sign in to comment.