1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 03:57:01 +08:00
This commit is contained in:
shaoying 2020-07-28 19:46:27 +08:00
parent 8db22f281c
commit 5675affcc9
2 changed files with 6 additions and 2 deletions

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
}