mirror of
https://github.com/journeyman-cc/smeagol.git
synced 2026-04-12 18:05:06 +00:00
Apart from writing a diff2html transform and maybe adding a user-admin
page, I'd say this is feature complete. Good enough for me, anyway!
This commit is contained in:
parent
62b325cb68
commit
bc0dd75081
3 changed files with 24 additions and 5 deletions
|
|
@ -12,7 +12,7 @@
|
|||
<tr>
|
||||
{% for entry in history %}
|
||||
<tr>
|
||||
<td>
|
||||
<td>S
|
||||
{{entry.time}}
|
||||
</td>
|
||||
<td>
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
<a href="version?page={{page}}&version={{entry.id}}">Show version</a>
|
||||
</td>
|
||||
<td>
|
||||
<a href="diff?page={{page}}&version={{entry.id}}">What's changed?</a>
|
||||
<a href="changes?page={{page}}&version={{entry.id}}">What's changed?</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,8 @@
|
|||
|
||||
Based on JGit Cookbook ShowFileDiff."
|
||||
([^String git-directory-path ^String file-path ^String version]
|
||||
"TODO: Doesn't work yet")
|
||||
(diff git-directory-path file-path version
|
||||
(:id (first (find-history git-directory-path file-path)))))
|
||||
([^String git-directory-path ^String file-path ^String older ^String newer]
|
||||
(let [git-r (git/load-repo git-directory-path)
|
||||
old-parse (prepare-tree-parser git-r older)
|
||||
|
|
|
|||
|
|
@ -26,11 +26,11 @@
|
|||
[noir.session :as session]
|
||||
[taoensso.timbre :as timbre]
|
||||
[smeagol.authenticate :as auth]
|
||||
[smeagol.diff2html :as d2h]
|
||||
[smeagol.layout :as layout]
|
||||
[smeagol.util :as util]
|
||||
[smeagol.history :as hist]))
|
||||
|
||||
|
||||
(defn local-links
|
||||
"Rewrite text in `html-src` surrounded by double square brackets as a local link into this wiki."
|
||||
[html-src]
|
||||
|
|
@ -132,6 +132,23 @@
|
|||
repo-path file-name version)))
|
||||
:user (session/get :user)})))
|
||||
|
||||
(defn diff-page
|
||||
"Render a diff between two versions of a page"
|
||||
[request]
|
||||
(let [params (keywordize-keys (:params request))
|
||||
page (or (:page params) "Introduction")
|
||||
version (:version params)
|
||||
file-name (str page ".md")
|
||||
repo-path (str (io/resource-path) "/content/")]
|
||||
(layout/render "wiki.html"
|
||||
{:title (str "Changes since version " version " of " page)
|
||||
:page page
|
||||
:left-bar (local-links
|
||||
(util/md->html "/content/_left-bar.md"))
|
||||
:header (local-links
|
||||
(util/md->html "/content/_header.md"))
|
||||
:content (d2h/diff2html (hist/diff repo-path file-name version))
|
||||
:user (session/get :user)})))
|
||||
|
||||
(defn auth-page
|
||||
"Render the auth page"
|
||||
|
|
@ -168,6 +185,7 @@
|
|||
(POST "/edit" request (route/restricted (edit-page request)))
|
||||
(GET "/history" request (history-page request))
|
||||
(GET "/version" request (version-page request))
|
||||
(GET "/changes" request (diff-page request))
|
||||
(GET "/auth" request (auth-page request))
|
||||
(POST "/auth" request (auth-page request))
|
||||
(GET "/about" [] (about-page)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue