aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-09-15 00:34:53 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-12 22:47:59 +0200
commit9e5e47b67c81236b423fdbea72f8fd7c655aa3ef (patch)
treed0a1abe33d17541c379d6b1b06bf16bde205b31a
parentglep: Update for .txt -> .rst rename (diff)
downloadwww-9e5e47b67c81236b423fdbea72f8fd7c655aa3ef.tar.gz
www-9e5e47b67c81236b423fdbea72f8fd7c655aa3ef.tar.bz2
www-9e5e47b67c81236b423fdbea72f8fd7c655aa3ef.zip
glep: Reuse the YAML frontmatter parser for GLEPs
-rw-r--r--_layouts/glep.html16
-rw-r--r--_plugins/gleps.rb44
-rw-r--r--inside-gentoo/gleps/index.html42
3 files changed, 33 insertions, 69 deletions
diff --git a/_layouts/glep.html b/_layouts/glep.html
index e280f30..4b6cb9c 100644
--- a/_layouts/glep.html
+++ b/_layouts/glep.html
@@ -2,36 +2,36 @@
layout: tyrian
nav2-display: true
---
-<h1 class="first-header">GLEP {{ page.number }}: {{ page.title }}</h1>
+<h1 class="first-header">{{ page.Title | xml_escape }}</h1>
<table class="table-bordered table-condensed table-striped pull-right">
<tr>
<th>Type</th>
- <td>{{ page.type }}</td>
+ <td>{{ page.Type | xml_escape }}</td>
</tr>
<tr>
<th>Status</th>
- <td>{{ page.status }}</td>
+ <td>{{ page.Status | xml_escape }}</td>
</tr>
<tr>
<th>Author</th>
- <td>{{ page.author }}</td>
+ <td>{{ page.Author | xml_escape }}</td>
</tr>
<tr>
<th>Replaces</th>
- <td>{{ page.replaces }}</td>
+ <td>{{ page.Replaces | xml_escape }}</td>
</tr>
<tr>
<th>Replaced by</th>
- <td>{{ page.replacedby }}</td>
+ <td>{{ page.Replaced-By | xml_escape }}</td>
</tr>
<tr>
<th>Requires</th>
- <td>{{ page.requires }}</td>
+ <td>{{ page.Requires | xml_escape }}</td>
</tr>
<tr>
<th>Post history</th>
- <td>{{ page.posthistory }}</td>
+ <td>{{ page.Post-History | xml_escape }}</td>
</tr>
</table>
diff --git a/_plugins/gleps.rb b/_plugins/gleps.rb
index 631e47c..62c7f78 100644
--- a/_plugins/gleps.rb
+++ b/_plugins/gleps.rb
@@ -17,7 +17,7 @@ module Gentoo
end
end
- site.data['gleps'] = site.data['gleps'].sort { |a, b| a['number'] <=> b['number'] }
+ site.data['gleps'] = site.data['gleps'].sort { |a, b| a['GLEP'] <=> b['GLEP'] }
end
end
@@ -31,53 +31,17 @@ module Gentoo
process(@name)
read_yaml(File.join(@base, GLEPGenerator::GLEP_DIR), name)
+ data['title'] = "GLEP #{data['GLEP']}: #{data['Title']}"
data['permalink'] = "/glep/#{@name}"
data['layout'] = 'glep'
data['nav1'] = 'inside-gentoo'
data['nav2'] = 'gleps'
data['extracss'] = ['glep.css']
- lines = File.readlines(File.join(@base, GLEPGenerator::GLEP_DIR, name))
- while not lines.empty?
- line = lines.shift
- @number = $1.to_i if line =~ /^GLEP: (.*)$/
- @title = $1 if line =~ /^Title: (.*)$/
- @version = $1 if line =~ /^Version: (.*)$/
- @lastmodified = $1 if line =~ /^Last-Modified: (.*)$/
- @author = $1 if line =~ /^Author: (.*)$/
- @discussionsto = $1 if line =~ /^Discussions-To: (.*)$/
- @status = $1 if line =~ /^Status: (.*)$/
- @type = $1 if line =~ /^Type: (.*)$/
- @contenttype = $1 if line =~ /^Content-Type: (.*)$/
- @requires = $1 if line =~ /^Requires: (.*)$/
- @created = $1 if line =~ /^Created: (.*)$/
- @posthistory = $1 if line =~ /^Post-History: (.*)$/
- @replaces = $1 if line =~ /^Replaces: (.*)$/
- @replacedby = $1 if line =~ /^Replaced-By: (.*)$/
- break if line.chomp.empty?
- end
- @content = RbST.new(".. contents::\n..\n\n" + lines.join('')).to_html(
+ @content = RbST.new(".. contents::\n..\n\n" + @content).to_html(
'initial-header-level' => 2)
- glep_data = {
- 'number' => @number,
- 'title' => @title,
- 'version' => @version,
- 'lastmodified' => @lastmodified,
- 'author' => @author,
- 'discussionsto' => @discussionsto,
- 'status' => @status,
- 'type' => @type,
- 'contenttype' => @contenttype,
- 'requires' => @requires,
- 'created' => @created,
- 'posthistory' => @posthistory,
- 'replaces' => @replaces,
- 'replacedby' => @replacedby,
- }
-
- data.update(glep_data)
- site.data['gleps'] << glep_data.merge({
+ site.data['gleps'] << data.merge({
'url' => data['permalink']
})
end
diff --git a/inside-gentoo/gleps/index.html b/inside-gentoo/gleps/index.html
index c4d88e7..419c2ce 100644
--- a/inside-gentoo/gleps/index.html
+++ b/inside-gentoo/gleps/index.html
@@ -19,12 +19,12 @@ nav2-weight: 25
<th>Title</th>
</tr>
{% for entry in site.data.gleps %}
- {% if entry.status == 'Active' or entry.status == 'Final' %}
+ {% if entry.Status == 'Active' or entry.Status == 'Final' %}
<tr>
- <td><a href='{{ entry.url }}'>{{ entry.number | xml_escape }}</a></td>
- <td>{{ entry.type | xml_escape }}</td>
- <td>{{ entry.status | xml_escape }}</td>
- <td>{{ entry.title | xml_escape }}</td>
+ <td><a href='{{ entry.url }}'>{{ entry.GLEP | xml_escape }}</a></td>
+ <td>{{ entry.Type | xml_escape }}</td>
+ <td>{{ entry.Status | xml_escape }}</td>
+ <td>{{ entry.Title | xml_escape }}</td>
</tr>
{% endif %}
{% endfor %}
@@ -40,12 +40,12 @@ nav2-weight: 25
<th>Title</th>
</tr>
{% for entry in site.data.gleps %}
- {% if entry.status == 'Accepted' %}
+ {% if entry.Status == 'Accepted' %}
<tr>
- <td><a href='{{ entry.url }}'>{{ entry.number | xml_escape }}</a></td>
- <td>{{ entry.type | xml_escape }}</td>
- <td>{{ entry.status | xml_escape }}</td>
- <td>{{ entry.title | xml_escape }}</td>
+ <td><a href='{{ entry.url }}'>{{ entry.GLEP | xml_escape }}</a></td>
+ <td>{{ entry.Type | xml_escape }}</td>
+ <td>{{ entry.Status | xml_escape }}</td>
+ <td>{{ entry.Title | xml_escape }}</td>
</tr>
{% endif %}
{% endfor %}
@@ -61,12 +61,12 @@ nav2-weight: 25
<th>Title</th>
</tr>
{% for entry in site.data.gleps %}
- {% if entry.status == 'Draft' %}
+ {% if entry.Status == 'Draft' %}
<tr>
- <td><a href='{{ entry.url }}'>{{ entry.number | xml_escape }}</a></td>
- <td>{{ entry.type | xml_escape }}</td>
- <td>{{ entry.status | xml_escape }}</td>
- <td>{{ entry.title | xml_escape }}</td>
+ <td><a href='{{ entry.url }}'>{{ entry.GLEP | xml_escape }}</a></td>
+ <td>{{ entry.Type | xml_escape }}</td>
+ <td>{{ entry.Status | xml_escape }}</td>
+ <td>{{ entry.Title | xml_escape }}</td>
</tr>
{% endif %}
{% endfor %}
@@ -82,13 +82,13 @@ nav2-weight: 25
<th>Title</th>
</tr>
{% for entry in site.data.gleps %}
- {% if entry.status != 'Active' and entry.status != 'Final'
- and entry.status != 'Accepted' and entry.status != 'Draft' %}
+ {% if entry.Status != 'Active' and entry.Status != 'Final'
+ and entry.Status != 'Accepted' and entry.Status != 'Draft' %}
<tr>
- <td><a href='{{ entry.url }}'>{{ entry.number | xml_escape }}</a></td>
- <td>{{ entry.type | xml_escape }}</td>
- <td>{{ entry.status | xml_escape }}</td>
- <td>{{ entry.title | xml_escape }}</td>
+ <td><a href='{{ entry.url }}'>{{ entry.GLEP | xml_escape }}</a></td>
+ <td>{{ entry.Type | xml_escape }}</td>
+ <td>{{ entry.Status | xml_escape }}</td>
+ <td>{{ entry.Title | xml_escape }}</td>
</tr>
{% endif %}
{% endfor %}