diff --git a/resources/public/content/stylesheet.css b/resources/public/content/stylesheet.css
index 62690e0..81a661c 100644
--- a/resources/public/content/stylesheet.css
+++ b/resources/public/content/stylesheet.css
@@ -24,16 +24,6 @@
## html elements generally in alphabetic order
*/
-a {
- color: darkgray;
- font-weight: bold;
-}
-
-a:hover {
- color: darkgray;
- background:rgba(200,200,200,0.8);
-}
-
body {
margin: 0;
padding: 0;
@@ -62,15 +52,14 @@ dd {
/* footer of the page - not-editable, provided by Smeagol */
footer {
- border-top: thin solid silver;
- color: gray;
- background:rgba(200,200,200,0.8);
+ 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;
- min-height: 4px;
padding: 0.25em 0;
bottom:0;
position:fixed;
@@ -82,14 +71,9 @@ footer {
}
footer div {
- display: none;
padding: 0.1em;
}
-footer:hover div {
- display: block;
-}
-
form {
border: thin solid silver;
}
@@ -99,6 +83,8 @@ header {
margin-top: 0;
width:100%;
max-width: 100%;
+ background-color: gray;
+ color: white;
}
header h1 {
@@ -107,6 +93,7 @@ header h1 {
header a {
font-weight: bold;
+ color: white;
}
header a:hover {
@@ -144,12 +131,12 @@ ins {
label {
width: 20%;
min-width: 20em;
- border-right: thin solid silver;
+ border-right: thin solid gray;
display: inline-block;
}
table {
- border: thin solid silver;
+ border: 2px solid black;
border-collapse: collapse;
}
@@ -161,7 +148,7 @@ th, td {
text-align: left;
vertical-align: top;
padding: 0.15em 1.5em;
- border: 1px solid silver;
+ border: 1px solid gray;
}
th {
@@ -179,7 +166,6 @@ th {
/* left bar for all pages in the Wiki - editable, provided by users. Within main-container */
#side-bar {
- display: none;
width: 17%;
height: 100%;
float: left;
@@ -187,10 +173,10 @@ th {
/* cookies information box, fixed, in right margin, just above footer */
#cookies {
- width: 20%;
+ width: 30%;
float: right;
position: fixed;
- bottom: 8px;
+ bottom: 3.5em;
right: 0;
z-index: 175;
background: transparent;
@@ -204,8 +190,8 @@ th {
text-align: right;
padding: 0.25em 2em;
border-radius: 0.25em;
- color: gray;
- background:rgba(200,200,200,0.8);
+ color: white;
+ background:rgba(40,40,40,0.8);
}
/* more-about-cookies box, normally hidden */
@@ -213,9 +199,9 @@ th {
display: none;
padding: 0.5em 2em;
border-radius: 0.5em;
- color: gray;
- background:rgba(200,200,200,0.8);
- border-bottom: thin solid gray;
+ color: white;
+ background:rgba(40,40,40,0.8);
+ border-bottom: thin solid white;
}
/* but magically appears on mouseover */
@@ -256,8 +242,8 @@ th {
right: 0;
padding: 0.25em 2em;
border-radius: 0.25em;
- color: gray;
- background:rgba(200,200,200,0.8);
+ color: white;
+ background:rgba(40,40,40,0.8);
font-size: 66%;
}
@@ -268,11 +254,7 @@ th {
.minor-controls a {
float: right;
padding: 0.25em 2em;
- color: gray;
-}
-
-.minor-controls a:hover {
- color: darkgray;
+ color: white;
}
.pseudo-input {
@@ -321,7 +303,8 @@ th {
/* content of the current page in the Wiki - editable, provided by users. Within main-container */
#content {
border: thin solid silver;
- width: 100%;
+ width: 80%;
+ float: right;
padding-bottom: 5em;
}
@@ -329,29 +312,16 @@ th {
display: none;
}
- #header {
- font-size: smaller;
- }
-
/* top-of-page navigation, not editable, provided by Smeagol */
#nav{
margin: 0;
padding: 0;
top: 0;
- min-height: 4px;
+ width: 100%;
_position: absolute;
_top: expression(document.documentElement.scrollTop);
z-index: 149;
- color: gray;
- background:rgba(200,200,200,0.8);
- }
-
- #nav #nav-menu {
- display: none;
- }
-
- #nav:hover #nav-menu {
- display: block;
+ background:rgba(40,40,40,0.8);
}
/* only needed for fly-out menu effect on tablet and phone stylesheets */
@@ -371,14 +341,14 @@ th {
}
#nav menu li a {
- color: gray;
+ color: white;
text-decoration: none;
font-weight: bold;
padding: 0.1em 0.75em;
margin: 0;
}
- #nav menu li.active a { background: gray; color: white;}
+ #nav menu li.active a { background: gray;}
li.nav-item a:hover { background: rgb( 240, 240, 240) }
li.nav-item a:active { background: gray; color: white; }
@@ -409,15 +379,17 @@ th {
padding: 0;
position: fixed;
z-index: 149;
- color: black;
- background:rgba(200,200,200,0.9);
+ color: silver;
+ background:rgba(40,40,40,0.9);
}
#nav a {
+ color: white;
+ text-decoration: none;
font-weight: bold;
}
- #nav:hover #nav-menu, #nav:hover #phone-side-bar {
+ #nav:hover #nav-menu {
display: block;
list-style-type: none;
width: 100%;
@@ -483,21 +455,18 @@ th {
display: none;
}
- #header {
- display: none;
- }
-
#nav{
margin: 0;
padding: 0;
position: fixed;
z-index: 149;
- color: black;
- background:rgba(200,200,200,0.9);
+ color: silver;
+ background:rgba(40,40,40,0.9);
}
#nav a {
- color: black;
+ color: white;
+ text-decoration: none;
font-weight: bold;
}
@@ -522,8 +491,6 @@ th {
}
#nav menu li a {
- color: black;
- font-weight: bold;
}
#nav ul li.active a { background: silver;}
diff --git a/src/smeagol/formatting.clj b/src/smeagol/formatting.clj
index cacc9ca..3807cb0 100644
--- a/src/smeagol/formatting.clj
+++ b/src/smeagol/formatting.clj
@@ -10,6 +10,7 @@
[smeagol.extensions.mermaid :refer [process-mermaid]]
[smeagol.extensions.photoswipe :refer [process-photoswipe]]
[smeagol.extensions.vega :refer [process-vega]]
+ [smeagol.local-links :refer :all]
[taoensso.timbre :as log]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -44,26 +45,6 @@
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Error to show if text to be rendered is nil.
-;; TODO: this should go through i18n
-(def no-text-error "No text: does the file exist?")
-
-
-(defn local-links
- "Rewrite text in `html-src` surrounded by double square brackets as a local link into this wiki."
- [^String html-src]
- (if html-src
- (cs/replace html-src #"\[\[[^\[\]]*\]\]"
- #(let [text (cs/replace %1 #"[\[\]]" "")
- encoded (url-encode text)
- ;; I use '\_' to represent '_' in wiki markup, because
- ;; '_' is meaningful in Markdown. However, this needs to
- ;; be stripped out when interpreting local links.
- munged (cs/replace encoded #"%26%2395%3B" "_")]
- (format "%s" munged text)))
- no-text-error))
-
-
(declare process-text)
@@ -133,26 +114,10 @@
result
{:inclusions {inky (eval (list formatter (subs fragment (count token)) index))}
:extensions {fkey (-> config :formatters fkey)}})
-;; (assoc-in
-;; (assoc-in result [:inclusions inky] (eval (list formatter (subs fragment (count token)) index)))
-;; [:extensions fkey] (-> config :formatters fkey))
(rest fragments)
(cons inky processed))))
-;; (apply-formatter
-;; 3
-;; {:inclusions {}}
-;; '()
-;; '()
-;; "pswp
-;; ![Frost on a gate, Laurieston](content/uploads/g1.jpg)
-;; ![Feathered crystals on snow surface, Taliesin](content/uploads/g2.jpg)
-;; ![Feathered snow on log, Taliesin](content/uploads/g3.jpg)
-;; ![Crystaline growth on seed head, Taliesin](content/uploads/g4.jpg)"
-;; "pswp"
-;; smeagol.extensions.photoswipe/process-photoswipe)
-
(defn reassemble-text
"Reassemble these processed strings into a complete text, and process it as
Markdown."
diff --git a/src/smeagol/local_links.clj b/src/smeagol/local_links.clj
new file mode 100644
index 0000000..f1bed0b
--- /dev/null
+++ b/src/smeagol/local_links.clj
@@ -0,0 +1,50 @@
+(ns ^{:doc "Format Semagol's local links."
+ :author "Simon Brooke"}
+ smeagol.local-links
+ (:require [clojure.data.json :as json]
+ [clojure.string :as cs]
+ [cemerick.url :refer (url url-encode url-decode)]))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;;;
+;;;; Smeagol: a very simple Wiki engine.
+;;;;
+;;;; This program is free software; you can redistribute it and/or
+;;;; modify it under the terms of the GNU General Public License
+;;;; as published by the Free Software Foundation; either version 2
+;;;; of the License, or (at your option) any later version.
+;;;;
+;;;; This program is distributed in the hope that it will be useful,
+;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;;;; GNU General Public License for more details.
+;;;;
+;;;; 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,
+;;;; USA.
+;;;;
+;;;; Copyright (C) 2017 Simon Brooke
+;;;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;; Error to show if text to be rendered is nil.
+;; TODO: this should go through i18n
+(def no-text-error "No text: does the file exist?")
+
+
+(defn local-links
+ "Rewrite text in `html-src` surrounded by double square brackets as a local link into this wiki."
+ [^String html-src]
+ (if html-src
+ (cs/replace html-src #"\[\[[^\[\]]*\]\]"
+ #(let [text (cs/replace %1 #"[\[\]]" "")
+ encoded (url-encode text)
+ ;; I use '\_' to represent '_' in wiki markup, because
+ ;; '_' is meaningful in Markdown. However, this needs to
+ ;; be stripped out when interpreting local links.
+ munged (cs/replace encoded #"%26%2395%3B" "_")]
+ (format "%s" munged text)))
+ no-text-error))
+
+
diff --git a/src/smeagol/util.clj b/src/smeagol/util.clj
index 653e056..86fdfac 100644
--- a/src/smeagol/util.clj
+++ b/src/smeagol/util.clj
@@ -11,6 +11,7 @@
[scot.weft.i18n.core :as i18n]
[smeagol.authenticate :as auth]
[smeagol.configuration :refer [config]]
+ [smeagol.local-links :refer :all]
[taoensso.timbre :as log]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -135,9 +136,13 @@
:admin (auth/get-admin user)
:js-from (:js-from config)
:side-bar (md/md-to-html-string
- (slurp (cjio/file content-dir "_side-bar.md")):heading-anchors true)
+ (local-links
+ (slurp (cjio/file content-dir "_side-bar.md")))
+ :heading-anchors true)
:header (md/md-to-html-string
- (slurp (cjio/file content-dir "_header.md")) :heading-anchors true)
+ (local-links
+ (slurp (cjio/file content-dir "_header.md")))
+ :heading-anchors true)
:version (System/getProperty "smeagol.version")}))
diff --git a/test/smeagol/test/formatting.clj b/test/smeagol/test/formatting.clj
index 5172403..52e9817 100644
--- a/test/smeagol/test/formatting.clj
+++ b/test/smeagol/test/formatting.clj
@@ -1,20 +1,24 @@
(ns smeagol.test.formatting
(:require [clojure.test :refer :all]
- [smeagol.formatting :refer [local-links no-text-error]]
- [smeagol.extensions.test :refer :all]))
+ [smeagol.formatting :refer :all]
+ [smeagol.extensions.test :refer :all]
+ [smeagol.local-links :refer :all]))
-(deftest test-local-links
- (testing "Rewriting of local links"
- (is (= (local-links nil) no-text-error) "Should NOT fail with a no pointer exception!")
- (is (= (local-links "") "") "Empty string should pass through unchanged.")
- (is (= (local-links "[[froboz]]") "froboz") "Local link should be rewritten.")
- (let [text (str "# This is a heading"
- "[This is a foreign link](http://to.somewhere)")]
- (is (= (local-links text) text) "Foreign links should be unchanged"))))
-
-;; (deftest test-process-text
-;; (testing "The process-text flow"
-;; (let [expected process-test-return-value
-;; actual (process-text "```test
-;; ```")]
-;; (is (= actual expected)))))
+(deftest test-apply-formatter
+ (testing "apply-formatter"
+ (let [actual (-> (apply-formatter
+ 3
+ {:inclusions {}}
+ '()
+ '()
+ "test
+ ![Frost on a gate, Laurieston](content/uploads/g1.jpg)
+ ![Feathered crystals on snow surface, Taliesin](content/uploads/g2.jpg)
+ ![Feathered snow on log, Taliesin](content/uploads/g3.jpg)
+ ![Crystaline growth on seed head, Taliesin](content/uploads/g4.jpg)"
+ "test"
+ smeagol.extensions.test/process-test)
+ :inclusions
+ :inclusion-3)
+ expected ""]
+ (is (= actual expected)))))
diff --git a/test/smeagol/test/local_links.clj b/test/smeagol/test/local_links.clj
new file mode 100644
index 0000000..54d31e9
--- /dev/null
+++ b/test/smeagol/test/local_links.clj
@@ -0,0 +1,14 @@
+(ns smeagol.test.local-links
+ (:require [clojure.test :refer :all]
+ [smeagol.local-links :refer [local-links no-text-error]]
+ [smeagol.extensions.test :refer :all]
+ [smeagol.local-links :refer :all]))
+
+(deftest test-local-links
+ (testing "Rewriting of local links"
+ (is (= (local-links nil) no-text-error) "Should NOT fail with a no pointer exception!")
+ (is (= (local-links "") "") "Empty string should pass through unchanged.")
+ (is (= (local-links "[[froboz]]") "froboz") "Local link should be rewritten.")
+ (let [text (str "# This is a heading"
+ "[This is a foreign link](http://to.somewhere)")]
+ (is (= (local-links text) text) "Foreign links should be unchanged"))))