From 471fdbab9622cf0408464efae0b59b41ce570de9 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Wed, 26 Feb 2020 22:46:32 +0000 Subject: [PATCH 1/3] Added a green-on-black stylesheet, which I shall use for my blog --- resources/public/content/journeyman.css | 564 ++++++++++++++++++++++++ 1 file changed, 564 insertions(+) create mode 100644 resources/public/content/journeyman.css diff --git a/resources/public/content/journeyman.css b/resources/public/content/journeyman.css new file mode 100644 index 0000000..b4ed271 --- /dev/null +++ b/resources/public/content/journeyman.css @@ -0,0 +1,564 @@ +body +{ + font-family: Helvetica, Arial, sans-serif; + background-color: black; + color: #60C030; +} + +h1, h2, h3, h4, h5, h6, dt +{ + padding-top: 1em; + padding-bottom: 0.5em; + padding-left: 1em; + font-family: Helvetica, Arial, sans-serif; + color: lime; + background: transparent url( /~simon/images/graduated_pinstripe.png) no-repeat; + text-align: left; +} + +th +{ + color: lime; + background: transparent url( /~simon/images/greenshade.png); + text-align: left; +} + +p, li, td +{ + padding-top: 0.25em; + padding-bottom: 0.75em; + color: #60C030; + background: transparent; +} + +p, td { + padding-left: 5%; + padding-right: 15%; + text-align: justify; +} + +blockquote +{ + padding-left: 5%; + padding-right: 5%; + padding-top: 0.5em; + padding-bottom: 1.5em; + text-align: left; + font-style: italic; +} + +pre, code, tt, kbd, samp +{ + font-family: monospace; + color: green; + background-color: black; +} + +var, cite, dfn, dd +{ + font-style: italic; +} + +address +{ + font-style: normal; + font-family: cursive; + letter-spacing: .1em; +} + + +img +{ + padding: 4px; +} + + +ins +{ + text-decoration: underline; +} + +del +{ + color: lime; + background-color: red; +} + +/* footer of the page - not-editable, provided by Smeagol */ +footer { + border-top: thin solid green; + background-color: rgba( 0, 0, 0, 0.7); + clear: both; + font-size: smaller; + text-align: center; + width: 100%; + margin: 0; + min-height: 4px; + 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 { + display: none; + padding: 0.1em; +} + +footer:hover div { + display: block; +} + +.activenav +{ + background: transparent url( /~simon/images/greenshade.png); + color: #008000; + padding: 0em 2em 0em 1em; +} +.navigation +{ + background: transparent; + color: #008000; + padding: 0em 2em 0em 1em; +} +.navbox +{ + background: transparent; + position: fixed; + overflow: visible; + top: 0; + bottom: 50%; + right: 0; + left: 75%; +} + +.illustration +{ + float: right; + width: 310px; + padding: 10px; + margin: 10px; + border: thin solid #008000; + font-size: 80%; + font-style: italic; + background: transparent url( /~simon/images/graduated_pinstripe.png) no-repeat; +} + + +.illustration IMG +{ + float: right; +} + +.warning, .actionDangerous +{ + text-transform: none; + font-style: normal; + font-weight: bolder; + background: red; + color: yellow; + +} + +.actionSafe +{ +} + + +.prompt +{ + font-style: normal; + font-weight: bolder; +} + +.widget +{ +} + +.help +{ + font-style: italic; +} + +a:link +{ + color: rgb( 128, 255, 0); + background: transparent; +} + + +a:visited +{ + color: lime; + background: transparent; +} + + +a:active +{ + color: rgb( 128, 255, 0); + background: transparent; +} + + +a:hover +{ + color: yellow; + background: #408020; + +} + + +/* left bar for all pages in the Wiki - editable, provided by users. Within main-container */ +#side-bar { + border: thin solid green; + border-radius: 0.5em; + width: 17%; + height: 100%; + float: right; +} + +/* cookies information box, fixed, in right margin, just above footer */ +#cookies { + width: 20%; + float: right; + position: fixed; + bottom: 8px; + right: 0; + z-index: 175; + background: transparent; +} + +/* about-cookies box: permanently visible part of cookies information box */ +#about-cookies { + clear: right; + font-size: 66%; + float: right; + text-align: right; + padding: 0.25em 2em; + border-radius: 0.25em; + color: darkgreen; + background-color: rgba( 0, 0, 0, 0.7); +} + +/* more-about-cookies box, normally hidden */ +#more-about-cookies { + display: none; + padding: 0.5em 2em; + border: thin solid darkgreen; + border-radius: 0.5em; + color: darkgreen; + background-color: rgba( 0, 0, 0, 0.7); +} + +/* but magically appears on mouseover */ +#cookies:hover #more-about-cookies { + display: block; +} + + +.minor-controls { + list-style: none; + float: right; + right: 0; + padding: 0.25em 2em; + color: darkgreen; + background-color: rgba( 0, 0, 0, 0.7); + font-size: 66%; +} + +.minor-controls li { +/* display: inline; */ +} + +.minor-controls a { + padding: 0.25em 2em; + color: darkgreen; +} + +.minor-controls a:hover { + color: lime; +} + +.pseudo-input { + border: inset thin; + background-color: lime; + color: black; + display: inline-block; + min-width: 7.5em; + padding: 0 2em 0 0; +} + +.sanity-cause .sanity-stacktrace { + display: none; +} + +.sanity-cause:hover .sanity-stacktrace { + display: block; +} + +.vega-bindings, .vega-actions { + font-size: 66%; +} + +/* Add space between Vega-Embed links */ +.vega-actions a { + margin-right: 5px; +} + +.warn { + color: maroon; +} + +.widget { + background-color: #222; + border: thin solid green; + margin-top: 0; + margin-bottom: 0; + width: 100%; +} + +.wiki { + margin: 0; +} + +/* desktops and laptops, primarily. Adapted to mouse; targets may be small */ +@media all and (min-device-width: 1025px) { + #side-bar { + border: thin solid green; + border-radius: 0.5em; + float: right; + width: 17%; + padding-left: 2em; + padding-right: 2em; + padding-bottom: 2.5em; + } + + #side-bar ul { + list-style: none; + } + + /* content of the current page in the Wiki - editable, provided by users. Within main-container */ + #content { + width: 80%; + padding-left: 5%; + 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; + _position: absolute; + _top: expression(document.documentElement.scrollTop); + z-index: 149; + color: darkgreen; + } + + #nav #nav-menu { + display: none; + } + + #nav:hover #nav-menu { + display: block; + } + + /* only needed for fly-out menu effect on tablet and phone stylesheets */ + #nav-icon { + display: none; + } + + #nav-menu { + margin: 0; + padding: 0; + } + + #nav menu li { + padding: 0; + margin: 0; + display: inline; + } + + #nav menu li a { + color: darkgreen; + text-decoration: none; + font-weight: bold; + padding: 0.1em 0.75em; + margin: 0; + } + + #nav menu li.active a { background: darkgreen; color: lime;} + li.nav-item a:hover { background: rgb( 240, 240, 240) } + li.nav-item a:active { background: darkgreen; color: lime; } + + #nav menu li#user { + padding: 0 1em; + float: right; + } +} + +/* tablets, primarily. Adapted to touch; targets are larger */ +@media all and (min-device-width: 769px) and (max-device-width: 1024px) { + h1 { + /* I wouldn't normally use a px value, but the menu icon is 49px wide */ + padding: 0.25em 5%; + padding-left: 100px; + } + + /* content of the current page in the Wiki - editable, provided by users. Within main-container */ + #content { + border: thin solid green; + width: 80%; + float: right; + padding-bottom: 5em; + } + + #nav{ + margin: 0; + padding: 0; + position: fixed; + z-index: 149; + color: black; + background:rgba(200,200,200,0.9); + } + + #nav a { + font-weight: bold; + } + + #nav:hover #nav-menu, #nav:hover #phone-side-bar { + display: block; + list-style-type: none; + width: 100%; + } + + #nav-icon { + padding: 0; + } + + #nav-menu, #phone-side-bar { + display: none; + } + + #nav menu li { + padding: 0.5em; + margin: 0.5 em; + font-size: 150%; + } + + #nav menu li a { + } + + #nav ul li.active a { background: green;} + li.nav-item a:hover { background: rgb( 240, 240, 240) } + li.nav-item a:active { background: darkgreen; color: lime; } + + #nav menu #user { + text-decoration: none; + font-weight: bold; + margin: 0; + } +} + +/* phones, and, indeed, smaller phones. Adapted to touch; display radically + * decluttered */ +@media all and (max-device-width: 768px) { + footer { + display: none; + } + + h1 { + /* I wouldn't normally use a px value, but the menu icon is 49px wide */ + padding: 0.25em 5%; + padding-left: 100px; + text-align: left; + } + + /* content of the current in the Wiki - editable, provided by users. Within main-container */ + #content { + border: thin solid green; + width: 100%; + padding-bottom: 2em; + } + + #main-container { + width: 100%; + margin: 0; + padding: 2.5em 0; + } + + + #cookies { + display: none; + } + + #header { + display: none; + } + + #nav{ + margin: 0; + padding: 0; + position: fixed; + z-index: 149; + color: black; + background:rgba(200,200,200,0.9); + } + + #nav a { + color: black; + font-weight: bold; + } + + #nav:hover #nav-menu, #nav:hover #phone-side-bar { + display: block; + list-style-type: none; + width: 100%; + } + + #nav-icon { + padding: 0; + } + + #nav-menu, #phone-side-bar { + display: none; + } + + #nav menu li { + padding: 0.5em; + margin: 0.5 em; + font-size: 150%; + } + + #nav menu li a { + font-weight: bold; + } + + #nav ul li.active a { background: green;} + li.nav-item a:hover { background: rgb( 240, 240, 240) } + li.nav-item a:active { background: darkgreen; color: lime; } + + #nav menu #user { + text-decoration: none; + font-weight: bold; + margin: 0; + } + + #side-bar { + display: none; + } +} From 4003c0295f4a299334875ae367ee2c67d3b46aae Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Thu, 27 Feb 2020 00:09:20 +0000 Subject: [PATCH 2/3] Better grammar --- resources/public/content/Extensible Markup.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/public/content/Extensible Markup.md b/resources/public/content/Extensible Markup.md index 5a91d7f..91c10fb 100644 --- a/resources/public/content/Extensible Markup.md +++ b/resources/public/content/Extensible Markup.md @@ -8,7 +8,7 @@ Allows you to embed maps with markers on them into Wiki pages. To embed a map, s The CSV must have the column titles in the first line, and must have columns called `latitude` and `longitude`, which must both contain floating point numbers, not degrees, minutes and seconds. The CSV *may* also have a column called `name`, which will be used as the heading for the popup that shows if you click an image, and a column named category. If the category column is present, and contains a value in a given row, the marker image for the marker for that row will the uploaded file whose name is that value followed by `-pin.png`. -Here's an example: the capital cities of Europe. +Here's an example: the capital cities of Europe. You can use local links in the CSV values, as you will see if you select the pin on Iceland, but not in the column titles. ```geocsv Country,Name,Latitude,Longitude,CountryCode,Continent,Category From cf227b498a30c7c9679e2d9bc8f4d3fd0f339146 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Sat, 29 Feb 2020 19:23:34 +0000 Subject: [PATCH 3/3] I *think* I've fixed the Tomcat redirect bug. --- resources/public/content/Iceland.md | 9 +++++++++ src/smeagol/extensions/geocsv.clj | 2 +- src/smeagol/routes/wiki.clj | 8 ++++++-- src/smeagol/util.clj | 10 ++++++++++ 4 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 resources/public/content/Iceland.md diff --git a/resources/public/content/Iceland.md b/resources/public/content/Iceland.md new file mode 100644 index 0000000..f6877cb --- /dev/null +++ b/resources/public/content/Iceland.md @@ -0,0 +1,9 @@ +Iceland (Icelandic: *Ísland*) is a Nordic island country in the North Atlantic, with a population of 360,390 and an area of 103,000 km2 (40,000 sq mi), making it the most sparsely populated country in Europe. The capital and largest city is Reykjavík. Reykjavik and the surrounding areas in the southwest of the country are home to over two-thirds of the population. Iceland is volcanically and geologically active. The interior consists of a plateau characterised by sand and lava fields, mountains, and glaciers, and many glacial rivers flow to the sea through the lowlands. Iceland is warmed by the Gulf Stream and has a temperate climate, despite a high latitude just outside the Arctic Circle. Its high latitude and marine influence keep summers chilly, with most of the archipelago having a tundra climate. + +![Eyjafjallajökull glacier; photo by Andreas Tille](uploads/med/Eyjafjallajökull.jpg) + +According to the ancient manuscript *Landnámabók*, the settlement of Iceland began in 874 AD when the Norwegian chieftain Ingólfr Arnarson became the first permanent settler on the island. In the following centuries, Norwegians, and to a lesser extent other Scandinavians, emigrated to Iceland, bringing with them thralls (i.e., slaves or serfs) of Gaelic origin. + +The island was governed as an independent commonwealth under the *Alþingi*, one of the world's oldest functioning legislative assemblies. Following a period of civil strife, Iceland acceded to Norwegian rule in the 13th century. The establishment of the Kalmar Union in 1397 united the kingdoms of Norway, Denmark, and Sweden. Iceland thus followed Norway's integration into that union, coming under Danish rule after Sweden's secession from the union in 1523. Although the Danish kingdom introduced Lutheranism forcefully in 1550, Iceland remained a distant semi-colonial territory in which Danish institutions and infrastructures were conspicuous by their absence. + +In the wake of the French Revolution and the Napoleonic Wars, Iceland's struggle for independence took form and culminated in independence in 1918 and the founding of a republic in 1944. Although its parliament (Althing) was suspended from 1799 to 1845, the island republic has been credited with sustaining the world's oldest and longest-running parliament. \ No newline at end of file diff --git a/src/smeagol/extensions/geocsv.clj b/src/smeagol/extensions/geocsv.clj index 95c06b8..58523f5 100644 --- a/src/smeagol/extensions/geocsv.clj +++ b/src/smeagol/extensions/geocsv.clj @@ -48,7 +48,7 @@ GeoCSV.setIconUrlBase( \"" (-> config :formatters :geocsv :icon-url-base) "\"); GeoCSV.initialiseMapElement(\"geocsv-" index "\", - document.getElementById(\"geocsv-" index "\").innerText.trim().replace(/\\[\\[([^\\[\\]]*)\\]\\]/, \"$1\")); + document.getElementById(\"geocsv-" index "\").innerText.trim().replace(/\\[\\[([^\\[\\]]*)\\]\\]/g, \"$1\")); }}; //]] diff --git a/src/smeagol/routes/wiki.clj b/src/smeagol/routes/wiki.clj index d529104..e5ae10a 100644 --- a/src/smeagol/routes/wiki.clj +++ b/src/smeagol/routes/wiki.clj @@ -32,7 +32,8 @@ [smeagol.configuration :refer [config]] [smeagol.include.resolve-local-file :as resolve] [smeagol.include :as include] - [smeagol.util :refer [content-dir local-url local-url-base upload-dir]])) + [smeagol.util :refer [content-dir get-servlet-context-path + local-url local-url-base upload-dir]])) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; @@ -398,7 +399,10 @@ (and username password (auth/authenticate username password)) (do (session/put! :user username) - (response/redirect redirect-to)) + (response/redirect + (or + redirect-to + (get-servlet-context-path request)))) true (layout/render "auth.html" (merge (util/standard-params request) diff --git a/src/smeagol/util.clj b/src/smeagol/util.clj index 5cda9ee..c91f981 100644 --- a/src/smeagol/util.clj +++ b/src/smeagol/util.clj @@ -156,6 +156,16 @@ :version (System/getProperty "smeagol.version")})) +(defn get-servlet-context-path + [request] + (if-let [context (:servlet-context request)] + ;; If we're not inside a serlvet environment (for + ;; example when using mock requests), then + ;; .getContextPath might not exist + (try (.getContextPath context) + (catch IllegalArgumentException _ context)))) + + (def get-messages "Return the most acceptable messages collection we have given the `Accept-Language` header in this `request`."