From 855aaac27903b0330ae4a43ef46fe84c95ed7c93 Mon Sep 17 00:00:00 2001 From: shy Date: Wed, 6 Apr 2022 12:27:03 +0800 Subject: [PATCH] opt some --- base/mdb/mdb.go | 3 +++ core/chat/website.go | 11 +++++++++++ core/wiki/image.go | 14 +++++++++----- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/base/mdb/mdb.go b/base/mdb/mdb.go index f4b96be5..e4d5bee2 100644 --- a/base/mdb/mdb.go +++ b/base/mdb/mdb.go @@ -208,6 +208,9 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: map[string]* } }}, EXPORT: {Name: "export key sub type file", Help: "导出", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + if m.Option(ice.CACHE_LIMIT) == "" { + m.Option(ice.CACHE_LIMIT, "-1") + } switch file := _file_name(m, arg...); arg[2] { case ZONE: _zone_export(m, arg[0], _domain_chain(m, arg[1]), file) diff --git a/core/chat/website.go b/core/chat/website.go index cd9e509f..2c379420 100644 --- a/core/chat/website.go +++ b/core/chat/website.go @@ -36,6 +36,8 @@ func _website_parse(m *ice.Message, text string, args ...string) (map[string]int ), kit.Dict(), kit.Dict() prefix := "" + nriver := 0 + nstorm := 0 m.Cmd(lex.SPLIT, "", mdb.KEY, mdb.NAME, func(deep int, ls []string, meta map[string]interface{}) []string { if deep == 1 { switch ls[0] { @@ -126,9 +128,18 @@ func _website_parse(m *ice.Message, text string, args ...string) (map[string]int switch deep { case 1: + nriver++ + nstorm = 0 storm = kit.Dict() + if ls[0] == "auto" { + ls[0] = kit.Format(nriver) + } river[ls[0]] = kit.Dict(mdb.NAME, ls[1], STORM, storm, data, "order", len(river)) case 2: + nstorm++ + if ls[0] == "auto" { + ls[0] = kit.Format(nstorm) + } last = kit.Dict(mdb.NAME, ls[1], mdb.LIST, kit.List(), data, "order", len(storm)) storm[ls[0]] = last prefix = "" diff --git a/core/wiki/image.go b/core/wiki/image.go index bd35b914..92bbec07 100644 --- a/core/wiki/image.go +++ b/core/wiki/image.go @@ -9,8 +9,8 @@ import ( kit "shylinux.com/x/toolkits" ) -func _image_show(m *ice.Message, text string, arg ...string) { - _wiki_template(m, IMAGE, "", _wiki_link(m, IMAGE, text), arg...) +func _image_show(m *ice.Message, text string) { + _wiki_template(m, IMAGE, "", _wiki_link(m, IMAGE, text)) } const ( @@ -23,7 +23,7 @@ const IMAGE = "image" func init() { Index.Merge(&ice.Context{Commands: map[string]*ice.Command{ - IMAGE: {Name: "image url", Help: "图片", Action: map[string]*ice.Action{ + IMAGE: {Name: "image url height auto", Help: "图片", Action: map[string]*ice.Action{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(mdb.RENDER, mdb.CREATE, PNG, m.PrefixKey()) }}, @@ -31,11 +31,15 @@ func init() { _image_show(m, path.Join(arg[2], arg[1])) }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - _image_show(m, arg[0], arg[1:]...) + if len(arg) == 0 { + return + } + m.Option("height", kit.Select("", arg, 1)) + _image_show(m, arg[0]) }}, }, Configs: map[string]*ice.Config{ IMAGE: {Name: IMAGE, Help: "图片", Value: kit.Data( - nfs.TEMPLATE, ``, + nfs.TEMPLATE, ``, nfs.PATH, ice.USR_LOCAL_IMAGE, )}, }})