Small, mainly cosmetic tweaks, but including enabling links in the left bar

which were formerly broken.
This commit is contained in:
simon 2015-01-08 22:48:38 +00:00
parent 8edd392ba9
commit 941b7b54ff
3 changed files with 20 additions and 18 deletions

View file

@ -7,7 +7,7 @@
+ \!\[image alt text\]\(http://url.of.image\)
+ \+ (at start of line) ordinary bulleted lists
+ \1\. (at start of line) numbered lists
+ \**bold*\*
+ \*\***bold**\*\*
+ \__italic_\_
More documentation [here](http://daringfireball.net/projects/markdown/syntax)
More documentation [here](http://daringfireball.net/projects/markdown/syntax)

View file

@ -1,4 +1,4 @@
/*
/*
* Smeagol: a very simple Wiki engine
* Copyright (C) 2014 Simon Brooke
@ -14,10 +14,10 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*/
body {
margin: 0;
padding: 0;
@ -42,7 +42,8 @@ body {
font-height: 66%;
float: right;
padding: 0.1em 0.75em;
margin: 0;
margin: 0;
color: silver;
}
/* only needed for fly-out menu effect on tablet and phone stylesheets */
@ -94,6 +95,7 @@ li.nav-item a:active { background: gray; color: white; }
border: thin solid silver;
width: 80%;
float: right;
padding-bottom: 5em;
}

View file

@ -27,6 +27,14 @@
[smeagol.layout :as layout]
[smeagol.util :as util]))
(defn local-links
"Rewrite text in `html-src` surrounded by double square brackets as a local link into this wiki."
[html-src]
(clojure.string/replace html-src #"\[\[[^\[\]]*\]\]"
#(let [text (clojure.string/replace %1 #"[\[\]]" "")]
(str "<a href='wiki?content=" text "'>" text "</a>"))))
(defn process-source
"Process `source-text` and save it to the specified `file-path`, committing it
to Git and finally redirecting to wiki-page."
@ -60,19 +68,12 @@
true
(layout/render "edit.html"
{:title content
:left-bar (util/md->html "/content/_edit-left-bar.md")
:header (util/md->html "/content/_header.md")
:left-bar (local-links (util/md->html "/content/_edit-left-bar.md"))
:header (local-links (util/md->html "/content/_header.md"))
:content (if exists? (io/slurp-resource file-name) "")
:user (session/get :user)
:exists exists?}))))
(defn local-links
"Rewrite text in `html-src` surrounded by double square brackets as a local link into this wiki."
[html-src]
(clojure.string/replace html-src #"\[\[[^\[\]]*\]\]"
#(let [text (clojure.string/replace %1 #"[\[\]]" "")]
(str "<a href='wiki?content=" text "'>" text "</a>"))))
(defn wiki-page
"Render the markdown page specified in this `request`, if any. If none found, redirect to edit-page"
[request]
@ -98,7 +99,6 @@
password (:password params)
action (:action params)
user (session/get :user)]
(println (str "Action = " action))
(cond
(= action "Logout!")
(do
@ -111,8 +111,8 @@
true
(layout/render "auth.html"
{:title (if user (str "Logout " user) "Log in")
:left-bar (util/md->html "/content/_left-bar.md")
:header (util/md->html "/content/_header.md")
:left-bar (local-links (util/md->html "/content/_left-bar.md"))
:header (local-links (util/md->html "/content/_header.md"))
:user user}))))
(defn about-page []