diff --git a/README.md b/README.md index c25b673..8e9f51b 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,22 @@ -# mycorrhiza wiki -A wiki engine inspired by fungi. Not production-ready. - -This branch is devoted to version 0.8. -* [ ] Tree generation - * [x] Basic generation - * [ ] Generation that takes non-existent hyphae into account¹ -* [ ] History - * [ ] Saving all changes to git - * [ ] Make it possible to see any previous version - * [ ] A nice UI for that - -¹ Current algorithm won't detect `a/b/c` as a child of `a` if `a/b` does not exist. +# MycorrhizaWiki +A wiki engine inspired by fungi. ## Current features * Edit pages through html forms * Responsive design * Works in text browsers -* Pages (called hyphae) can be in gemtext. +* Pages (called hyphae) are in gemtext * Everything is stored as simple files, no database required +* Page trees +* Changes are saved to git +* History page ## Future features * Tags * Authorization * History view * Granular user rights +* A better page tree algorithm ## Installation I guess you can just clone this repo and run `make` to play around with the default wiki. diff --git a/history/sh.go b/history/sh.go index 4f4438d..e7216f9 100644 --- a/history/sh.go +++ b/history/sh.go @@ -6,16 +6,13 @@ import ( "strings" ) -func Revisions(filepath string) ([]Revision, error) { - if filepath == "" { - return []Revision{}, nil - } +func Revisions(hyphaName string) ([]Revision, error) { var ( out, err = gitsh( "log", "--oneline", "--no-merges", // Hash, Commiter email, Commiter time, Commit msg separated by tab "--pretty=format:\"%h\t%ce\t%ct\t%s\"", - "--", filepath, + "--", hyphaName+"&.*", ) revs []Revision ) diff --git a/http_readers.go b/http_readers.go index 61cca09..8c02a89 100644 --- a/http_readers.go +++ b/http_readers.go @@ -41,11 +41,12 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
+

Please note that viewing binary parts of hyphae is not supported in history for now.

%[2]s %[3]s
@@ -68,20 +69,14 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) { log.Println(rq.URL) hyphaName := HyphaNameFromRq(rq, "history") var tbody string - if data, ok := HyphaStorage[hyphaName]; ok { - revsT, err := history.Revisions(data.textPath) + if _, ok := HyphaStorage[hyphaName]; ok { + revs, err := history.Revisions(hyphaName) if err == nil { - for _, rev := range revsT { + for _, rev := range revs { tbody += rev.AsHtmlTableRow(hyphaName) } } - revsB, err := history.Revisions(data.binaryPath) - if err == nil { - for _, rev := range revsB { - tbody += rev.AsHtmlTableRow(hyphaName) - } - } - log.Println(revsT, revsB) + log.Println(revs) } table := fmt.Sprintf(` diff --git a/metarrhiza b/metarrhiza index e0e48d3..41b2e0b 160000 --- a/metarrhiza +++ b/metarrhiza @@ -1 +1 @@ -Subproject commit e0e48d39b81968be9c5b00cac6b66cd68c1db3ce +Subproject commit 41b2e0bda18d1c4188363790fcd6289f29b296c3