diff --git a/.gitignore b/.gitignore index c450f48..78f1d86 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ mycorrhiza +demo diff --git a/cfg/config.go b/cfg/config.go index e4eb3b0..548d5d7 100644 --- a/cfg/config.go +++ b/cfg/config.go @@ -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 == "" { diff --git a/l18n/en/auth.json b/l18n/en/auth.json index 307420a..39d728a 100644 --- a/l18n/en/auth.json +++ b/l18n/en/auth.json @@ -18,7 +18,7 @@ "lock_title": "Locked", "password_tip": "The server stores your password in an encrypted form; even administrators cannot read it.", - "cookie_tip": "By submitting this form you give this wiki a permission to store cookies in your browser. It lets the engine associate your edits with you. You will stay logged in until you log out.", + "cookie_tip": "By submitting this form you give this wiki your soul, thoughts and mind. It lets the engine associate your edits with you. You will stay logged in until you log out.", "telegram_tip": "You can log in using Telegram. It only works if you have set your @username in Telegram and this username is free on this wiki.", "noauth": "Authentication is disabled. You can make edits anonymously.", diff --git a/l18n/en/ui.json b/l18n/en/ui.json index 8350b05..b68427d 100644 --- a/l18n/en/ui.json +++ b/l18n/en/ui.json @@ -11,47 +11,47 @@ "delete_link": "Delete", "text_link": "View markup", "media_link": "Manage media", - "media_link_for_textual": "Turn to media hypha", + "media_link_for_textual": "Turn to media page", "backlinks_link": "{{.n}} backlink%s", "backlinks_link+one": "", "backlinks_link+other": "s", - "subhyphae": "Subhyphae", + "subhyphae": "Subpages", - "random_no_hyphae": "There are no hyphae", - "random_no_hyphae_tip": "It is impossible to display a random hypha because the wiki does not contain any hyphae", + "random_no_hyphae": "There are no pages", + "random_no_hyphae_tip": "It is impossible to display a random page because the wiki does not contain any pages", "error": "Error", "error_text_fetch": "Could not fetch text data", "error_try_again": "Try again", - "error_go_back": "Go back to the hypha.", + "error_go_back": "Go back to the page.", "ask_rename": "Rename %s", "rename_to": "New name", - "rename_recurse": "Rename subhyphae too", - "rename_tip": "If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.", + "rename_recurse": "Rename subpages too", + "rename_tip": "If you rename this page, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.", "rename_taken": "Name taken", - "rename_taken_tip": "Hypha named {{.name}} already exists, cannot rename", + "rename_taken_tip": "page named {{.name}} already exists, cannot rename", "rename_noname": "No name given", "rename_noname_tip": "No new name is given", "rename_badname": "Invalid name", "rename_badname_tip": "Invalid new name. Names cannot contain characters {{.chars}}.", "act_no_media": "No media", - "act_no_media_tip": "Cannot remove media because this is not a media hypha", + "act_no_media_tip": "Cannot remove media because this is not a media page", "act_norights": "Not enough rights", "act_notexist": "Does not exist", "act_norights_delete": "Not enough rights to delete, you must be a moderator", - "act_notexist_delete": "Cannot delete this hypha because it does not exist", + "act_notexist_delete": "Cannot delete this page because it does not exist", "act_norights_rename": "Not enough rights to rename, you must be a trusted editor", - "act_notexist_rename": "Cannot rename this hypha because it does not exist", + "act_notexist_rename": "Cannot rename this page because it does not exist", "act_norights_remove_media": "Not enough rights to remove media, you must be a trusted editor", - "act_notexist_remove_media": "Cannot remove media because this hypha does not exist", - "act_norights_edit": "You must be an editor to edit a hypha", + "act_notexist_remove_media": "Cannot remove media because this page does not exist", + "act_norights_edit": "You must be an editor to edit a page", "act_norights_upload_media": "You must be an editor to upload media", "ask_remove_media": "Remove media from %s?", - "ask_really": "Do you really want to {{.verb}} hypha {{.name}}?", + "ask_really": "Do you really want to {{.verb}} page {{.name}}?", "ask_delete_verb": "delete", "ask_remove_media_verb": "remove_media", @@ -60,14 +60,14 @@ "revision_title": "{{.name}} at {{.rev}}", "revision_warning": "Please note that viewing media is not supported in history for now.", "revision_link": "Get Mycomarkup source of this revision", - "revision_no_text": "This hypha had no text at this revision.", + "revision_no_text": "This page had no text at this revision.", "about_title": "About {{.name}}", "users_title": "User list", "no_rights": "Not enough rights", - "reindex_no_rights": "You must be an admin to reindex hyphae.", + "reindex_no_rights": "You must be an admin to reindex pages.", "header_no_rights": "You must be a moderator to update header links.", "media_download": "Download media", @@ -77,8 +77,8 @@ "media_noaudio_link": "Download audio", "media_title": "Media of {{.name}}", - "media_empty": "This hypha has no media, you can upload it here.", - "media_tip": "You can manage the hypha's media on this page.", + "media_empty": "This page has no media, you can upload it here.", + "media_tip": "You can manage the page's media on this page.", "media_what_is": "What is media?", "media_upload": "Upload", "media_stat": "Stat", @@ -88,7 +88,7 @@ "media_size_value+other": "s", "media_stat_mime": "MIME type:", "media_include": "Include", - "media_include_tip": "This media is an image. To include it in a hypha, use a syntax like this:", + "media_include_tip": "This media is an image. To include it in a page, use a syntax like this:", "media_new": "media", "media_new_tip": "You can upload a new media. Please do not upload too big pictures unless you need to because may not want to wait for big pictures to load.", "media_remove": "Remove media", diff --git a/mimetype/mime.go b/mimetype/mime.go index ac5bbff..7b673a4 100644 --- a/mimetype/mime.go +++ b/mimetype/mime.go @@ -50,6 +50,8 @@ var mapMime2Ext = map[string]string{ "video/webm": "webm", "audio/mp3": "mp3", "video/mp4": "mp4", + "application/pdf": "pdf", + "audio/mpeg": "mp3", } var mapExt2Mime = map[string]string{ @@ -65,4 +67,5 @@ var mapExt2Mime = map[string]string{ ".webm": "video/webm", ".mp3": "audio/mp3", ".mp4": "video/mp4", + ".pdf": "application/pdf", } diff --git a/mycoopts/view.qtpl b/mycoopts/view.qtpl index 935e4de..cfc43e4 100644 --- a/mycoopts/view.qtpl +++ b/mycoopts/view.qtpl @@ -28,7 +28,7 @@

{%s lc.Get("ui.media_noaudio") %} {%s lc.Get("ui.media_noaudio_link") %}

- + {% default %}

{%s lc.Get("ui.media_download") %}

diff --git a/mycoopts/view.qtpl.go b/mycoopts/view.qtpl.go index ddb1450..c2304bd 100644 --- a/mycoopts/view.qtpl.go +++ b/mycoopts/view.qtpl.go @@ -137,7 +137,7 @@ func StreamMedia(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Local qw422016.N().S(`

- + `) //line mycoopts/view.qtpl:32 default: diff --git a/shroom/header_links.go b/shroom/header_links.go index 0d2be2d..aff86f7 100644 --- a/shroom/header_links.go +++ b/shroom/header_links.go @@ -31,7 +31,7 @@ func SetHeaderLinks() { func setDefaultHeaderLinks() { viewutil.HeaderLinks = []viewutil.HeaderLink{ {"/recent-changes", "Recent changes"}, - {"/list", "All hyphae"}, + {"/list", "All pages"}, {"/random", "Random"}, {"/help", "Help"}, {"/category", "Categories"}, diff --git a/static/default.css b/static/default.css index c1b708e..03a0c2e 100644 --- a/static/default.css +++ b/static/default.css @@ -21,7 +21,23 @@ ol:not(.mycomarkup-doc ol) a:hover { text-decoration: underline; } /* General element positions, from small to big */ /* Phones and whatnot */ body { display: grid; row-gap: .5rem; } -header { width: 100%; } +header { width: 100%; display: flex; } +.logo { + padding-left: 3em; + display: flex; +} +.logo img { + height: 4em; +} +.logo .ominous { + width: 8em; + align-items: center; + display: flex; + padding-left: 0.5em; +} +.logo .ominous span { + text-align: center; +} .layout-card li { list-style-type: none; } @@ -30,6 +46,8 @@ header { width: 100%; } body { grid-template-columns: auto; grid-template-rows: auto auto auto; } .main-width { width: 100%; } main { padding: .5rem 1rem 1rem 1rem; } + .logo .ominous { display: none; } + .logo { padding-left: 1em; } } @media screen and (min-width: 500px) { @@ -48,8 +66,8 @@ header { width: 100%; } /* No longer a phone but still small screen: center main */ @media screen and (min-width: 801px) { .main-width { padding: 1rem 2rem; width: 800px; margin: 0 auto; } - main { border-radius: .25rem; } .layout-card { width: 800px; margin: 0 auto; } + .ominous { display: none; } } @@ -120,10 +138,10 @@ main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; clear: both; .heading__link:hover::after, .heading__link:active::after { color: #999; } article p { margin: .5rem 0; } article ul, ol { padding-left: 1.5rem; margin: .5rem 0; } -article code { padding: .1rem .3rem; border-radius: .25rem; font-size: 90%; font-family: 'Menlo', 'PT Mono', monospace; } -article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25rem;} +article code { padding: .1rem .3rem; font-size: 90%; font-family: 'Menlo', 'PT Mono', monospace; } +article pre.codeblock { padding:.5rem; white-space: pre-wrap; } .codeblock code {padding:0; font-size:15px;} -.transclusion { border-radius: .25rem; margin-bottom: .25rem; clear: both; } +.transclusion { margin-bottom: .25rem; clear: both; } .transclusion_failed { padding: 0 .5rem; } .transclusion__content > *:not(.binary-container) {margin: 0.5rem; } .transclusion__link {position: relative; display: block; float: right; text-align: right; font-style: italic; margin-right: .25rem; text-decoration: none; z-index: 2;} @@ -142,31 +160,31 @@ article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25 .navi-title a {text-decoration:none; } .navi-title__separator { margin: 0 .25rem; } .navi-title__colon { margin-right: .5rem; } -.upload-amnt { clear: both; padding: .5rem; border-radius: .25rem; } +.upload-amnt { clear: both; padding: .5rem; } .upload-amnt__unattach { display: block; } aside { clear: both; } #new-name {width:100%;} -.prevnext__el { display: inline-block; min-width: 40%; padding: .5rem 0; margin-bottom: .25rem; text-decoration: none; border-radius: .25rem; max-width: 49%; } +.prevnext__el { display: inline-block; min-width: 40%; padding: .5rem 0; margin-bottom: .25rem; text-decoration: none; max-width: 49%; } .prevnext__prev { float: left; } .prevnext__next { float: right; text-align: right; } .page-separator { clear: both; } -.history__entries { background-color: #eee; margin: 0; padding: 0; border-radius: .25rem; } +.history__entries { background-color: #eee; margin: 0; padding: 0; } .history__month-anchor { text-decoration: none; color: inherit; } .history__entry { list-style-type: none; padding: .25rem; } .history-entry { padding: .25rem; } .history-entry__time { font-weight: bold; } .history-entry__author { font-style: italic; } -table { border: #ddd 1px solid; border-radius: .25rem; min-width: 4rem; } +table { border: #ddd 1px solid; min-width: 4rem; } td { padding: .25rem; } caption { caption-side: top; font-size: small; } .subhyphae__list, .subhyphae__list ul { display: flex; padding: 0; margin: 0; flex-wrap: wrap; } .subhyphae__list ul { font-size: 90%; } -.subhyphae__entry { list-style-type: none; border: 1px solid #999; padding: 0; margin: .125rem; border-radius: .25rem; } +.subhyphae__entry { list-style-type: none; border: 1px solid #999; padding: 0; margin: .125rem; } .subhyphae__link { display: block; padding: .25rem; text-decoration: none; } .subhyphae__link:hover { background: #eee; } @@ -187,8 +205,8 @@ table, } .transclusion_blend .transclusion__link { display: none; } -.layout-card { border-radius: .25rem; background-color: white; } -.layout-card__title { font-size: 1rem; margin: 0; padding: .25rem .5rem; border-radius: .25rem .25rem 0 0; } +.layout-card { background-color: white; } +.layout-card__title { font-size: 1rem; margin: 0; padding: .25rem .5rem; } .layout-card__title { border-bottom: 1px solid #eee; } /* Other stuff */ @@ -323,7 +341,7 @@ kbd { transform: translate(-50%, 0); background-color: #fff; - border-radius: 4px; + box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); } @@ -498,7 +516,6 @@ kbd { line-height: normal; display: inline-block; border: 1px #999 solid; - border-radius: .15rem; text-decoration: none; padding: .25rem .5rem; font-size: 1rem; @@ -991,4 +1008,4 @@ figcaption { padding-bottom: .5rem; } padding: 1rem 2rem; font-family: Georgia, serif; } -} \ No newline at end of file +} diff --git a/static/icon/euler.png b/static/icon/euler.png new file mode 100644 index 0000000..4d6f75d Binary files /dev/null and b/static/icon/euler.png differ diff --git a/util/util.go b/util/util.go index a00230c..e5f6d82 100644 --- a/util/util.go +++ b/util/util.go @@ -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. diff --git a/viewutil/base.html b/viewutil/base.html index 48ac707..49a2275 100644 --- a/viewutil/base.html +++ b/viewutil/base.html @@ -16,6 +16,10 @@
+