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 # MycorrhizaWiki
A wiki engine inspired by fungi. Not production-ready. A wiki engine inspired by fungi.
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.
## Current features ## Current features
* Edit pages through html forms * Edit pages through html forms
* Responsive design * Responsive design
* Works in text browsers * 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 * Everything is stored as simple files, no database required
* Page trees
* Changes are saved to git
* History page
## Future features ## Future features
* Tags * Tags
* Authorization * Authorization
* History view * History view
* Granular user rights * Granular user rights
* A better page tree algorithm
## Installation ## Installation
I guess you can just clone this repo and run `make` to play around with the default wiki. 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" "strings"
) )
func Revisions(filepath string) ([]Revision, error) { func Revisions(hyphaName string) ([]Revision, error) {
if filepath == "" {
return []Revision{}, nil
}
var ( var (
out, err = gitsh( out, err = gitsh(
"log", "--oneline", "--no-merges", "log", "--oneline", "--no-merges",
// Hash, Commiter email, Commiter time, Commit msg separated by tab // Hash, Commiter email, Commiter time, Commit msg separated by tab
"--pretty=format:\"%h\t%ce\t%ct\t%s\"", "--pretty=format:\"%h\t%ce\t%ct\t%s\"",
"--", filepath, "--", hyphaName+"&.*",
) )
revs []Revision revs []Revision
) )

View File

@ -41,11 +41,12 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
<main> <main>
<nav> <nav>
<ul> <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> <li><a href="/history/%[1]s">History</a></li>
</ul> </ul>
</nav> </nav>
<article> <article>
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
%[2]s %[2]s
%[3]s %[3]s
</article> </article>
@ -68,20 +69,14 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) {
log.Println(rq.URL) log.Println(rq.URL)
hyphaName := HyphaNameFromRq(rq, "history") hyphaName := HyphaNameFromRq(rq, "history")
var tbody string var tbody string
if data, ok := HyphaStorage[hyphaName]; ok { if _, ok := HyphaStorage[hyphaName]; ok {
revsT, err := history.Revisions(data.textPath) revs, err := history.Revisions(hyphaName)
if err == nil { if err == nil {
for _, rev := range revsT { for _, rev := range revs {
tbody += rev.AsHtmlTableRow(hyphaName) tbody += rev.AsHtmlTableRow(hyphaName)
} }
} }
revsB, err := history.Revisions(data.binaryPath) log.Println(revs)
if err == nil {
for _, rev := range revsB {
tbody += rev.AsHtmlTableRow(hyphaName)
}
}
log.Println(revsT, revsB)
} }
table := fmt.Sprintf(` table := fmt.Sprintf(`

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