Much restyling to add WEFT branding and a wee advertisement.

Also in the process updated dependencies.
This commit is contained in:
simon 2016-09-02 16:27:59 +01:00
parent 0613577825
commit ee5630ecb2
12 changed files with 124 additions and 81 deletions

View file

@ -1,4 +1,7 @@
# Welcome to Smeagol! # Welcome to Smeagol!
![One wiki to rule them all](http://www.weft.scot/images/smeagol.png)
Smeagol is a simple Wiki engine inspired by [Gollum](https://github.com/gollum/gollum/wiki). Gollum is a Wiki engine written in Ruby, which uses a number of simple text formats including [Markdown](http://daringfireball.net/projects/markdown/), and which uses [Git](http://git-scm.com/) to provide versioning and backup. I needed a new Wiki for a project and thought Gollum would be ideal - but unfortunately it doesn't provide user authentication, which I needed, and it was simpler for me to reimplement the bits I did need in Clojure than to modify Gollum. Smeagol is a simple Wiki engine inspired by [Gollum](https://github.com/gollum/gollum/wiki). Gollum is a Wiki engine written in Ruby, which uses a number of simple text formats including [Markdown](http://daringfireball.net/projects/markdown/), and which uses [Git](http://git-scm.com/) to provide versioning and backup. I needed a new Wiki for a project and thought Gollum would be ideal - but unfortunately it doesn't provide user authentication, which I needed, and it was simpler for me to reimplement the bits I did need in Clojure than to modify Gollum.
So at this stage Smeagol is a Wiki engine written in Clojure which uses Markdown as its text format, which does have user authentication, and which uses Git as its versioning and backup system. So at this stage Smeagol is a Wiki engine written in Clojure which uses Markdown as its text format, which does have user authentication, and which uses Git as its versioning and backup system.
@ -23,10 +26,9 @@ There's still no mechanism to add a new user to the system through the user inte
## Images ## Images
Smeagol does not currently have any mechanism to upload images. You can, however, link to images already available on the web, like this: Smeagol does not currently have any mechanism to upload images. You can, however, link to images already available on the web, like this:
![](http://vignette3.wikia.nocookie.net/lotr/images/e/e1/Gollum_Render.png/revision/latest?cb=20141218075509) ![Smeagol](http://vignette3.wikia.nocookie.net/lotr/images/e/e1/Gollum_Render.png/revision/latest?cb=20141218075509)
## Todo ## Todo
* Image (and other media) upload;
* Mechanism to add users through the user interface; * Mechanism to add users through the user interface;
## License ## License
@ -35,6 +37,19 @@ version 2.0 or (at your option) any later version. If you wish to incorporate
parts of Smeagol into another open source project which uses a less restrictive parts of Smeagol into another open source project which uses a less restrictive
license, please contact me; I'm open to dual licensing it. license, please contact me; I'm open to dual licensing it.
### Phoning home
Smeagol currently requests the WEFT logo in the page footer from my home site. This is mainly so I can get a feel for how many people are using the product. If you object to this, simply edit the file
resources/templates/base.html
and replace the line
<img height="16" width="16" alt="The Web Engineering Factory &amp; Toolworks" src="http://www.weft.scot/images/weft.logo.64.png"> Developed by <a href="http://www.weft.scot/">WEFT</a>
with the line
<img height="16" width="16" alt="The Web Engineering Factory &amp; Toolworks" src="img/weft.logo.64.png"> Developed by <a href="http://www.weft.scot/">WEFT</a>
## Prerequisites ## Prerequisites
You will need [Leiningen][1] 2.0 or above installed. You will need [Leiningen][1] 2.0 or above installed.
@ -45,16 +60,9 @@ To start a web server for the application, run:
lein ring server lein ring server
or more probably
nohup lein ring server > smeagol.log &
Alternatively, if you want to deploy to a servlet container (which I would strongly recommend), the simplest thing is to run: Alternatively, if you want to deploy to a servlet container (which I would strongly recommend), the simplest thing is to run:
lein ring uberwar lein ring uberwar
(a command which I'm sure Smeagol would entirely appreciate) and deploy the resulting war file. (a command which I'm sure Smeagol would entirely appreciate) and deploy the resulting war file.
## Editing the framing content
You can edit the [stylesheet](/edit-css?page=stylesheet), the [[\_left-bar]], the [[\_edit-left-bar]], and the [[\_header]].

View file

@ -3,11 +3,18 @@
:url "https://github.com/simon-brooke/smeagol" :url "https://github.com/simon-brooke/smeagol"
:dependencies [[org.clojure/clojure "1.7.0"] :dependencies [[org.clojure/clojure "1.7.0"]
[org.clojure/core.memoize "0.5.9"] [org.clojure/core.memoize "0.5.9"]
[com.taoensso/encore "2.80.0"]
[lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]] [lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]]
[com.cemerick/url "0.1.1"] [com.cemerick/url "0.1.1"]
[ring-server "0.4.0"] [ring-server "0.4.0"]
[selmer "1.0.7"] [selmer "1.0.7"]
[com.taoensso/timbre "3.3.1" :exclusions [org.clojure/tools.reader]] [org.clojure/tools.logging "0.3.1"]
[org.slf4j/slf4j-log4j12 "1.7.21"]
[log4j/log4j "1.2.17" :exclusions [javax.mail/mail
javax.jms/jms
com.sun.jmdk/jmxtools
com.sun.jmx/jmxri]]
[com.taoensso/timbre "4.7.4" :exclusions [org.clojure/tools.reader]]
[com.taoensso/tower "3.0.2" :exclusions [com.taoensso/encore]] [com.taoensso/tower "3.0.2" :exclusions [com.taoensso/encore]]
[markdown-clj "0.9.89" :exclusions [com.keminglabs/cljx]] [markdown-clj "0.9.89" :exclusions [com.keminglabs/cljx]]
[crypto-password "0.2.0"] [crypto-password "0.2.0"]
@ -28,7 +35,7 @@
:ring {:handler smeagol.handler/app :ring {:handler smeagol.handler/app
:init smeagol.handler/init :init smeagol.handler/init
:destroy smeagol.handler/destroy} :destroy smeagol.handler/destroy}
:lein-release {:scm :git} :lein-release {:scm :git :deploy-via :lein-install}
:profiles :profiles
{:uberjar {:omit-source true {:uberjar {:omit-source true
:env {:production true} :env {:production true}

View file

@ -23,12 +23,27 @@ There's still no mechanism to add a new user to the system through the user inte
## Images ## Images
Smeagol does not currently have any mechanism to upload images. You can, however, link to images already available on the web, like this: Smeagol does not currently have any mechanism to upload images. You can, however, link to images already available on the web, like this:
![](http://vignette3.wikia.nocookie.net/lotr/images/e/e1/Gollum_Render.png/revision/latest?cb=20141218075509) ![Smeagol](http://vignette3.wikia.nocookie.net/lotr/images/e/e1/Gollum_Render.png/revision/latest?cb=20141218075509)
## Todo ## Todo
* Image (and other media) upload;
* Mechanism to add users through the user interface; * Mechanism to add users through the user interface;
## Advertisement
If you like what you see here, I am available for work on open source Clojure projects. Contact me vis [WEFT](http://www.weft.scot/).
### Phoning home
Smeagol currently requests the WEFT logo in the page footer from my home site. This is mainly so I can get a feel for how many people are using the product. If you object to this, edit the file
resources/templates/base.html
and replace the line
<img height="16" width="16" alt="The Web Engineering Factory &amp; Toolworks" src="http://www.weft.scot/images/weft.logo.64.png"> Developed by <a href="http://www.weft.scot/">WEFT</a>
with the line
<img height="16" width="16" alt="The Web Engineering Factory &amp; Toolworks" src="img/weft.logo.64.png"> Developed by <a href="http://www.weft.scot/">WEFT</a>
## License ## License
Copyright © 2014-2015 Simon Brooke. Licensed under the GNU General Public License, Copyright © 2014-2015 Simon Brooke. Licensed under the GNU General Public License,
version 2.0 or (at your option) any later version. If you wish to incorporate version 2.0 or (at your option) any later version. If you wish to incorporate
@ -45,10 +60,6 @@ To start a web server for the application, run:
lein ring server lein ring server
or more probably
nohup lein ring server > smeagol.log &
Alternatively, if you want to deploy to a servlet container (which I would strongly recommend), the simplest thing is to run: Alternatively, if you want to deploy to a servlet container (which I would strongly recommend), the simplest thing is to run:
lein ring uberwar lein ring uberwar

View file

@ -1 +1 @@
This is the header. There isn't yet much in it. You could [edit](edit?page=_header) it to provide internal navigation or branding. This is the header. There isn't yet much in it. You could [edit](edit?page=_header) it to provide internal navigation or branding.

View file

@ -1 +0,0 @@
This is the left bar. There's nothing in it yet. You could [edit](edit?page=_left-bar) it to provide internal navigation or branding.

View file

@ -0,0 +1,3 @@
This is the side bar. There's nothing in it yet. You could [edit](edit?page=_side-bar) it to provide internal navigation or branding.
If you don't like it on the left, float it to the right (or do something entirely different) by editing the [stylesheet](/edit-css?page=stylesheet).

View file

@ -28,6 +28,47 @@ body {
font-family: sans-serif; font-family: sans-serif;
} }
/* footer of the page - not-editable, provided by Smeagol */
footer {
border-top: thin solid gray;
clear: both;
font-size: smaller;
text-align: center;
color: gray;
background: rgba(224,224,224,0.95);
width: 100%;
margin: 0;
padding: 0.25em 0;
bottom:0;
position:fixed;
vertical-align: top;
z-index:150;
_position:absolute;
_top:expression(eval(document.documentElement.scrollTop+
(document.documentElement.clientHeight-this.offsetHeight)));
}
footer div {
padding: 0.1em;
}
/* header for all pages in the Wiki - editable, provided by users. */
header {
margin-top: 0;
width:100%;
background-color: gray;
color: white;
}
header h1 {
margin-top: 0;
}
header img {
float: right;
}
/* ids generally in document order */ /* ids generally in document order */
/* top-of-page navigation, not editable, provided by Smeagol */ /* top-of-page navigation, not editable, provided by Smeagol */
@ -87,20 +128,8 @@ li.nav-item a:active { background: gray; color: white; }
} }
/* header for all pages in the Wiki - editable, provided by users. Within main-container */
#header {
margin-top: 0;
width:100%;
background-color: gray;
color: white;
}
#header h1 {
margin-top: 0;
}
/* left bar for all pages in the Wiki - editable, provided by users. Within main-container */ /* left bar for all pages in the Wiki - editable, provided by users. Within main-container */
#left-bar { #side-bar {
width: 17%; width: 17%;
height: 100%; height: 100%;
float: left; float: left;
@ -151,24 +180,6 @@ li.nav-item a:active { background: gray; color: white; }
display: block; display: block;
} }
/* footer of the page - not-editable, provided by Smeagol */
#footer {
clear: both;
font-size: smaller;
text-align: center;
color:white;
background:rgba(128,128,128,0.95);
width: 100%;
margin: 0;
padding: 0.25em 0;
bottom:0;
position:fixed;
vertical-align: top;
z-index:150;
_position:absolute;
_top:expression(eval(document.documentElement.scrollTop+
(document.documentElement.clientHeight-this.offsetHeight)));
}
.change { .change {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View file

@ -9,8 +9,7 @@
{% endblock %} {% endblock %}
</head> </head>
<body> <body>
<header class="wiki">
<div id="header" class="wiki">
<!-- navbar --> <!-- navbar -->
<div id="nav"> <div id="nav">
{% if user %} {% if user %}
@ -29,9 +28,9 @@
</div> </div>
<h1>{{title}}</h1> <h1>{{title}}</h1>
{{header|safe}} {{header|safe}}
</div> </header>
<div id="left-bar" class="wiki"> <div id="side-bar" class="wiki">
{{left-bar|safe}} {{side-bar|safe}}
</div> </div>
<div id="main-container" class="container"> <div id="main-container" class="container">
@ -60,15 +59,21 @@
About cookies About cookies
</div> </div>
</div> </div>
<div id="footer"> <footer>
<div id="credits"> <div id="credits">
<div>
One Wiki to rule them all || One Wiki to rule them all ||
<img height="16" width="16" alt="one wiki to rule them all" src="img/smeagol.png"/>Smeagol wiki engine {{version}} || Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> || <img height="16" width="16" alt="one wiki to rule them all" src="img/smeagol.png"/>Smeagol wiki engine {{version}} ||
<img height="16" width="16" alt="The Web Engineering Factory &amp; Toolworks" src="http://www.weft.scot/images/weft.logo.64.png"> Developed by <a href="http://www.weft.scot/">WEFT</a>
</div>
<div>
Built with <a href="http://www.luminusweb.net/">LuminusWeb</a> ||
<img height="16" width="16" alt="Clojure" src="img/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> || <img height="16" width="16" alt="Clojure" src="img/clojure-icon.gif"/> Powered by <a href="http://clojure.org">Clojure</a> ||
<img height="16" width="16" alt="GitHub" src="img/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> || <img height="16" width="16" alt="GitHub" src="img/github-logo-transparent.png"/>Find me/fork me on <a href="https://github.com/simon-brooke/smeagol">Github</a> ||
<img height="16" width="16" alt="Free Software Foundation" src="img/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a> <img height="16" width="16" alt="Free Software Foundation" src="img/gnu.small.png"/>Licensed under the <a href="http://www.gnu.org/licenses/gpl-2.0.html">GNU General Public License version 2.0</a>
</div>
</div> </div>
</div> <footer>
</body> </body>
</html> </html>

View file

@ -12,7 +12,8 @@
[ring.middleware.defaults :refer [site-defaults]] [ring.middleware.defaults :refer [site-defaults]]
[compojure.route :as route] [compojure.route :as route]
[taoensso.timbre :as timbre] [taoensso.timbre :as timbre]
[taoensso.timbre.appenders.rotor :as rotor] [taoensso.timbre.appenders.core :as appenders]
[taoensso.timbre.appenders.3rd-party.rotor :as rotor]
[selmer.parser :as parser] [selmer.parser :as parser]
[environ.core :refer [env]] [environ.core :refer [env]]
[cronj.core :as cronj])) [cronj.core :as cronj]))
@ -54,17 +55,15 @@
put any initialization code here" put any initialization code here"
[] []
(timbre/set-config! (timbre/set-config!
[:appenders :rotor] {:min-level :debug
{:min-level :info
:enabled? true :enabled? true
:async? false ; should be always false for rotor :output-fn timbre/default-output-fn})
:max-message-per-msecs nil (timbre/merge-config!
:fn rotor/appender-fn}) {:appenders
{:rotor (rotor/rotor-appender
(timbre/set-config! {:path "smeagol.log"
[:shared-appender-config :rotor] :max-size (* 512 1024)
{:path "smeagol.log" :max-size (* 512 1024) :backlog 10}) :backlog 10})}})
(if (env :dev) (parser/cache-off!)) (if (env :dev) (parser/cache-off!))
;;start the expired session cleanup job ;;start the expired session cleanup job
(cronj/start! session-manager/cleanup-job) (cronj/start! session-manager/cleanup-job)

