blob: ee2c27c561b8a9c7f1327bb2359bd3a24ac346ba (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
module Gentoo
class WikiGenerator < Jekyll::Generator
WIKI_XML = '_data/wiki.xml'
def generate(site)
wikiinfo = Nokogiri::XML(File.open(WIKI_XML))
# author is the only thing taken from the dublin core, we don't need namespaces for that
wikiinfo.remove_namespaces!
site.data['wiki'] ||= { 'updates' => [] }
wikiinfo.xpath('/rss/channel/item').each do |item|
item_data = {}
item.children.each do |tag|
case tag.name
when 'title'
item_data['title'] = tag.text
when 'link'
item_data['uri'] = tag.text
when 'creator'
item_data['author'] = tag.text
end
end
site.data['wiki']['updates'] << item_data
end
end
end
end
|