1
0
forked from x/icebergs

mix github

This commit is contained in:
shylinux 2020-07-29 11:40:07 +08:00
commit 60ddf0d12d
3 changed files with 9 additions and 3 deletions

View File

@ -27,7 +27,9 @@ func init() {
m.Save(PASTE)
}},
PASTE: {Name: "paste text auto 添加:button", Help: "粘贴板", Action: map[string]*ice.Action{
PASTE: {Name: "paste text auto 添加:button", Help: "粘贴板", Meta: kit.Dict(
"display", "/plugin/story/paste",
), Action: map[string]*ice.Action{
mdb.INSERT: {Name: "insert type name text", Hand: func(m *ice.Message, arg ...string) {
m.Conf(PASTE, kit.Keys(kit.MDB_META, m.Option(ice.MSG_RIVER), m.Option(ice.MSG_STORM), kit.MDB_META, kit.MDB_SHORT), kit.MDB_TEXT)

View File

@ -198,6 +198,7 @@ func (b *Chain) Init(m *ice.Message, arg ...string) Chart {
b.MarginX = kit.Int(m.Option("marginx"))
b.MarginY = kit.Int(m.Option("marginy"))
m.Debug("what %v", arg)
// 解析数据
b.data = kit.Parse(nil, "", b.show(m, arg[0])...).(map[string]interface{})
@ -215,7 +216,7 @@ func (b *Chain) Draw(m *ice.Message, x, y int) Chart {
}
func (b *Chain) show(m *ice.Message, str string) (res []string) {
miss := []int{}
for _, line := range kit.Split(str, "\n") {
for _, line := range kit.Split(str, "\n", "\n") {
// 计算缩进
dep := 0
loop:
@ -251,7 +252,7 @@ func (b *Chain) show(m *ice.Message, str string) (res []string) {
}
// 输出节点
word := kit.Split(line)
word := kit.Split(line, "\t ", "\t ")
res = append(res, "{", kit.MDB_META, "{", "text")
res = append(res, word...)
res = append(res, "}", kit.MDB_LIST, "[")

View File

@ -362,6 +362,9 @@ func (m *Message) Split(str string, field string, space string, enter string) *M
indexs := []int{}
fields := kit.Split(field, space, space, space)
for i, l := range kit.Split(str, enter, enter, enter) {
if strings.HasPrefix(l, "Binary") {
continue
}
if strings.TrimSpace(l) == "" {
continue
}