mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-04 18:19:54 +00:00
Hacky fix for capitalization
This commit is contained in:
parent
ceff8ad91b
commit
dd40d7ea37
@ -43,6 +43,9 @@ var (
|
||||
TelegramEnabled bool
|
||||
TelegramBotToken string
|
||||
TelegramBotName string
|
||||
|
||||
ReplaceFrom []string
|
||||
ReplaceTo []string
|
||||
)
|
||||
|
||||
// WikiDir is a full path to the wiki storage directory, which also must be a
|
||||
@ -59,6 +62,8 @@ type Config struct {
|
||||
Authorization
|
||||
CustomScripts `comment:"You can specify additional scripts to load on different kinds of pages, delimited by a comma ',' sign."`
|
||||
Telegram `comment:"You can enable Telegram authorization. Follow these instructions: https://core.telegram.org/widgets/login#setting-up-a-bot"`
|
||||
ReplaceFrom []string
|
||||
ReplaceTo []string
|
||||
}
|
||||
|
||||
// Hyphae is a section of Config which has fields related to special hyphae.
|
||||
@ -191,6 +196,8 @@ func ReadConfigFile(path string) error {
|
||||
TelegramBotToken = cfg.TelegramBotToken
|
||||
TelegramBotName = cfg.TelegramBotName
|
||||
TelegramEnabled = (TelegramBotToken != "") && (TelegramBotName != "")
|
||||
ReplaceFrom = cfg.ReplaceFrom
|
||||
ReplaceTo = cfg.ReplaceTo
|
||||
|
||||
// This URL makes much more sense. If no URL is set or the protocol is forgotten, assume HTTP.
|
||||
if URL == "" {
|
||||
|
@ -56,7 +56,11 @@ func RandomString(n int) (string, error) {
|
||||
// BeautifulName makes the ugly name beautiful by replacing _ with spaces and using title case.
|
||||
func BeautifulName(uglyName string) string {
|
||||
// Why not reuse
|
||||
return util.BeautifulName(uglyName)
|
||||
result := util.BeautifulName(uglyName)
|
||||
for i, replace := range cfg.ReplaceFrom {
|
||||
result = strings.ReplaceAll(result, replace, cfg.ReplaceTo[i])
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// CanonicalName makes sure the `name` is canonical. A name is canonical if it is lowercase and all spaces are replaced with underscores.
|
||||
|
Loading…
Reference in New Issue
Block a user