-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.go
executable file
·60 lines (52 loc) · 1.38 KB
/
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
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"log"
)
type Config struct {
Language string //en,cn
TemplateFile string // the template file with hole to put render result in
//GenerateTitle bool //main title and sub title
//GenerateMeta bool //create date, modify date, keywords
}
var gConfig = Config{
Language: "cn",
}
var gLanguageKeywordName = map[string]map[string]string{
"cn": gKeywordNameCn,
"en": gKeywordNameEn,
}
var gKeywordNameCn = map[string]string{
OrderList: "有序列表",
BulletList: "无序列表",
TableKeyword: "表格",
BlockCode: "代码",
BlockTex: "数学公式",
ImageKeyword: "图",
AuthorKeyword: "作者",
CreateDateKeyword: "创建日期",
ModifyDateKeyword: "修改日期",
KeywordsKeyword: "关键词",
}
var gKeywordNameEn = map[string]string{
OrderList: "Ordered-List",
BulletList: "Bullet-List",
TableKeyword: "Table",
BlockCode: "Code",
BlockTex: "Math",
ImageKeyword: "Figure",
AuthorKeyword: "Author",
CreateDateKeyword: "Create-Date",
ModifyDateKeyword: "Modify-Date",
KeywordsKeyword: "Keywords",
}
func getKeywordName(keyword string) string {
prefixMap, ok := gLanguageKeywordName[gConfig.Language]
if !ok {
log.Fatal("not supported language")
}
prefix, ok := prefixMap[keyword]
if !ok {
log.Fatal("not supported keyword")
}
return prefix
}