-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
47 lines (41 loc) · 963 Bytes
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"log"
)
type Config struct {
Language string //en,cn
GenerateTitle bool //main title and sub title
GenerateMeta bool //create date, modify date, keywords
}
var GConfig = Config{
Language: "cn",
}
var gLanguageCaptionPrefix = map[string]map[string]string{
"cn": gCaptionPrefixCn,
"en": gCaptionPrefixEn,
}
var gCaptionPrefixCn = map[string]string{
OrderList: "有序列表",
BulletList: "无序列表",
TableKeyword: "表格",
BlockCode: "代码",
ImageKeyword: "图",
}
var gCaptionPrefixEn = map[string]string{
OrderList: "Ordered-List",
BulletList: "Bullet-List",
TableKeyword: "Table",
BlockCode: "Code",
ImageKeyword: "Figure",
}
func getCaptionPrefix(keyword string) string {
prefixMap, ok := gLanguageCaptionPrefix[GConfig.Language]
if !ok {
log.Fatal("should not reach here ")
}
prefix, ok := prefixMap[keyword]
if !ok {
log.Fatal("should not reach here")
}
return prefix
}