View file

@ -94,8 +94,8 @@
"Render a page in a text-area for editing. This could have been done in the same function as wiki-page, "Render a page in a text-area for editing. This could have been done in the same function as wiki-page,
and that would have been neat, but I couldn't see how to establish security if that were done." and that would have been neat, but I couldn't see how to establish security if that were done."
([request] ([request]
(edit-page request "Introduction" ".md" "edit.html" "/content/_edit-left-bar.md")) (edit-page request "Introduction" ".md" "edit.html" "/content/_edit-side-bar.md"))
([request default suffix template left-bar] ([request default suffix template side-bar]
(let [params (keywordize-keys (:params request)) (let [params (keywordize-keys (:params request))
src-text (:src params) src-text (:src params)
page (or (:page params) default) page (or (:page params) default)
@ -107,7 +107,7 @@
(layout/render template (layout/render template
{:title (str "Edit " page) {:title (str "Edit " page)
:page page :page page
:left-bar (local-links (util/md->html left-bar)) :side-bar (local-links (util/md->html side-bar))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:content (if exists? (io/slurp-resource (str "/content/" page suffix)) "") :content (if exists? (io/slurp-resource (str "/content/" page suffix)) "")
:user (session/get :user) :user (session/get :user)
@ -117,7 +117,7 @@
(defn edit-css-page (defn edit-css-page
"Render a stylesheet in a text-area for editing.." "Render a stylesheet in a text-area for editing.."
[request] [request]
(edit-page request "stylesheet" ".css" "edit-css.html" "/content/_edit-left-bar.md")) (edit-page request "stylesheet" ".css" "edit-css.html" "/content/_edit-side-bar.md"))
(defn wiki-page (defn wiki-page
@ -132,7 +132,7 @@
(layout/render "wiki.html" (layout/render "wiki.html"
{:title page {:title page
:page page :page page
:left-bar (local-links (util/md->html "/content/_left-bar.md")) :side-bar (local-links (util/md->html "/content/_side-bar.md"))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:content (local-links (util/md->html file-name)) :content (local-links (util/md->html file-name))
:user (session/get :user) :user (session/get :user)
@ -151,7 +151,7 @@
(layout/render "history.html" (layout/render "history.html"
{:title (str "History of " page) {:title (str "History of " page)
:page page :page page
:left-bar (local-links (util/md->html "/content/_left-bar.md")) :side-bar (local-links (util/md->html "/content/_side-bar.md"))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:history (hist/find-history repo-path file-name)}))) :history (hist/find-history repo-path file-name)})))
@ -167,8 +167,8 @@
(layout/render "wiki.html" (layout/render "wiki.html"
{:title (str "Version " version " of " page) {:title (str "Version " version " of " page)
:page page :page page
:left-bar (local-links :side-bar (local-links
(util/md->html "/content/_left-bar.md")) (util/md->html "/content/_side-bar.md"))
:header (local-links :header (local-links
(util/md->html "/content/_header.md")) (util/md->html "/content/_header.md"))
:content (local-links :content (local-links
@ -189,8 +189,8 @@
(layout/render "wiki.html" (layout/render "wiki.html"
{:title (str "Changes since version " version " of " page) {:title (str "Changes since version " version " of " page)
:page page :page page
:left-bar (local-links :side-bar (local-links
(util/md->html "/content/_left-bar.md")) (util/md->html "/content/_side-bar.md"))
:header (local-links :header (local-links
(util/md->html "/content/_header.md")) (util/md->html "/content/_header.md"))
:content (d2h/diff2html (hist/diff repo-path file-name version)) :content (d2h/diff2html (hist/diff repo-path file-name version))
@ -220,7 +220,7 @@
(layout/render "auth.html" (layout/render "auth.html"
{:title (if user (str "Logout " user) "Log in") {:title (if user (str "Logout " user) "Log in")
:redirect-to ((:headers request) "referer") :redirect-to ((:headers request) "referer")
:left-bar (local-links (util/md->html "/content/_left-bar.md")) :side-bar (local-links (util/md->html "/content/_side-bar.md"))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:user user})))) :user user}))))
@ -243,7 +243,7 @@
true "Your password was not changed")] ;; but I don't know why... true "Your password was not changed")] ;; but I don't know why...
(layout/render "passwd.html" (layout/render "passwd.html"
{:title (str "Change passord for " user) {:title (str "Change passord for " user)
:left-bar (local-links (util/md->html "/content/_left-bar.md")) :side-bar (local-links (util/md->html "/content/_side-bar.md"))
:header (local-links (util/md->html "/content/_header.md")) :header (local-links (util/md->html "/content/_header.md"))
:message message}))) :message message})))