3 class ReadmePage < Page
4 def initialize(site, base, dir, src)
13 content = File.read(src, self.merged_file_read_opts({})).each_line.to_a
15 self.data['layout'] = 'default'
16 self.data['title'] = content[0].match(/^# (.*)\n$/)[1]
17 self.data['slug'] = self.data['title'].match(/^(.*):.*$/)[1]
18 self.content = content[1..content.size].join
22 class CategoryPageGenerator < Generator
26 readmes = site.config['readmes']
27 base = readmes['src_base']
28 dir = readmes['out_base']
29 for project in readmes['projects']
30 site.pages << ReadmePage.new(site, site.source, File.join(dir, project['name']), File.join(base, project['name'], 'README.md'))