mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-04 18:19:54 +00:00
parent
b691ea04ce
commit
5547cb153d
2
go.mod
2
go.mod
@ -1,6 +1,6 @@
|
|||||||
module github.com/bouncepaw/mycorrhiza
|
module github.com/bouncepaw/mycorrhiza
|
||||||
|
|
||||||
go 1.19
|
go 1.22
|
||||||
|
|
||||||
require (
|
require (
|
||||||
git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0
|
git.sr.ht/~bouncepaw/mycomarkup/v5 v5.5.0
|
||||||
|
4
help/en/today.myco
Normal file
4
help/en/today.myco
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
= Today links
|
||||||
|
Some people use Mycorrhiza to keep their diaries. They put each day's notes into separate hyphae, usually named in the ISO format, for example, `2024-06-01` for the 1st of June, 2024. This date format is especially handy because it aligns with the way Mycorrhiza sorts hyphae, so the days are in order.
|
||||||
|
|
||||||
|
Links [[/today]] and [[/edit-today]] are special links that redirect to or edit the “today” hypha. Put them on your home hypha or on [[/help/en/top_bar | the top bar]].
|
@ -33,6 +33,7 @@
|
|||||||
<li><a href="/help/en/recent_changes">{{block "recent_changes" .}}Recent changes{{end}}</a></li>
|
<li><a href="/help/en/recent_changes">{{block "recent_changes" .}}Recent changes{{end}}</a></li>
|
||||||
<li><a href="/help/en/feeds">{{block "feeds" .}}Feeds{{end}}</a></li>
|
<li><a href="/help/en/feeds">{{block "feeds" .}}Feeds{{end}}</a></li>
|
||||||
<li><a href="/help/en/orphans">{{block "orphans" .}}Orphaned hyphae{{end}}</a></li>
|
<li><a href="/help/en/orphans">{{block "orphans" .}}Orphaned hyphae{{end}}</a></li>
|
||||||
|
<li><a href="/help/en/today">Today links</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>{{block "configuration" .}}Configuration (for administrators){{end}}
|
<li>{{block "configuration" .}}Configuration (for administrators){{end}}
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
|
|
||||||
@ -35,6 +36,18 @@ func initReaders(r *mux.Router) {
|
|||||||
r.PathPrefix("/rev/").HandlerFunc(handlerRevision)
|
r.PathPrefix("/rev/").HandlerFunc(handlerRevision)
|
||||||
r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText)
|
r.PathPrefix("/rev-text/").HandlerFunc(handlerRevisionText)
|
||||||
r.PathPrefix("/media/").HandlerFunc(handlerMedia)
|
r.PathPrefix("/media/").HandlerFunc(handlerMedia)
|
||||||
|
r.Path("/today").HandlerFunc(handlerToday)
|
||||||
|
r.Path("/edit-today").HandlerFunc(handlerEditToday)
|
||||||
|
}
|
||||||
|
|
||||||
|
func handlerEditToday(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
today := time.Now().Format(time.DateOnly)
|
||||||
|
http.Redirect(w, rq, "/edit/"+today, http.StatusSeeOther)
|
||||||
|
}
|
||||||
|
|
||||||
|
func handlerToday(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
today := time.Now().Format(time.DateOnly)
|
||||||
|
http.Redirect(w, rq, "/hypha/"+today, http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerMedia(w http.ResponseWriter, rq *http.Request) {
|
func handlerMedia(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
Loading…
Reference in New Issue
Block a user