Add category option for projects

This commit is contained in:
Blerim Sheqa 2017-07-19 09:49:12 +02:00
parent ea48dfa768
commit c6650ffa3c
3 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@ This file defines generally for which projects documentation should be build. Al
| `latest` | If set to `true`, the project will be cloned into a `latest` directory. |
| `target` | Target directory within `projects_dir` |
| `docs_dir` | Directory that includes the `*.md` files |
| `category` | If set, the projects will be displayed under this category |
Example:

View File

@ -5,6 +5,7 @@ require 'git'
config = YAML::load_file('config.yml')
mkdocs = YAML::load_file('mkdocs.template.yml')
categories = {}
config['projects'].each do |project_name, project_config|
puts "== #{project_name}"
@ -46,8 +47,19 @@ config['projects'].each do |project_name, project_config|
header = filename[2].gsub('-', ' ').split.map(&:capitalize).join(' ')
pages.push(header => filepath)
end
mkdocs['pages'].push(project_name => pages)
if project_config['category']
categories[project_config['category']] = [] unless categories[project_config['category']]
categories[project_config['category']].push(project_name => pages)
else
mkdocs['pages'].push(project_name => pages)
end
end
if categories
categories.each do |cat, proj|
mkdocs['pages'].push(cat => proj)
end
end
mkdocs['extra']['append_pages'].each do |name, target|

View File

@ -19,9 +19,11 @@ projects:
latest: true
target: 'director'
docs_dir: 'doc'
category: 'Modules'
Business Process:
git: 'https://github.com/Icinga/icingaweb2-module-businessprocess.git'
ref: 'tags/v2.1.0'
latest: true
target: 'businessprocess'
docs_dir: 'doc'
category: 'Modules'