1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-29 19:26:16 +00:00

misc changes

This commit is contained in:
osmarks 2024-08-25 16:18:02 +00:00
parent ceff8ad91b
commit 5d059a9b08
12 changed files with 75 additions and 39 deletions

1
.gitignore vendored
View File

@ -1 +1,2 @@
mycorrhiza
demo

View File

@ -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 == "" {

View File

@ -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.",

View File

@ -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",

View File

@ -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",
}

View File

@ -28,7 +28,7 @@
<p>{%s lc.Get("ui.media_noaudio") %} <a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_noaudio_link") %}</a></p>
</audio>
</div>
{% default %}
<div class="binary-container binary-container_with-nothing">
<p><a href="/binary/{%s= h.CanonicalName() %}">{%s lc.Get("ui.media_download") %}</a></p>

View File

@ -137,7 +137,7 @@ func StreamMedia(qw422016 *qt422016.Writer, h *hyphae.MediaHypha, lc *l18n.Local
qw422016.N().S(`</a></p>
</audio>
</div>
`)
//line mycoopts/view.qtpl:32
default:

View File

@ -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"},

View File

@ -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;
}
}
}

BIN
static/icon/euler.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -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.

View File

@ -16,6 +16,10 @@
</head>
<body data-rrh-addr="{{if .Addr}}{{.Addr}}{{else}}{{.Meta.Addr}}{{end}}"{{range $key, $value := .BodyAttributes}} data-rrh-{{$key}}="{{$value}}"{{end}}>
<header>
<div class="logo">
<img src="/static/favicon.ico" alt="A picture of Euler, stretched into a square" />
<div class="ominous"><span>It's already far too late.</span></div>
</div>
<nav class="main-width top-bar">
<ul class="top-bar__wrapper">
<li class="top-bar__section top-bar__section_home">