mirror of
https://github.com/HackPlan/RootPanel.git
synced 2026-04-24 03:35:59 +08:00
27 lines
711 B
CoffeeScript
27 lines
711 B
CoffeeScript
path = require 'path'
|
|
fs = require 'fs'
|
|
|
|
{pluggable} = app
|
|
|
|
wiki = require './wiki'
|
|
|
|
module.exports = pluggable.createHelpers exports =
|
|
name: 'wiki'
|
|
type: 'extension'
|
|
|
|
exports.registerHook 'view.layout.menu_bar',
|
|
href: '/wiki/'
|
|
t_body: 'plugins.wiki.'
|
|
|
|
for category_name in fs.readdirSync("#{__dirname}/../../WIKI")
|
|
for file_name in fs.readdirSync("#{__dirname}/../../WIKI/#{category_name}")
|
|
exports.registerHook 'plugin.wiki.pages',
|
|
t_category: category_name
|
|
t_title: file_name
|
|
language: 'zh_CN'
|
|
content_markdown: fs.readFileSync("#{__dirname}/../../WIKI/#{category_name}/#{file_name}").toString()
|
|
|
|
app.get '/wiki', wiki.index
|
|
|
|
app.get '/wiki/:category/:title', wiki.page
|