- {%- assign author = site.data.users[page.author] -%}
+ {%- assign author = page.author_full -%}
{%- if author.logo -%}

diff --git a/_layouts/contributions.html b/_layouts/contributions.html
new file mode 100644
index 0000000..76f2afb
--- /dev/null
+++ b/_layouts/contributions.html
@@ -0,0 +1,11 @@
+---
+layout: default
+menu: ['global']
+---
+
+{%- for doc in page.author_full.contributions -%}
+ -
+ {{ doc.title }}
+
+{%- endfor -%}
+
diff --git a/_layouts/tag.html b/_layouts/tag.html
index 2065f6f..639a684 100644
--- a/_layouts/tag.html
+++ b/_layouts/tag.html
@@ -7,9 +7,8 @@ menu: ['global']
{{ site.data.i18n[site.lang].label.tag_pages }} {{ page.tags }}
- {% include /functions/wiki-pages.html %}
{% for tag in page.tags %}
- {% for other_page in wiki_pages %}
+ {% for other_page in site.data.wiki_pages %}
{% if other_page.tags contains tag and other_page.id != page.id %}
- {{ other_page.title }}
{% endif %}
diff --git a/_layouts/user.html b/_layouts/user.html
new file mode 100644
index 0000000..b89154f
--- /dev/null
+++ b/_layouts/user.html
@@ -0,0 +1,5 @@
+---
+layout: default
+menu: ['global']
+---
+{{ content }}
diff --git a/_plugins/contributions-page-generator.rb b/_plugins/contributions-page-generator.rb
new file mode 100644
index 0000000..70bbaf3
--- /dev/null
+++ b/_plugins/contributions-page-generator.rb
@@ -0,0 +1,22 @@
+module Jekyll
+ class ContributionsPageGenerator < Generator
+ def generate(site)
+ site.data['authors'].each do |author|
+ site.pages << ContributionsPage.new(site, author)
+ end
+ end
+ end
+
+ class ContributionsPage < Page
+ def initialize(site, author)
+ @site = site
+ @base = site.source
+ @name = "#{author['contributions_url']}.html"
+
+ self.process(@name)
+ self.read_yaml(File.join(@base, '_layouts'), 'contributions.html')
+ self.data['author_full'] = author
+ self.data['title'] = "Contributions by #{author['name']}"
+ end
+ end
+end
\ No newline at end of file
diff --git a/_plugins/hook-wiki-page-enhancer.rb b/_plugins/hook-wiki-page-enhancer.rb
index 6d7245b..f7dd3fc 100644
--- a/_plugins/hook-wiki-page-enhancer.rb
+++ b/_plugins/hook-wiki-page-enhancer.rb
@@ -1,8 +1,45 @@
-Jekyll::Hooks.register :documents, :pre_render do |post|
+Jekyll::Hooks.register :site, :post_read do |site|
+ user_pages = site.collections
+ .select { |key, collection| key.start_with?('special') }
+ .map { |key, collection| collection.docs }
+ .flatten
+ .select { |page| page.data['layout'] == 'user' }
+
+ wiki_pages = site.collections
+ .select { |key, collection| key.start_with?('wiki') }
+ .map { |key, collection| collection.docs }
+ .flatten
+ site.data['wiki_pages'] = wiki_pages
+
+ wiki_tags = wiki_pages
+ .map { |page| page.data['tags'] }
+ .flatten
+ .uniq
+ site.data['wiki_tags'] = wiki_tags
+
+ prefix = site.data['i18n'][site.config['lang']]['prefix']['user']
+ authors = site.data['users'].map do |user|
+ contributions = wiki_pages.select { |page| page.data['author'] == user[0] }
+ author = {'id' => user[0],
+ 'name' => user[1]['name'],
+ 'logo' => user[1]['logo'],
+ 'url' => "/#{prefix}#{user[0]}",
+ 'contributions' => contributions,
+ 'contributions_count' => contributions.length,
+ 'contributions_url' => "/#{prefix}#{user[0]}:Contributions"
+ }
+ user_pages.select { |page| page.url == author['url'] }
+ .each { |page| page.data['author_full'] = author }
+ author
+ end
+ site.data['authors'] = authors
+
+ wiki_pages.each do |page|
+ page.data['author_full'] = authors.select { |author| author['id'] == page.data['author'] }.first
+ end
end
Jekyll::Hooks.register :documents, :post_render do |doc|
- # Jekyll.logger.info "Generating:", "Firing :pages, :post_render for : #{post.content}"
if doc.content then
doc.data['size']=doc.content.size
doc.data['bytes']=doc.content.bytesize
diff --git a/_sass/wiki.scss b/_sass/wiki.scss
index 8671a3d..960b76e 100644
--- a/_sass/wiki.scss
+++ b/_sass/wiki.scss
@@ -70,6 +70,10 @@ a {
font-weight: bold;
font-size: 210%;
margin-bottom: 0.5em;
+
+ a {
+ color: #424242;
+ }
}
pre, code {
diff --git a/_special/User:Alexis.html b/_special/User:Alexis.html
index b76db9a..54e37b4 100644
--- a/_special/User:Alexis.html
+++ b/_special/User:Alexis.html
@@ -1,5 +1,5 @@
---
-layout: simple
+layout: user
title: Alexis
created: 2019-04-12
modified: 2019-04-12
@@ -8,4 +8,9 @@ revisions:
date: 2019-04-12
comment: First version
---
-I'm a developer.
+
+ I'm a developer.
+
+