forked from x/icebergs
opt word
This commit is contained in:
parent
79a8c14075
commit
b77bce9206
@ -25,12 +25,15 @@ type Block struct {
|
|||||||
BackGround string
|
BackGround string
|
||||||
|
|
||||||
Padding int
|
Padding int
|
||||||
Margin int
|
MarginX int
|
||||||
|
MarginY int
|
||||||
|
|
||||||
Width, Height int
|
Width, Height int
|
||||||
|
|
||||||
TextData string
|
TextData string
|
||||||
RectData string
|
RectData string
|
||||||
|
|
||||||
|
x, y int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *Block) Init(m *ice.Message, arg ...string) Chart {
|
func (b *Block) Init(m *ice.Message, arg ...string) Chart {
|
||||||
@ -39,7 +42,8 @@ func (b *Block) Init(m *ice.Message, arg ...string) Chart {
|
|||||||
b.FontColor = kit.Select(m.Option("stroke"), kit.Select(b.FontColor, arg, 2))
|
b.FontColor = kit.Select(m.Option("stroke"), kit.Select(b.FontColor, arg, 2))
|
||||||
b.BackGround = kit.Select(m.Option("fill"), kit.Select(b.BackGround, arg, 3))
|
b.BackGround = kit.Select(m.Option("fill"), kit.Select(b.BackGround, arg, 3))
|
||||||
b.Padding = kit.Int(kit.Select(m.Option("padding"), kit.Select(kit.Format(b.Padding), arg, 4)))
|
b.Padding = kit.Int(kit.Select(m.Option("padding"), kit.Select(kit.Format(b.Padding), arg, 4)))
|
||||||
b.Margin = kit.Int(kit.Select(m.Option("margin"), kit.Select(kit.Format(b.Margin), arg, 5)))
|
b.MarginX = kit.Int(kit.Select(m.Option("marginx"), kit.Select(kit.Format(b.MarginX), arg, 5)))
|
||||||
|
b.MarginY = kit.Int(kit.Select(m.Option("marginy"), kit.Select(kit.Format(b.MarginY), arg, 5)))
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
func (b *Block) Data(m *ice.Message, root interface{}) Chart {
|
func (b *Block) Data(m *ice.Message, root interface{}) Chart {
|
||||||
@ -61,11 +65,11 @@ func (b *Block) Data(m *ice.Message, root interface{}) Chart {
|
|||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
func (b *Block) Draw(m *ice.Message, x, y int) Chart {
|
func (b *Block) Draw(m *ice.Message, x, y int) Chart {
|
||||||
m.Echo(`<rect x="%d" y="%d" width="%d" height="%d" rx="4" ry="4" %v/>`,
|
m.Echo(`<rect x="%d" y="%d" width="%d" height="%d" rx="4" ry="4" fill="%s" %v/>`,
|
||||||
x+b.Margin/2, y+b.Margin/2, b.GetWidth(), b.GetHeight(), b.RectData)
|
x+b.MarginX/2, y+b.MarginY/2, b.GetWidth(), b.GetHeight(), b.BackGround, b.RectData)
|
||||||
m.Echo("\n")
|
m.Echo("\n")
|
||||||
m.Echo(`<text x="%d" y="%d" stroke-width="1" fill="%s" %v>%v</text>`,
|
m.Echo(`<text x="%d" y="%d" stroke-width="1" fill="%s" stroke=%s %v>%v</text>`,
|
||||||
x+b.GetWidths()/2, y+b.GetHeights()/2, b.FontColor, b.TextData, b.Text)
|
x+b.GetWidths()/2, y+b.GetHeights()/2, b.FontColor, b.FontColor, b.TextData, b.Text)
|
||||||
m.Echo("\n")
|
m.Echo("\n")
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
@ -86,10 +90,10 @@ func (b *Block) GetHeight(str ...string) int {
|
|||||||
return b.FontSize + b.Padding
|
return b.FontSize + b.Padding
|
||||||
}
|
}
|
||||||
func (b *Block) GetWidths(str ...string) int {
|
func (b *Block) GetWidths(str ...string) int {
|
||||||
return b.GetWidth(str...) + b.Margin
|
return b.GetWidth(str...) + b.MarginX
|
||||||
}
|
}
|
||||||
func (b *Block) GetHeights(str ...string) int {
|
func (b *Block) GetHeights(str ...string) int {
|
||||||
return b.GetHeight() + b.Margin
|
return b.GetHeight() + b.MarginY
|
||||||
}
|
}
|
||||||
|
|
||||||
// 框
|
// 框
|
||||||
@ -103,7 +107,8 @@ func (b *Label) Init(m *ice.Message, arg ...string) Chart {
|
|||||||
b.Text = kit.Select(b.Text, arg, 0)
|
b.Text = kit.Select(b.Text, arg, 0)
|
||||||
b.FontSize = kit.Int(m.Option("font-size"))
|
b.FontSize = kit.Int(m.Option("font-size"))
|
||||||
b.Padding = kit.Int(m.Option("padding"))
|
b.Padding = kit.Int(m.Option("padding"))
|
||||||
b.Margin = kit.Int(m.Option("margin"))
|
b.MarginX = kit.Int(m.Option("marginx"))
|
||||||
|
b.MarginY = kit.Int(m.Option("marginy"))
|
||||||
|
|
||||||
// 解析数据
|
// 解析数据
|
||||||
b.max = map[int]int{}
|
b.max = map[int]int{}
|
||||||
@ -124,7 +129,7 @@ func (b *Label) Init(m *ice.Message, arg ...string) Chart {
|
|||||||
|
|
||||||
// 计算尺寸
|
// 计算尺寸
|
||||||
for _, v := range b.max {
|
for _, v := range b.max {
|
||||||
b.Width += v + b.Margin
|
b.Width += v + b.MarginX
|
||||||
}
|
}
|
||||||
b.Height = len(b.data) * b.GetHeights()
|
b.Height = len(b.data) * b.GetHeights()
|
||||||
return b
|
return b
|
||||||
@ -139,7 +144,8 @@ func (b *Label) Draw(m *ice.Message, x, y int) Chart {
|
|||||||
item := &Block{
|
item := &Block{
|
||||||
FontSize: b.FontSize,
|
FontSize: b.FontSize,
|
||||||
Padding: b.Padding,
|
Padding: b.Padding,
|
||||||
Margin: b.Margin,
|
MarginX: b.MarginX,
|
||||||
|
MarginY: b.MarginY,
|
||||||
}
|
}
|
||||||
switch data := kit.Parse(nil, "", kit.Split(text)...).(type) {
|
switch data := kit.Parse(nil, "", kit.Split(text)...).(type) {
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
@ -154,10 +160,10 @@ func (b *Label) Draw(m *ice.Message, x, y int) Chart {
|
|||||||
}
|
}
|
||||||
item.Draw(m, left, top)
|
item.Draw(m, left, top)
|
||||||
|
|
||||||
left += item.GetWidth() + item.Margin
|
left += item.GetWidth() + item.MarginX
|
||||||
b.Height = item.GetHeight()
|
b.Height = item.GetHeight()
|
||||||
}
|
}
|
||||||
top += b.Height + b.Margin
|
top += b.Height + b.MarginY
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
@ -172,7 +178,8 @@ type Chain struct {
|
|||||||
func (b *Chain) Init(m *ice.Message, arg ...string) Chart {
|
func (b *Chain) Init(m *ice.Message, arg ...string) Chart {
|
||||||
b.FontSize = kit.Int(m.Option("font-size"))
|
b.FontSize = kit.Int(m.Option("font-size"))
|
||||||
b.Padding = kit.Int(m.Option("padding"))
|
b.Padding = kit.Int(m.Option("padding"))
|
||||||
b.Margin = kit.Int(m.Option("margin"))
|
b.MarginX = kit.Int(m.Option("marginx"))
|
||||||
|
b.MarginY = kit.Int(m.Option("marginy"))
|
||||||
|
|
||||||
// 解析数据
|
// 解析数据
|
||||||
b.data = kit.Parse(nil, "", b.show(m, arg[0])...).(map[string]interface{})
|
b.data = kit.Parse(nil, "", b.show(m, arg[0])...).(map[string]interface{})
|
||||||
@ -181,7 +188,7 @@ func (b *Chain) Init(m *ice.Message, arg ...string) Chart {
|
|||||||
b.max = map[int]int{}
|
b.max = map[int]int{}
|
||||||
b.Height = b.size(m, b.data, 0, b.max) * b.GetHeights()
|
b.Height = b.size(m, b.data, 0, b.max) * b.GetHeights()
|
||||||
for _, v := range b.max {
|
for _, v := range b.max {
|
||||||
b.Width += v
|
b.Width += v + b.MarginX
|
||||||
}
|
}
|
||||||
return b
|
return b
|
||||||
}
|
}
|
||||||
@ -261,17 +268,29 @@ func (b *Chain) draw(m *ice.Message, root map[string]interface{}, depth int, wid
|
|||||||
|
|
||||||
// 当前节点
|
// 当前节点
|
||||||
item := &Block{
|
item := &Block{
|
||||||
BackGround: kit.Select(b.BackGround, kit.Select(p.BackGround)),
|
BackGround: kit.Select(b.BackGround, kit.Select(p.BackGround, meta["bg"])),
|
||||||
FontColor: kit.Select(b.FontColor, kit.Select(p.FontColor)),
|
FontColor: kit.Select(b.FontColor, kit.Select(p.FontColor, meta["fg"])),
|
||||||
FontSize: b.FontSize,
|
FontSize: b.FontSize,
|
||||||
Padding: b.Padding,
|
Padding: b.Padding,
|
||||||
Margin: b.Margin,
|
MarginX: b.MarginX,
|
||||||
|
MarginY: b.MarginY,
|
||||||
}
|
}
|
||||||
if m.Option("compact") != "true" {
|
if m.Option("compact") != "true" {
|
||||||
item.Width = b.max[depth]
|
item.Width = b.max[depth]
|
||||||
}
|
}
|
||||||
|
item.x = x
|
||||||
|
item.y = y + (kit.Int(meta["height"])-1)*b.GetHeights()/2
|
||||||
item.Init(m, kit.Format(meta["text"])).Data(m, meta)
|
item.Init(m, kit.Format(meta["text"])).Data(m, meta)
|
||||||
item.Draw(m, x, y+(kit.Int(meta["height"])-1)*b.GetHeights()/2)
|
item.Draw(m, item.x, item.y)
|
||||||
|
|
||||||
|
if p != nil && p.y != 0 {
|
||||||
|
x1 := p.x + p.GetWidths() - (p.MarginX+item.MarginX)/4
|
||||||
|
y1 := p.y + p.GetHeights()/2
|
||||||
|
x4 := item.x + (p.MarginX+item.MarginX)/4
|
||||||
|
y4 := item.y + item.GetHeights()/2
|
||||||
|
m.Echo(`<path d="M %d,%d Q %d,%d %d,%d T %d %d" stroke=cyan fill=none></path>`,
|
||||||
|
x1, y1, x1+(x4-x1)/4, y1, x1+(x4-x1)/2, y1+(y4-y1)/2, x4, y4)
|
||||||
|
}
|
||||||
|
|
||||||
// 递归节点
|
// 递归节点
|
||||||
h := 0
|
h := 0
|
||||||
|
@ -1,11 +1,25 @@
|
|||||||
package wiki
|
package wiki
|
||||||
|
|
||||||
var title = `<{{.Option "level"}} class="story" data-type="{{.Option "type"}}" data-name="{{.Option "prefix"}}" data-text="{{.Option "text"}}">{{.Option "prefix"}} {{.Option "content"}}</{{.Option "level"}}>`
|
var premenu = `<ul class="story" data-type="premenu"></ul>`
|
||||||
var brief = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
var endmenu = `<ul class="story" data-type="endmenu">{{$menu := .Optionv "menu"}}{{range $index, $value := Value $menu "list"}}
|
||||||
|
<li>{{Value $value "prefix"}} {{Value $value "content"}}</li>{{end}}
|
||||||
|
</ul>`
|
||||||
|
|
||||||
|
var title = `<{{.Option "level"}} class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
|
data-type="{{.Option "type"}}" data-name="{{.Option "prefix"}}" data-text="{{.Option "text"}}"
|
||||||
|
>{{.Option "prefix"}} {{.Option "content"}}</{{.Option "level"}}>`
|
||||||
|
|
||||||
|
var brief = `<p class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
|
>{{.Option "text"}}</p>`
|
||||||
|
|
||||||
var refer = `<ul class="story"
|
var refer = `<ul class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
||||||
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: <a href="{{index $value 1}}" target="_blank">{{index $value 1}}</a></li>{{end}}</ul>`
|
{{range $index, $value := .Optionv "list"}}<li>{{index $value 0}}: <a href="{{index $value 1}}" target="_blank">{{index $value 1}}</a></li>{{end}}</ul>`
|
||||||
var spark = `<p class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
var spark = `<p class="story" {{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}} data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">{{.Option "text"}}</p>`
|
||||||
|
|
||||||
var chart = `<svg class="story" vertion="1.1" xmlns="http://www.w3.org/2000/svg" dominant-baseline="middle" text-anchor="middle"
|
var chart = `<svg class="story" vertion="1.1" xmlns="http://www.w3.org/2000/svg" dominant-baseline="middle" text-anchor="middle"
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
@ -22,18 +36,24 @@ var field = `<fieldset class="story {{.Option "name"}}" data-type="{{.Option "ty
|
|||||||
<div class="status"></div>
|
<div class="status"></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
`
|
`
|
||||||
var shell = `<code class="story" data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "input"}}" data-dir="{{.Option "cmd_dir"}}">$ {{.Option "input"}} # {{.Option "name"}}
|
var shell = `<code class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "input"}}"
|
||||||
|
>$ {{.Option "input"}} # {{.Option "name"}}
|
||||||
{{.Option "output"}}</code>
|
{{.Option "output"}}</code>
|
||||||
`
|
`
|
||||||
var local = `<div class="story"
|
var local = `<code class="story"
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
{{range $index, $value := .Optionv "input"}}{{$value}}{{end}}</div>`
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
|
>{{range $index, $value := .Optionv "input"}}{{$value}}{{end}}</code>`
|
||||||
|
|
||||||
var order = `<ul class="story"
|
var order = `<ul class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
||||||
{{range $index, $value := .Optionv "list"}}<li>{{$value}}</li>{{end}}</ul>`
|
{{range $index, $value := .Optionv "list"}}<li>{{$value}}</li>{{end}}</ul>`
|
||||||
|
|
||||||
var table = `<table class="story"
|
var table = `<table class="story"
|
||||||
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">
|
||||||
<tr>{{range $i, $v := .Optionv "head"}}<th>{{$v}}</th>{{end}}</tr>
|
<tr>{{range $i, $v := .Optionv "head"}}<th>{{$v}}</th>{{end}}</tr>
|
||||||
{{range $index, $value := .Optionv "list"}}
|
{{range $index, $value := .Optionv "list"}}
|
||||||
@ -41,10 +61,12 @@ data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Opti
|
|||||||
{{end}}
|
{{end}}
|
||||||
</table>`
|
</table>`
|
||||||
|
|
||||||
var stack = `<div class="story"
|
var image = `<img class="story"
|
||||||
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}">`
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
|
title="{{.Option "text"}}" src="{{.Option "text"}}">`
|
||||||
|
|
||||||
var premenu = `<ul class="story" data-type="premenu"></ul>`
|
var video = `<video class="story"
|
||||||
var endmenu = `<ul class="story" data-type="endmenu">{{$menu := .Optionv "menu"}}{{range $index, $value := Value $menu "list"}}
|
{{range $k, $v := .Optionv "extra"}}data-{{$k}}='{{$v}}'{{end}}
|
||||||
<li>{{Value $value "prefix"}} {{Value $value "content"}}</li>{{end}}
|
data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Option "text"}}"
|
||||||
</ul>`
|
title="{{.Option "text"}}" src="{{.Option "text"}}" controls></video>`
|
||||||
|
@ -6,24 +6,40 @@ import (
|
|||||||
"github.com/shylinux/icebergs/base/ctx"
|
"github.com/shylinux/icebergs/base/ctx"
|
||||||
"github.com/shylinux/icebergs/base/nfs"
|
"github.com/shylinux/icebergs/base/nfs"
|
||||||
"github.com/shylinux/icebergs/base/ssh"
|
"github.com/shylinux/icebergs/base/ssh"
|
||||||
|
"github.com/shylinux/icebergs/base/web"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
"github.com/skip2/go-qrcode"
|
||||||
|
|
||||||
|
"bytes"
|
||||||
|
"encoding/base64"
|
||||||
"fmt"
|
"fmt"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func _option(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
|
m.Option(kit.MDB_TYPE, kind)
|
||||||
|
m.Option(kit.MDB_NAME, name)
|
||||||
|
m.Option(kit.MDB_TEXT, text)
|
||||||
|
|
||||||
|
extra := kit.Dict()
|
||||||
|
m.Optionv(kit.MDB_EXTRA, extra)
|
||||||
|
for i := 0; i < len(arg); i += 2 {
|
||||||
|
extra[arg[i]] = kit.Format(kit.Parse(nil, "", kit.Split(arg[i+1])...))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func _title_show(m *ice.Message, kind, text string, arg ...string) {
|
func _title_show(m *ice.Message, kind, text string, arg ...string) {
|
||||||
title, _ := m.Optionv(TITLE).(map[string]int)
|
title, _ := m.Optionv(TITLE).(map[string]int)
|
||||||
switch kind {
|
switch kind {
|
||||||
case ENDMENU:
|
|
||||||
// 后置目录
|
|
||||||
m.Render(ice.RENDER_TEMPLATE, endmenu)
|
|
||||||
return
|
|
||||||
case PREMENU:
|
case PREMENU:
|
||||||
// 前置目录
|
// 前置目录
|
||||||
m.Render(ice.RENDER_TEMPLATE, premenu)
|
m.Render(ice.RENDER_TEMPLATE, premenu)
|
||||||
return
|
return
|
||||||
|
case ENDMENU:
|
||||||
|
// 后置目录
|
||||||
|
m.Render(ice.RENDER_TEMPLATE, endmenu)
|
||||||
|
return
|
||||||
case SECTION:
|
case SECTION:
|
||||||
// 分节标题
|
// 分节标题
|
||||||
title[SECTION]++
|
title[SECTION]++
|
||||||
@ -41,11 +57,6 @@ func _title_show(m *ice.Message, kind, text string, arg ...string) {
|
|||||||
m.Option("prefix", "")
|
m.Option("prefix", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 基本参数
|
|
||||||
m.Option(kit.MDB_TYPE, TITLE)
|
|
||||||
m.Option(kit.MDB_NAME, text)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
// 添加目录
|
// 添加目录
|
||||||
menu, _ := m.Optionv("menu").(map[string]interface{})
|
menu, _ := m.Optionv("menu").(map[string]interface{})
|
||||||
menu["list"] = append(menu["list"].([]interface{}), map[string]interface{}{
|
menu["list"] = append(menu["list"].([]interface{}), map[string]interface{}{
|
||||||
@ -55,34 +66,28 @@ func _title_show(m *ice.Message, kind, text string, arg ...string) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// 渲染引擎
|
// 渲染引擎
|
||||||
|
_option(m, TITLE, text, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(TITLE, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(TITLE, "meta.template"))
|
||||||
}
|
}
|
||||||
func _brief_show(m *ice.Message, name, text string, arg ...string) {
|
func _brief_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, BRIEF)
|
_option(m, BRIEF, name, text, arg...)
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
// 渲染引擎
|
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(BRIEF, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(BRIEF, "meta.template"))
|
||||||
}
|
}
|
||||||
func _refer_show(m *ice.Message, name, text string, arg ...string) {
|
func _refer_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, REFER)
|
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
list := [][]string{}
|
list := [][]string{}
|
||||||
for _, v := range kit.Split(strings.TrimSpace(text), "\n") {
|
for _, v := range kit.Split(strings.TrimSpace(text), "\n") {
|
||||||
list = append(list, kit.Split(v, " "))
|
list = append(list, kit.Split(v, " "))
|
||||||
}
|
}
|
||||||
m.Optionv("list", list)
|
m.Optionv("list", list)
|
||||||
|
|
||||||
|
_option(m, REFER, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(REFER, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(REFER, "meta.template"))
|
||||||
}
|
}
|
||||||
func _spark_show(m *ice.Message, name, text string, arg ...string) {
|
func _spark_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, SPARK)
|
text = strings.TrimSpace(text)
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
m.Optionv("list", kit.Split(text, "\n"))
|
m.Optionv("list", kit.Split(text, "\n"))
|
||||||
|
|
||||||
|
_option(m, SPARK, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(SPARK, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(SPARK, "meta.template"))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +118,8 @@ func _chart_show(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
m.Option("compact", "false")
|
m.Option("compact", "false")
|
||||||
m.Option("stroke-width", "2")
|
m.Option("stroke-width", "2")
|
||||||
m.Option("padding", "10")
|
m.Option("padding", "10")
|
||||||
m.Option("margin", "10")
|
m.Option("marginx", "10")
|
||||||
|
m.Option("marginy", "10")
|
||||||
// m.Option("font-family", kit.Select("", "monospace", len(text) == len([]rune(text))))
|
// m.Option("font-family", kit.Select("", "monospace", len(text) == len([]rune(text))))
|
||||||
m.Option("font-family", "monospace")
|
m.Option("font-family", "monospace")
|
||||||
for i := 0; i < len(arg)-1; i++ {
|
for i := 0; i < len(arg)-1; i++ {
|
||||||
@ -165,36 +171,22 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
|
|||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(FIELD, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(FIELD, "meta.template"))
|
||||||
}
|
}
|
||||||
func _shell_show(m *ice.Message, name, text string, arg ...string) {
|
func _shell_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, SHELL)
|
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
// 渲染引擎
|
|
||||||
m.Option("output", m.Cmdx(cli.SYSTEM, "sh", "-c", m.Option("input", text)))
|
m.Option("output", m.Cmdx(cli.SYSTEM, "sh", "-c", m.Option("input", text)))
|
||||||
|
_option(m, SHELL, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(SHELL, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(SHELL, "meta.template"))
|
||||||
}
|
}
|
||||||
func _local_show(m *ice.Message, name, text string, arg ...string) {
|
func _local_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, LOCAL)
|
m.Option("input", m.Cmdx(nfs.CAT, text))
|
||||||
m.Option(kit.MDB_NAME, name)
|
_option(m, LOCAL, name, text, arg...)
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
m.Option("input", m.Cmdx("nfs.cat", text))
|
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(LOCAL, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(LOCAL, "meta.template"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func _order_show(m *ice.Message, name, text string, arg ...string) {
|
func _order_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, ORDER)
|
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
m.Optionv("list", kit.Split(strings.TrimSpace(text), "\n"))
|
m.Optionv("list", kit.Split(strings.TrimSpace(text), "\n"))
|
||||||
|
_option(m, ORDER, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(ORDER, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(ORDER, "meta.template"))
|
||||||
}
|
}
|
||||||
func _table_show(m *ice.Message, name, text string, arg ...string) {
|
func _table_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, TABLE)
|
|
||||||
m.Option(kit.MDB_NAME, name)
|
|
||||||
m.Option(kit.MDB_TEXT, text)
|
|
||||||
|
|
||||||
head, list := []string{}, [][]string{}
|
head, list := []string{}, [][]string{}
|
||||||
for i, v := range kit.Split(strings.TrimSpace(text), "\n") {
|
for i, v := range kit.Split(strings.TrimSpace(text), "\n") {
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
@ -221,17 +213,17 @@ func _table_show(m *ice.Message, name, text string, arg ...string) {
|
|||||||
}
|
}
|
||||||
m.Optionv("head", head)
|
m.Optionv("head", head)
|
||||||
m.Optionv("list", list)
|
m.Optionv("list", list)
|
||||||
|
|
||||||
|
_option(m, TABLE, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(TABLE, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(TABLE, "meta.template"))
|
||||||
}
|
}
|
||||||
func _stack_show(m *ice.Message, name, text string, arg ...string) {
|
func _image_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
m.Option(kit.MDB_TYPE, STACK)
|
_option(m, IMAGE, name, text, arg...)
|
||||||
m.Option(kit.MDB_NAME, name)
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(IMAGE, "meta.template"))
|
||||||
m.Option(kit.MDB_TEXT, text)
|
}
|
||||||
|
func _video_show(m *ice.Message, name, text string, arg ...string) {
|
||||||
chain := &Chain{}
|
_option(m, VIDEO, name, text, arg...)
|
||||||
m.Render(ice.RENDER_TEMPLATE, m.Conf(STACK, "meta.template"))
|
m.Render(ice.RENDER_TEMPLATE, m.Conf(VIDEO, "meta.template"))
|
||||||
Stack(m, STACK, 0, kit.Parse(nil, "", chain.show(m, text)...))
|
|
||||||
m.Echo("</div>")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func _word_show(m *ice.Message, name string, arg ...string) {
|
func _word_show(m *ice.Message, name string, arg ...string) {
|
||||||
@ -244,8 +236,6 @@ func _word_show(m *ice.Message, name string, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
WORD = "word"
|
|
||||||
|
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
BRIEF = "brief"
|
BRIEF = "brief"
|
||||||
REFER = "refer"
|
REFER = "refer"
|
||||||
@ -258,48 +248,51 @@ const (
|
|||||||
|
|
||||||
ORDER = "order"
|
ORDER = "order"
|
||||||
TABLE = "table"
|
TABLE = "table"
|
||||||
STACK = "stack"
|
IMAGE = "image"
|
||||||
|
VIDEO = "video"
|
||||||
|
|
||||||
|
PREMENU = "premenu"
|
||||||
CHAPTER = "chapter"
|
CHAPTER = "chapter"
|
||||||
SECTION = "section"
|
SECTION = "section"
|
||||||
ENDMENU = "endmenu"
|
ENDMENU = "endmenu"
|
||||||
PREMENU = "premenu"
|
|
||||||
|
|
||||||
LABEL = "label"
|
LABEL = "label"
|
||||||
CHAIN = "chain"
|
CHAIN = "chain"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const WORD = "word"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
TITLE: {Name: "title", Help: "标题", Value: kit.Data("template", title)},
|
TITLE: {Name: TITLE, Help: "标题", Value: kit.Data("template", title)},
|
||||||
BRIEF: {Name: "brief", Help: "摘要", Value: kit.Data("template", brief)},
|
BRIEF: {Name: BRIEF, Help: "摘要", Value: kit.Data("template", brief)},
|
||||||
REFER: {Name: "refer", Help: "参考", Value: kit.Data("template", refer)},
|
REFER: {Name: REFER, Help: "参考", Value: kit.Data("template", refer)},
|
||||||
SPARK: {Name: "spark", Help: "段落", Value: kit.Data("template", spark)},
|
SPARK: {Name: SPARK, Help: "段落", Value: kit.Data("template", spark)},
|
||||||
|
|
||||||
CHART: {Name: "chart", Help: "图表", Value: kit.Data("template", chart, "suffix", `</svg>`)},
|
CHART: {Name: CHART, Help: "图表", Value: kit.Data("template", chart, "suffix", `</svg>`)},
|
||||||
FIELD: {Name: "field", Help: "插件", Value: kit.Data("template", field)},
|
FIELD: {Name: FIELD, Help: "插件", Value: kit.Data("template", field)},
|
||||||
SHELL: {Name: "shell", Help: "命令", Value: kit.Data("template", shell)},
|
SHELL: {Name: SHELL, Help: "命令", Value: kit.Data("template", shell)},
|
||||||
LOCAL: {Name: "local", Help: "文件", Value: kit.Data("template", local)},
|
LOCAL: {Name: LOCAL, Help: "文件", Value: kit.Data("template", local)},
|
||||||
|
|
||||||
ORDER: {Name: "order", Help: "列表", Value: kit.Data("template", order)},
|
ORDER: {Name: ORDER, Help: "列表", Value: kit.Data("template", order)},
|
||||||
TABLE: {Name: "table", Help: "表格", Value: kit.Data("template", table)},
|
TABLE: {Name: TABLE, Help: "表格", Value: kit.Data("template", table)},
|
||||||
STACK: {Name: "stack", Help: "结构", Value: kit.Data("template", stack)},
|
IMAGE: {Name: IMAGE, Help: "图片", Value: kit.Data("template", image)},
|
||||||
|
VIDEO: {Name: VIDEO, Help: "视频", Value: kit.Data("template", video)},
|
||||||
|
|
||||||
WORD: {Name: "word", Help: "语言文字", Value: kit.Data(kit.MDB_SHORT, "name",
|
WORD: {Name: WORD, Help: "语言文字", Value: kit.Data(
|
||||||
"path", "usr", "regs", ".*\\.shy", "alias", map[string]interface{}{
|
"path", "usr", "regs", ".*\\.shy", "alias", map[string]interface{}{
|
||||||
|
PREMENU: []interface{}{TITLE, PREMENU},
|
||||||
|
CHAPTER: []interface{}{TITLE, CHAPTER},
|
||||||
|
SECTION: []interface{}{TITLE, SECTION},
|
||||||
|
ENDMENU: []interface{}{TITLE, ENDMENU},
|
||||||
LABEL: []interface{}{CHART, LABEL},
|
LABEL: []interface{}{CHART, LABEL},
|
||||||
CHAIN: []interface{}{CHART, CHAIN},
|
CHAIN: []interface{}{CHART, CHAIN},
|
||||||
|
|
||||||
SECTION: []interface{}{TITLE, SECTION},
|
|
||||||
CHAPTER: []interface{}{TITLE, CHAPTER},
|
|
||||||
ENDMENU: []interface{}{TITLE, ENDMENU},
|
|
||||||
PREMENU: []interface{}{TITLE, PREMENU},
|
|
||||||
},
|
},
|
||||||
)},
|
)},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
TITLE: {Name: "title [chapter|section|endmenu|premenu] text", Help: "标题", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
TITLE: {Name: "title [premenu|chapter|section|endmenu] text", Help: "标题", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
ns := strings.Split(cli.NodeName, "-")
|
ns := strings.Split(cli.NodeName, "-")
|
||||||
arg = append(arg, kit.Select(ns[len(ns)-1], ""))
|
arg = append(arg, kit.Select(ns[len(ns)-1], ""))
|
||||||
@ -307,9 +300,9 @@ func init() {
|
|||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
arg = append(arg, arg[0])
|
arg = append(arg, arg[0])
|
||||||
}
|
}
|
||||||
_title_show(m, arg[0], arg[1], arg[2:]...)
|
_title_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
BRIEF: {Name: "brief name text", Help: "摘要", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
BRIEF: {Name: "brief [name] text", Help: "摘要", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Echo(`<br class="story" data-type="brief">`)
|
m.Echo(`<br class="story" data-type="brief">`)
|
||||||
return
|
return
|
||||||
@ -317,12 +310,12 @@ func init() {
|
|||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
arg = []string{"", arg[0]}
|
arg = []string{"", arg[0]}
|
||||||
}
|
}
|
||||||
_brief_show(m, arg[0], arg[1], arg[2:]...)
|
_brief_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
REFER: {Name: "refer name `[name url]...`", Help: "参考", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
REFER: {Name: "refer name `[name url]...`", Help: "参考", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_refer_show(m, arg[0], arg[1], arg[2:]...)
|
_refer_show(m, arg[0], arg[1], arg[2:]...)
|
||||||
}},
|
}},
|
||||||
SPARK: {Name: "spark name text", Help: "感悟", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
SPARK: {Name: "spark [name] text", Help: "感悟", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Echo(`<br class="story" data-type="spark">`)
|
m.Echo(`<br class="story" data-type="spark">`)
|
||||||
return
|
return
|
||||||
@ -330,7 +323,7 @@ func init() {
|
|||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
arg = []string{"", arg[0]}
|
arg = []string{"", arg[0]}
|
||||||
}
|
}
|
||||||
_spark_show(m, arg[0], arg[1], arg[2:]...)
|
_spark_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
CHART: {Name: "chart label|chain name text arg...", Help: "图表", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
CHART: {Name: "chart label|chain name text arg...", Help: "图表", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
@ -343,33 +336,64 @@ func init() {
|
|||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_field_show(m, arg[0], arg[1], arg[2:]...)
|
_field_show(m, arg[0], arg[1], arg[2:]...)
|
||||||
}},
|
}},
|
||||||
SHELL: {Name: "shell name cmd", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
SHELL: {Name: "shell [name] cmd", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_shell_show(m, arg[0], arg[1])
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_shell_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
LOCAL: {Name: "local name text", Help: "文件", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
LOCAL: {Name: "local [name] text", Help: "文件", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_local_show(m, arg[0], arg[1])
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_local_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
ORDER: {Name: "order name text", Help: "列表", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
ORDER: {Name: "order name `[item \n]...`", Help: "列表", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_order_show(m, arg[0], arg[1], arg[2:]...)
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_order_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
TABLE: {Name: "table name text", Help: "表格", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
TABLE: {Name: "table name `[item item\n]...`", Help: "表格", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_table_show(m, arg[0], arg[1], arg[2:]...)
|
if arg[0] == "cmd" {
|
||||||
|
msg := m.Cmd(kit.Split(arg[1])).Table()
|
||||||
|
arg[1] = msg.Result()
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_table_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
STACK: {Name: "stack name text", Help: "结构", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
IMAGE: {Name: "image name url", Help: "图片", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
_stack_show(m, arg[0], arg[1], arg[2:]...)
|
if arg[0] == "qrcode" {
|
||||||
|
buf := bytes.NewBuffer(make([]byte, 0, 4096))
|
||||||
|
if qr, e := qrcode.New(arg[1], qrcode.Medium); m.Assert(e) {
|
||||||
|
m.Assert(qr.Write(kit.Int(kit.Select("256")), buf))
|
||||||
|
}
|
||||||
|
arg[1] = "data:image/png;base64," + base64.StdEncoding.EncodeToString(buf.Bytes())
|
||||||
|
}
|
||||||
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_image_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
|
}},
|
||||||
|
VIDEO: {Name: "video name url", Help: "视频", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if len(arg) == 1 {
|
||||||
|
arg = []string{"", arg[0]}
|
||||||
|
}
|
||||||
|
_video_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
WORD: {Name: "word path=demo/hi.shy auto", Help: "语言文字", Meta: kit.Dict(
|
WORD: {Name: "word path=demo/hi.shy auto", Help: "语言文字", Meta: kit.Dict(
|
||||||
"display", "/plugin/local/wiki/word.js",
|
"display", "/plugin/local/wiki/word.js",
|
||||||
), Action: map[string]*ice.Action{
|
), Action: map[string]*ice.Action{
|
||||||
"story": {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
web.STORY: {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(arg[0], "action", "run", arg[1:])
|
m.Cmdy(arg[0], "action", "run", arg[1:])
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Option(nfs.DIR_DEEP, "true")
|
if m.Option(nfs.DIR_DEEP, "true"); reply(m, cmd, arg...) {
|
||||||
if reply(m, cmd, arg...) {
|
|
||||||
// 目录列表
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_word_show(m, arg[0])
|
_word_show(m, arg[0])
|
||||||
|
@ -275,8 +275,8 @@ var Index = &ice.Context{Name: "git", Help: "代码库",
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"trend": {Name: "trend repos=auto begin_time=@date auto", Help: "趋势图", Meta: kit.Dict(
|
"trend": {Name: "trend name=auto begin_time=@date auto", Help: "趋势图", Meta: kit.Dict(
|
||||||
"display", "/plugin/local/story/trend.js",
|
"display", "/plugin/story/trend.js",
|
||||||
), 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 {
|
||||||
m.Option("_display", "table")
|
m.Option("_display", "table")
|
||||||
@ -284,8 +284,8 @@ var Index = &ice.Context{Name: "git", Help: "代码库",
|
|||||||
m.Cmdy("total", arg)
|
m.Cmdy("total", arg)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"spide": {Name: "spide repos=auto begin_time=@date auto", Help: "趋势图", Meta: kit.Dict(
|
"spide": {Name: "spide name=auto auto", Help: "趋势图", Meta: kit.Dict(
|
||||||
"display", "/plugin/local/story/trend.js",
|
"display", "/plugin/story/spide.js",
|
||||||
), 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 {
|
||||||
m.Option("_display", "table")
|
m.Option("_display", "table")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user