From 941b7b54ff2d5787a23eba296c8a2d034c3c9203 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 8 Jan 2015 22:48:38 +0000 Subject: [PATCH] Small, mainly cosmetic tweaks, but including enabling links in the left bar which were formerly broken. --- resources/public/content/_edit-left-bar.md | 4 ++-- resources/public/css/standard.css | 10 +++++---- src/smeagol/routes/wiki.clj | 24 +++++++++++----------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/resources/public/content/_edit-left-bar.md b/resources/public/content/_edit-left-bar.md index d491cbc..7e15569 100644 --- a/resources/public/content/_edit-left-bar.md +++ b/resources/public/content/_edit-left-bar.md @@ -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) \ No newline at end of file +More documentation [here](http://daringfireball.net/projects/markdown/syntax) diff --git a/resources/public/css/standard.css b/resources/public/css/standard.css index 5de427e..d49e464 100644 --- a/resources/public/css/standard.css +++ b/resources/public/css/standard.css @@ -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; } diff --git a/src/smeagol/routes/wiki.clj b/src/smeagol/routes/wiki.clj index 28fdb01..730733f 100644 --- a/src/smeagol/routes/wiki.clj +++ b/src/smeagol/routes/wiki.clj @@ -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 "" text "")))) + (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 "" text "")))) - (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 []