1
0
forked from x/icebergs
icebergs/core/wiki/draw.go
2024-01-03 11:54:12 +08:00

28 lines
809 B
Go

package wiki
import (
"path"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
)
const DRAW = "draw"
func init() {
Index.MergeCommands(ice.Commands{
DRAW: {Name: "draw path=src/main.svg pid list save actions", Help: "思维导图", Icon: "Grapher.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey())
}},
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
defer m.Echo("<!DOCTYPE html><html><body>").Echo("</body></html>")
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
}},
}, WikiAction("", nfs.SVG))},
})
}