revert !58 category paginating: it fails with stacktrace

I'll have to revert this, I'm out of ideas.  Its a strange issue.
Basically the `date_to_xmlschema` filter in __pages/feed.xml_ is
getting a list of `Page` instances instead of a `datetime`.

!58 (comment 361936012)

This reverts commits:
1e9a5a4c
fa7e69e7
parent c8a9a176
Pipeline #217786001 passed with stage
in 6 minutes and 11 seconds
......@@ -2,24 +2,14 @@
layout: page
title: " "
permalink: filled_by_script
pagination:
enabled: true
collection: filled_by_script
per_page: 30
trail:
before: 4
after: 4
permalink: '/:num/'
title: ':title'
sort_field: 'last_updated'
sort_reverse: true
---
{% assign app_category_escaped = page.app_category | escape %}
{% assign filtered_packages = site.packages | where_exp: "item", "item.categories contains app_category_escaped" | sort: "last_updated" | reverse %}
<h3>{{ site.data.strings.app_categories[page.app_category] }}</h3>
<div id="package-list">
{% for package in paginator.posts %}
{% for package in filtered_packages %}
{% include package-list-item.html package=package %}
{% endfor %}
{% include_cached browse-paginator-navigation.html paginator=paginator permalink=page.dir %}
</div>
......@@ -85,10 +85,6 @@ module FDroid
return code
end
def categories
return field('categories')
end
# Generates a hash of dumb strings to be used in templates.
# If a specific value is not present, then it will have a nil value.
# If a value can be localized, then it will choose the most appropriate
......
......@@ -20,20 +20,19 @@ module Jekyll
# @param [Jekyll::Site] site
# @param [string] base
# @param [string] app_category
# @param [string] app_category_id
def initialize(site, base, app_category, app_category_id)
def initialize(site, base, app_category)
@site = site
@base = base
@dir = 'categories'
# Avoid special characters in URL, otherwise language support doesn't work
@name = "#{app_category_id}/index.html"
app_category_url = Utils.slugify(app_category)
@name = "#{app_category_url}/index.html"
self.process(@name)
self.read_yaml(get_layout_dir, 'category-packages.html')
self.data['app_category'] = app_category
self.data['permalink'] = "/categories/#{app_category_id}/"
self.data['pagination']['collection'] = app_category_id
end
def get_layout_dir()
......
......@@ -37,21 +37,8 @@ module Jekyll
site.config["sass"]["load_paths"] << (File.expand_path "../../_sass", File.dirname(__FILE__))
end
# Enable pagination
if site.config["pagination"].nil? || site.config["pagination"].empty?
site.config["pagination"] = Hash.new
end
site.config["pagination"]["enabled"] = true
index = FDroid::IndexV1.download(site.config["fdroid-repo"], site.active_lang || 'en_US')
# Generate collection and detail page for every category
site.config["app_categories"].each do |app_category|
app_category_id = Utils.slugify(app_category)
site.collections[app_category_id] = Collection.new(site, app_category_id)
site.pages << FDroidCategoryDetailPage.new(site, site.source, app_category, app_category_id)
end
# Generate detail page for every package
site.collections["packages"] = Collection.new(site, "packages")
index.apps.each do |package|
......@@ -62,17 +49,11 @@ module Jekyll
# https://gitlab.com/fdroid/jekyll-fdroid/issues/38
site.pages << FDroidPackageDetailPage.new(site, site.source, package)
site.collections["packages"].docs << FDroidPackageDetailPage.new(site, site.source, package)
end
package.categories.each do |app_category|
app_category_id = app_category.dup
app_category_id.sub!('&amp;', '&')
app_category_id = Utils.slugify(app_category_id)
if site.collections[app_category_id].nil?
puts("Warning: App '#{package.package_name}' has unknown category '#{app_category}', will be ignored")
else
site.collections[app_category_id].docs << FDroidPackageDetailPage.new(site, site.source, package)
end
end
# Generate category pages with filtered package list
site.config["app_categories"].each do |category|
site.pages << FDroidCategoryDetailPage.new(site, site.source, category)
end
# Generate browsing pages
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment