Skip to content

Commit

Permalink
Tactical commit
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 19, 2020
1 parent 0649ecf commit 03c63da
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 122 deletions.
101 changes: 34 additions & 67 deletions resources/public/content/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -82,14 +71,9 @@ footer {
}

footer div {
display: none;
padding: 0.1em;
}

footer:hover div {
display: block;
}

form {
border: thin solid silver;
}
Expand All @@ -99,6 +83,8 @@ header {
margin-top: 0;
width:100%;
max-width: 100%;
background-color: gray;
color: white;
}

header h1 {
Expand All @@ -107,6 +93,7 @@ header h1 {

header a {
font-weight: bold;
color: white;
}

header a:hover {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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 {
Expand All @@ -179,18 +166,17 @@ 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;
}

/* 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;
Expand All @@ -204,18 +190,18 @@ 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 */
#more-about-cookies {
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 */
Expand Down Expand Up @@ -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%;
}

Expand All @@ -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 {
Expand Down Expand Up @@ -321,37 +303,25 @@ 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;
}

#phone-side-bar, #phone-credits {
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 */
Expand All @@ -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; }

Expand Down Expand Up @@ -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%;
Expand Down Expand Up @@ -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;
}

Expand All @@ -522,8 +491,6 @@ th {
}

#nav menu li a {
color: black;
font-weight: bold;
}

#nav ul li.active a { background: silver;}
Expand Down
37 changes: 1 addition & 36 deletions src/smeagol/formatting.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Expand Down Expand Up @@ -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 "<a href='wiki?page=%s'>%s</a>" munged text)))
no-text-error))


(declare process-text)


Expand Down Expand Up @@ -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."
Expand Down
50 changes: 50 additions & 0 deletions src/smeagol/local_links.clj
Original file line number Diff line number Diff line change
@@ -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 "<a href='wiki?page=%s'>%s</a>" munged text)))
no-text-error))


Loading

0 comments on commit 03c63da

Please sign in to comment.