1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-13 05:50:27 +00:00

Some changes

This commit is contained in:
Timur Ismagilov 2020-08-29 00:10:46 +05:00
parent e004f653bd
commit 28dee1087c
4 changed files with 16 additions and 31 deletions

View File

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

View File

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

View File

@ -41,11 +41,12 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
<main>
<nav>
<ul>
<li><a href="/page/%[1]s">See the last revision</a></li>
<li><a href="/page/%[1]s">See the latest revision</a></li>
<li><a href="/history/%[1]s">History</a></li>
</ul>
</nav>
<article>
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
%[2]s
%[3]s
</article>
@ -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(`

@ -1 +1 @@
Subproject commit e0e48d39b81968be9c5b00cac6b66cd68c1db3ce
Subproject commit 41b2e0bda18d1c4188363790fcd6289f29b296c3