1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2020-05-13 11:01:03 +08:00
parent b9317a23b0
commit ea6bf32532
5 changed files with 33 additions and 11 deletions

View File

@ -1206,6 +1206,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
// 收藏详情
m.Grows(ice.WEB_FAVOR, kit.Keys(kit.MDB_HASH, key), "id", arg[1], func(index int, value map[string]interface{}) {
m.Push("detail", value)
m.Optionv("value", value)
m.Push("key", "render")
m.Push("value", m.Cmdx(m.Conf(ice.WEB_FAVOR, kit.Keys("meta.render", value["type"]))))
})
})
return

View File

@ -1,9 +1,10 @@
package wiki
import (
"github.com/shylinux/icebergs"
"github.com/shylinux/toolkits"
"strings"
ice "github.com/shylinux/icebergs"
kit "github.com/shylinux/toolkits"
)
// 图形接口
@ -260,12 +261,15 @@ func (b *Chain) draw(m *ice.Message, root map[string]interface{}, depth int, wid
// 当前节点
item := &Block{
BackGround: kit.Select(b.BackGround, kit.Select(p.BackGround, meta["bg"])),
FontColor: kit.Select(b.FontColor, kit.Select(p.FontColor, meta["fg"])),
BackGround: kit.Select(b.BackGround, kit.Select(p.BackGround)),
FontColor: kit.Select(b.FontColor, kit.Select(p.FontColor)),
FontSize: b.FontSize,
Padding: b.Padding,
Margin: b.Margin,
}
if m.Option("compact") != "true" {
item.Width = b.max[depth]
}
item.Init(m, kit.Format(meta["text"])).Data(m, meta)
item.Draw(m, x, y+(kit.Int(meta["height"])-1)*b.GetHeights()/2)

View File

@ -1,10 +1,10 @@
package wiki
import (
"github.com/shylinux/icebergs"
ice "github.com/shylinux/icebergs"
_ "github.com/shylinux/icebergs/base"
"github.com/shylinux/icebergs/base/web"
"github.com/shylinux/toolkits"
kit "github.com/shylinux/toolkits"
"fmt"
"os"
@ -212,8 +212,11 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
data := kit.Dict()
cmds := kit.Split(arg[1])
m.Search(cmds[0], func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
ls := strings.Split(cmds[0], ".")
m.Cmd(ice.CTX_COMMAND, strings.Join(ls[:len(ls)-1], "."), key)
if ls := strings.Split(cmds[0], "."); len(ls) > 1 {
m.Cmd(ice.CTX_COMMAND, strings.Join(ls[:len(ls)-1], "."), key)
} else {
m.Cmd(ice.CTX_COMMAND, key)
}
if data["feature"], data["inputs"] = cmd.Meta, cmd.List; len(cmd.List) == 0 {
data["inputs"] = m.Confv("field", "meta.some.simple.inputs")
}
@ -312,7 +315,8 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
m.Option("stroke-width", "2")
m.Option("padding", "10")
m.Option("margin", "10")
m.Option("font-family", kit.Select("", "monospace", len(arg[2]) == len([]rune(arg[2]))))
// m.Option("font-family", kit.Select("", "monospace", len(arg[2]) == len([]rune(arg[2]))))
m.Option("font-family", "monospace")
for i := 6; i < len(arg)-1; i++ {
m.Option(arg[i], arg[i+1])
}

View File

@ -94,11 +94,12 @@ highlight Comment ctermfg=cyan ctermbg=darkblue
call ShyDefine("g:favor_tab", "")
call ShyDefine("g:favor_note", "")
let shyList=["启动流程", "请求响应", "服务集群", "数据结构", "系统架构", "编译原理"]
let g:favor_prefix=""
fun! ShyFavor()
" let g:favor_tab = input("tab: ", g:favor_tab)
let g:favor_tab = g:shyList[inputlist(g:shyList)-1]
let g:favor_note = input("note: ", g:favor_note)
call ShySend("favor", {"tab": g:favor_tab, "note": g:favor_note, "arg": getline("."), "row": getpos(".")[1], "col": getpos(".")[2]})
call ShySend("favor", {"tab": g:favor_prefix . g:favor_tab, "note": g:favor_note, "arg": getline("."), "row": getpos(".")[1], "col": getpos(".")[2]})
endfun
fun! ShyFavors()
" let res = split(ShySend("favor", {"tab": input("tab: ", g:favor_tab)}), "\n")

View File

@ -1,6 +1,8 @@
package vim
import (
"fmt"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/web"
"github.com/shylinux/icebergs/core/code"
@ -31,12 +33,18 @@ var Index = &ice.Context{Name: "vim", Help: "编辑器",
switch value["name"] {
case "read", "write", "exec":
p := path.Join(kit.Format(kit.Value(value, "extra.pwd")), kit.Format(kit.Value(value, "extra.buf")))
if strings.HasPrefix(kit.Format(kit.Value(value, "extra.buf")), "/") {
p = path.Join(kit.Format(kit.Value(value, "extra.buf")))
}
f, e := os.Open(p)
m.Assert(e)
defer f.Close()
b, e := ioutil.ReadAll(f)
m.Assert(e)
m.Echo(string(b))
default:
m.Cmdy(ice.CLI_SYSTEM, "sed", "-n", fmt.Sprintf("/%s/,/^}$/p", value["text"]), kit.Value(value, "extra.buf"))
}
}}))
}},
@ -84,9 +92,11 @@ var Index = &ice.Context{Name: "vim", Help: "编辑器",
}
}
ls := strings.Split(m.Option("pwd"), "/")
m.Option("you", ls[len(ls)-1])
m.Richs("login", nil, m.Option("sid"), func(key string, value map[string]interface{}) {
// 查找空间
m.Option("you", value["you"])
m.Option("you", kit.Select(m.Option("you"), value["you"]))
})
m.Logs(ice.LOG_AUTH, "you", m.Option("you"), "url", m.Option(ice.MSG_USERURL), "cmd", m.Optionv("cmds"), "sub", m.Optionv("sub"))