mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt zml
This commit is contained in:
parent
5630f42efc
commit
626b765de5
@ -192,6 +192,7 @@ func init() {
|
|||||||
m.Push(mdb.NAME, ls[0])
|
m.Push(mdb.NAME, ls[0])
|
||||||
m.Push(mdb.VALUE, ls[1])
|
m.Push(mdb.VALUE, ls[1])
|
||||||
}
|
}
|
||||||
|
m.StatusTimeCount()
|
||||||
}},
|
}},
|
||||||
"file": {Name: "file", Help: "模块文件", Hand: func(m *ice.Message, arg ...string) {
|
"file": {Name: "file", Help: "模块文件", Hand: func(m *ice.Message, arg ...string) {
|
||||||
for k, v := range ice.Info.File {
|
for k, v := range ice.Info.File {
|
||||||
@ -207,6 +208,7 @@ func init() {
|
|||||||
m.Push(nfs.FILE, v)
|
m.Push(nfs.FILE, v)
|
||||||
}
|
}
|
||||||
m.Sort(nfs.PATH)
|
m.Sort(nfs.PATH)
|
||||||
|
m.StatusTimeCount()
|
||||||
}},
|
}},
|
||||||
MAKE_DOMAIN: {Name: "make.domain", Help: "编译主机", Hand: func(m *ice.Message, arg ...string) {
|
MAKE_DOMAIN: {Name: "make.domain", Help: "编译主机", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if os.Getenv(CTX_DEV) == "" || os.Getenv(CTX_POD) == "" {
|
if os.Getenv(CTX_DEV) == "" || os.Getenv(CTX_POD) == "" {
|
||||||
|
@ -6,10 +6,18 @@ import (
|
|||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _command_list(m *ice.Message, name string) {
|
func _command_list(m *ice.Message, name string) {
|
||||||
|
switch kit.Ext(name) {
|
||||||
|
case nfs.JS:
|
||||||
|
m.Push("display", ice.FileURI(name))
|
||||||
|
name = ice.GetFileCmd(name)
|
||||||
|
case nfs.GO:
|
||||||
|
name = ice.GetFileCmd(name)
|
||||||
|
}
|
||||||
if strings.HasPrefix(name, "can.") {
|
if strings.HasPrefix(name, "can.") {
|
||||||
m.Push(mdb.INDEX, name)
|
m.Push(mdb.INDEX, name)
|
||||||
return
|
return
|
||||||
@ -90,8 +98,6 @@ func init() {
|
|||||||
_command_search(m, arg[0], kit.Select("", arg, 1), kit.Select("", arg, 2))
|
_command_search(m, arg[0], kit.Select("", arg, 1), kit.Select("", arg, 2))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
INDEX: {Name: "index", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
}},
|
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, "")
|
arg = append(arg, "")
|
||||||
|
@ -143,9 +143,11 @@ const (
|
|||||||
CSV = ice.CSV
|
CSV = ice.CSV
|
||||||
JSON = ice.JSON
|
JSON = ice.JSON
|
||||||
|
|
||||||
YML = "yml"
|
|
||||||
IML = "iml"
|
|
||||||
TXT = "txt"
|
TXT = "txt"
|
||||||
|
IML = "iml"
|
||||||
|
XML = "xml"
|
||||||
|
YML = "yml"
|
||||||
|
ZML = "zml"
|
||||||
SVG = "svg"
|
SVG = "svg"
|
||||||
|
|
||||||
PWD = "./"
|
PWD = "./"
|
||||||
@ -165,7 +167,7 @@ func init() {
|
|||||||
SOURCE, kit.Dict(
|
SOURCE, kit.Dict(
|
||||||
HTML, ice.TRUE, CSS, ice.TRUE, JS, ice.TRUE, GO, ice.TRUE, SH, ice.TRUE, CSV, ice.TRUE, JSON, ice.TRUE,
|
HTML, ice.TRUE, CSS, ice.TRUE, JS, ice.TRUE, GO, ice.TRUE, SH, ice.TRUE, CSV, ice.TRUE, JSON, ice.TRUE,
|
||||||
"md", ice.TRUE, "shy", ice.TRUE, "makefile", ice.TRUE, "license", ice.TRUE,
|
"md", ice.TRUE, "shy", ice.TRUE, "makefile", ice.TRUE, "license", ice.TRUE,
|
||||||
"conf", ice.TRUE, YML, ice.TRUE, IML, ice.TRUE, "txt", ice.TRUE,
|
"conf", ice.TRUE, YML, ice.TRUE, ZML, ice.TRUE, IML, ice.TRUE, "txt", ice.TRUE,
|
||||||
"py", ice.TRUE,
|
"py", ice.TRUE,
|
||||||
),
|
),
|
||||||
)},
|
)},
|
||||||
|
@ -56,10 +56,10 @@ func _cmd_file(m *ice.Message, arg ...string) bool {
|
|||||||
m.RenderResult()
|
m.RenderResult()
|
||||||
}
|
}
|
||||||
|
|
||||||
case "txt":
|
case nfs.ZML:
|
||||||
m.RenderCmd("can.parse", m.Cmdx(nfs.CAT, p))
|
m.RenderCmd("can.parse", m.Cmdx(nfs.CAT, p))
|
||||||
|
|
||||||
case "iml":
|
case nfs.IML:
|
||||||
if m.Option(ice.MSG_USERPOD) == "" {
|
if m.Option(ice.MSG_USERPOD) == "" {
|
||||||
m.RenderRedirect(path.Join(CHAT_WEBSITE, strings.TrimPrefix(p, SRC_WEBSITE)))
|
m.RenderRedirect(path.Join(CHAT_WEBSITE, strings.TrimPrefix(p, SRC_WEBSITE)))
|
||||||
m.Option(ice.MSG_ARGS, m.Option(ice.MSG_ARGS))
|
m.Option(ice.MSG_ARGS, m.Option(ice.MSG_ARGS))
|
||||||
|
@ -163,7 +163,7 @@ func _website_render(m *ice.Message, w http.ResponseWriter, r *http.Request, kin
|
|||||||
r.URL.Path = "/chat/cmd/web.chat.div"
|
r.URL.Path = "/chat/cmd/web.chat.div"
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
case nfs.TXT:
|
case nfs.ZML:
|
||||||
msg.RenderCmd("can.parse", text)
|
msg.RenderCmd("can.parse", text)
|
||||||
|
|
||||||
case nfs.IML:
|
case nfs.IML:
|
||||||
|
57
core/code/zml.go
Normal file
57
core/code/zml.go
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
package code
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
SRC_WEBSITE = "src/website/"
|
||||||
|
CHAT_WEBSITE = "/chat/website/"
|
||||||
|
)
|
||||||
|
|
||||||
|
func _website_url(m *ice.Message, file string) string {
|
||||||
|
const WEBSITE = "website"
|
||||||
|
p := path.Join(WEBSITE, file)
|
||||||
|
if m.Option(ice.MSG_USERPOD) != "" {
|
||||||
|
p = path.Join(ice.POD, m.Option(ice.MSG_USERPOD), WEBSITE, file)
|
||||||
|
}
|
||||||
|
return strings.Split(kit.MergeURL2(m.Option(ice.MSG_USERWEB), path.Join("/chat", p)), "?")[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
const ZML = nfs.ZML
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
Index.Register(&ice.Context{Name: ZML, Help: "网页", Commands: map[string]*ice.Command{
|
||||||
|
ZML: {Name: "zml", Help: "网页", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(mdb.PLUGIN, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
||||||
|
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
||||||
|
LoadPlug(m, ZML)
|
||||||
|
}},
|
||||||
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.EchoIFrame(_website_url(m, strings.TrimPrefix(path.Join(arg[2], arg[1]), SRC_WEBSITE)))
|
||||||
|
}},
|
||||||
|
}, PlugAction())},
|
||||||
|
}, Configs: map[string]*ice.Config{
|
||||||
|
ZML: {Name: ZML, Help: "网页", Value: kit.Data(PLUG, kit.Dict(PREFIX, kit.Dict("# ", COMMENT), PREPARE, kit.Dict(
|
||||||
|
KEYWORD, kit.Simple(
|
||||||
|
"head", "left", "main", "foot",
|
||||||
|
"tabs",
|
||||||
|
),
|
||||||
|
CONSTANT, kit.Simple(
|
||||||
|
"auto", "username",
|
||||||
|
),
|
||||||
|
FUNCTION, kit.Simple(
|
||||||
|
"index", "action", "args", "type",
|
||||||
|
"style", "width",
|
||||||
|
),
|
||||||
|
), KEYWORD, kit.Dict(),
|
||||||
|
))},
|
||||||
|
}}, nil)
|
||||||
|
}
|
@ -12,7 +12,7 @@ const TREND = "trend"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
TREND: {Name: "trend repos begin_time@date auto", Help: "趋势图", Meta: kit.Dict(
|
TREND: {Name: "trend repos@key begin_time@date auto", Help: "趋势图", Meta: kit.Dict(
|
||||||
ice.Display("/plugin/story/trend.js"),
|
ice.Display("/plugin/story/trend.js"),
|
||||||
), Action: ice.MergeAction(map[string]*ice.Action{
|
), Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user