-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst.go
137 lines (129 loc) · 7.46 KB
/
const.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
package main
import (
_ "embed"
"regexp"
"time"
)
const (
appVersion = "1.6.1"
defaultGitHubRepoUrl = "github.com/kion/mbgen"
defaultGitHubRepoThemesUrl = defaultGitHubRepoUrl + "/themes"
defaultGitHubRepoPageContentSamplesUrl = defaultGitHubRepoUrl + "/content-samples/pages"
defaultGitHubRepoPostContentSamplesUrl = defaultGitHubRepoUrl + "/content-samples/posts"
defaultGitHubRepoDeployDirContentSamplesUrl = defaultGitHubRepoUrl + "/content-samples/deploy"
themesDirName = "themes"
resourcesDirName = "resources"
templatesDirName = "templates"
includeDirName = "include"
templateFileExtension = ".html"
mainTemplateFileName = "main" + templateFileExtension
pageTemplateFileName = "page" + templateFileExtension
postTemplateFileName = "post" + templateFileExtension
mediaTemplateFileName = "media" + templateFileExtension
archiveTemplateFileName = "archive" + templateFileExtension
tagIndexTemplateFileName = "tag-index" + templateFileExtension
searchTemplateFileName = "search" + templateFileExtension
pagerTemplateFileName = "pager" + templateFileExtension
contentDirectiveTemplateFileNameFormat = "content-%s" + templateFileExtension
contentFileExtension = ".html"
indexPageFileName = "index" + contentFileExtension
searchPageFileName = "search" + contentFileExtension
searchIndexFileName = "search.json"
searchJSFileName = "search.js"
directivePlaceholderReplacementFormat = ":@@@:%s:@@@:"
hashTagMarkdownReplacementFormat = "[#%s](/" + deployTagsDirName + "/%s/)"
markdownPagesDirName = "pages"
markdownPostsDirName = "posts"
markdownFileExtension = ".md"
mediaDirName = "media"
deployDirName = "deploy"
deployPostDirName = "post"
deployPostsDirName = "posts"
deployPageDirName = "page"
deployArchiveDirName = "archive"
deployTagsDirName = "tags"
metaDataKeyDate = "date"
metaDataKeyTime = "time"
metaDataKeyTitle = "title"
metaDataKeyTags = "tags"
configFileName = "config.yml"
defaultGenerateArchive = true
defaultGenerateTagIndex = true
defaultEnableSearch = true
defaultPageSize = 10
defaultResizeOrigImages = false
defaultMaxImgSize = 1920
minAllowedMaxImgSize = 1080
minAllowedThumbWidth = 320
minAllowedThumbThreshold = 0.3
defaultThumbThreshold = 0.5
defaultJPEGQuality = 85
minAllowedJPEGQuality = 70
maxAllowedJPEGQuality = 100
defaultPNGCompressionLevel = DefaultCompression
defaultUseThumbs = true
defaultServeHost = "localhost"
defaultServePort = 8888
thumbImgFileSuffix = "_thumb"
pageHeadIncludePrefix = "page-head--"
defaultThemeName = "pretty-dark"
defaultThemeAlias = "default"
downloadedThemeDirSuffix = "-downloaded"
pageHeadTemplatePlaceholder = "{{@ page-head @}}"
subTemplatePlaceholder = "{{@ sub-template @}}"
commandInspectOptionFix = "--fix"
commandCleanupTargetContent = "content"
commandCleanupTargetThumbs = "thumbs"
commandCleanupTargetTags = "tags"
commandCleanupTargetTagIndex = "tag-index"
commandCleanupTargetArchive = "archive"
commandCleanupTargetSearch = "search"
commandServeOptionAdmin = "--admin"
commandServeOptionWatchReload = "--watch-reload"
commandThemeActionActivate = "activate"
commandThemeActionInstall = "install"
commandThemeActionUpdate = "update"
commandThemeActionRefresh = "refresh"
commandThemeActionDelete = "delete"
httpProtocol = "http://"
httpsProtocol = "https://"
websocketProtocol = "ws://"
websocketPath = "/--ws--"
websocketPingPeriod = 60 * time.Second
jsOpeningTag = "<script type='text/javascript'>"
jsClosingTag = "</script>"
styleOpeningTag = "<style>"
styleClosingTag = "</style>"
headClosingTag = "</head>"
bodyClosingTag = "</body>"
mainOpeningTag = "<main>"
mainClosingTag = "</main>"
)
var (
defaultThumbSizes = /* const */ []int{480, 960}
thumbImgFileNameRegexp = /* const */ regexp.MustCompile(`_(\d+)` + thumbImgFileSuffix)
imageFileExtensions = /* const */ []string{".jpg", ".jpeg", ".png", ".gif"}
thumbImageFileExtensions = /* const */ []string{".jpg", ".jpeg", ".png"}
videoFileExtensions = /* const */ []string{".mp4", ".mkv", ".mov"}
metaDataPlaceholderRegexp = /* const */ regexp.MustCompile(`---[\s\w-:"]*---`)
contentDirectivePlaceholderRegexp = /* const */ regexp.MustCompile(`{.*}`)
whitespacePlaceholderRegexp = /* const */ regexp.MustCompile(`\s+`)
includeTemplateFilePlaceholderRegexp = /* const */ regexp.MustCompile(`{{@\s*([\w-_]+\.html)\s*@}}`)
includeContentFilePlaceholderRegexp = /* const */ regexp.MustCompile(`{{#\s*([\w-_]+\.html)\s*#}}`)
searchLinkPlaceholderRegexp = /* const */ regexp.MustCompile(`{%\s*search\s*:\s*([^{}%]+)\s*%}`)
contentLinkPlaceholderRegexp = /* const */ regexp.MustCompile(`{%\s*([\w-_]+)\s*:\s*([\w-_]+)\s*%}`)
mediaPlaceholderRegexp = /* const */ regexp.MustCompile(`{\s*media(\([\s\w=,]+\))?(\s*:\s*([\w\s-_.,*]+))?\s*}`)
embedMediaPlaceholderRegexp = /* const */ regexp.MustCompile(`{\s*embed\s*:\s*([^}]+)\s*}`)
wrapPlaceholderRegexp = /* const */ regexp.MustCompile(`\{\s*([\w-_.]+)\s*(\([\s\w=,]+\))?(\s*:\s*([\w\s-_.,*]+))?\s*}([^{}]*){/}`)
hashTagRegex = /* const */ regexp.MustCompile(`#(\p{L}+[_-]*\p{L}*)`)
)
//go:embed inject-js/admin.js
var adminJS string
//go:embed inject-js/watch-reload.js
var watchReloadJS string
//go:embed inject-js/search.js
var searchJS string
//go:embed inject-js/easymde.min.js
var mdEditorJS string
//go:embed inject-css/easymde.min.css
var mdEditorCSS string