Skip to content

Commit

Permalink
Merge tag 'smeagol-1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 19, 2020
2 parents 852f4a6 + be3c9fc commit 8618926
Show file tree
Hide file tree
Showing 44 changed files with 2,954 additions and 331 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ smeagol.log*
/node_modules/
.DS_Store


resources/public/content/uploads/
1,339 changes: 1,339 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

22 changes: 15 additions & 7 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
(defproject smeagol "1.0.3"
(defproject smeagol "1.0.4"
:description "A simple Git-backed Wiki inspired by Gollum"
:url "https://github.com/simon-brooke/smeagol"
:license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
:url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
:dependencies [[clj-jgit "0.8.10"]
[clj-yaml "0.4.0"]
[clojure.java-time "0.3.2"]
[com.cemerick/url "0.1.1"]
[com.fzakaria/slf4j-timbre "0.3.7"]
[com.stuartsierra/component "0.4.0"]
Expand All @@ -15,14 +16,18 @@
[environ "1.1.0"]
[hiccup "1.0.5"]
[im.chit/cronj "1.4.4"]
[image-resizer "0.1.10"]
[instaparse "1.4.10"]
[lib-noir "0.9.9" :exclusions [org.clojure/tools.reader]]
[markdown-clj "0.9.99" :exclusions [com.keminglabs/cljx]]
[me.raynes/fs "1.4.6"]
[noir-exception "0.2.5"]
[org.clojars.simon_brooke/internationalisation "1.0.3"]
[org.clojure/clojure "1.8.0"]
[org.clojure/core.memoize "0.5.9"]
[org.clojure/data.json "0.2.6"]
[org.clojure/tools.logging "0.4.0"]
[org.clojure/tools.trace "0.7.10"]
[org.slf4j/slf4j-api "1.7.25"]
[org.slf4j/log4j-over-slf4j "1.7.25"]
[org.slf4j/jul-to-slf4j "1.7.25"]
Expand All @@ -38,18 +43,21 @@
:jvm-opts ["-server"]

:plugins [[lein-ancient "0.5.5" :exclusions [org.clojure/clojure org.clojure/data.xml]]
[lein-bower "0.5.1"]
[lein-codox "0.10.3"]
[io.sarnowski/lein-docker "1.0.0"]
[lein-environ "1.0.0"]
[lein-marginalia "0.7.1" :exclusions [org.clojure/clojure]]
[lein-npm "0.6.2"]
[lein-ring "0.12.5" :exclusions [org.clojure/clojure]]]

:bower-dependencies [[simplemde "1.11.2"]
;; [vega-embed "3.0.0-beta.20"] ;; vega-embed currently not loaded from Bower because of
;; dependency conflict which will hopefully be resolved soon.
[vega-lite "2.0.0-beta.11"]
[mermaid "6.0.0"]]
:npm {:dependencies [[simplemde "1.11.2"]
[vega "5.8.0"]
[vega-embed "6.2.2"]
[vega-lite "4.1.1"]
[mermaid "8.4.6"]
[photoswipe "4.1.3"]
[tablesort "5.2.0"]]
:root "resources/public/vendor"}

:docker {:image-name "simonbrooke/smeagol"
:dockerfile "Dockerfile"}
Expand Down
46 changes: 40 additions & 6 deletions resources/config.edn
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,50 @@
;; ; ; ; ; ; ; ; ; ;
{
:content-dir "resources/public/content"
:start-page "Introduction"
;; where content is served from.
:default-locale "en-GB" ;; default language used for messages
:formatters {"vega" smeagol.formatting/process-vega
"vis" smeagol.formatting/process-vega
"mermaid" smeagol.formatting/process-mermaid
"backticks" smeagol.formatting/process-backticks}
:extensions-from :local ;; where to load JavaScript libraries
;; from: options are :local, :remote.
:formatters ;; formatters for processing markdown
;; extensions.
{:backticks {:formatter "smeagol.formatting/process-backticks"
:scripts {}
:styles {}}
:mermaid {:formatter "smeagol.extensions.mermaid/process-mermaid"
:scripts {:core {:local "vendor/node_modules/mermaid/dist/mermaid.min.js"
:remote "https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.4.6/mermaid.min.js"}}}
:pswp {:formatter "smeagol.extensions.photoswipe/process-photoswipe"
:scripts {:core {:local "vendor/node_modules/photoswipe/dist/photoswipe.min.js"
:remote "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js"}
:ui {:local "vendor/node_modules/photoswipe/dist/photoswipe-ui-default.min.js"
:remote "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js"}}
:styles {:core {:local "vendor/node_modules/photoswipe/dist/photoswipe.css"}
:skin {:local "vendor/node_modules/photoswipe/dist/default-skin/default-skin.css"}}}
:test {:formatter "smeagol.extensions.test/process-test" }
:vega {:formatter "smeagol.extensions.vega/process-vega"
:scripts {:core {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega/5.9.1/vega.min.js"}
:lite {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/4.1.1/vega-lite.min.js"}
:embed {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/6.2.2/vega-embed.min.js"}}}
:vis {:formatter "smeagol.extensions.vega/process-vega"
:scripts {:core {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega/5.9.1/vega.min.js"}
:lite {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega-lite/4.1.1/vega-lite.min.js"}
:embed {:remote "https://cdnjs.cloudflare.com/ajax/libs/vega-embed/6.2.2/vega-embed.min.js"}}}}
:log-level :info ;; the minimum logging level; one of
;; :trace :debug :info :warn :error :fatal
:passwd "resources/passwd"
;; where the password file is stored
:site-title "Smeagol"} ;; overall title of the site, used in
:site-title "Smeagol" ;; overall title of the site, used in
;; page headings
:start-page "Introduction" ;; the page shown to a visitor to the
;; root URL.
:thumbnails {:small 64 ;; maximum dimension of thumbnails
;; stored in the /small directory
:med 400 ;; maximum dimension of thumbnails
;; stored in the /med directory
;; you can add as many extra keys and values as
;; you like here for additional sizes of images.
;; Images will only be scaled if their maximum
;; dimension (in pixels) is greater than the value;
;; only JPEG and PNG images will be scaled.
}
}
9 changes: 7 additions & 2 deletions resources/i18n/en-GB.edn
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,17 @@
:file-upload-title "Upload a file" ;; title for the file upload page
:is-admin-prompt "Is administrator?"
:here "here" ;; used in sanity check report
:history-link "History" ;; text of the history link on the content frame
:history-title-prefix "History of" ;; prefix of the title on the history page
:home-link "Home" ;; text of the home link on the menu
:is-not-directory "is not a directory"
;; (of a file or directory) used in sanity check report
:is-not-readable "is not readable"
;; (of a file or directory) used in sanity check report
:is-not-writable "is not writable"
;; (of a file or directory) used in sanity check report
:list-files "List uploaded files"
;; title of the 'List uploaded Files' page
:login-label "Log in!" ;; text of the login widget on the login page
:login-link "Log in" ;; text of the login link on the menu
:login-prompt "To edit this wiki"
Expand All @@ -98,8 +102,7 @@
:logout-link "Log out" ;; text of the logout link on the menu
:logged-in-as "You are logged in as"
;; text of the 'logged in as' label on the menu
:history-link "History" ;; text of the history link on the content frame
:history-title-prefix "History of" ;; prefix of the title on the history page
:matching "matching" ;; 'matching' in e.g. 'list files matching fred'
:new-pass-prompt "New password" ;; text of the new password widget prompt on the change
;; password and edit user pages
:no-admin-users "There are no users in the 'passwd' file with administrative privileges"
Expand Down Expand Up @@ -128,6 +131,8 @@
"Smeagol has been unable to find some of the resources on which it depends,
possibly because of misconfiguration or missing environment variables."
;; used in sanity check report
:sortable "You can sort this table by selecting column headers"
;; used for sortable tables
:user-lacks-field "User record in the passwd file lacks a field"
;; used in sanity check report
:username-prompt "Username" ;; text of the username widget prompt on edit user page
Expand Down
33 changes: 0 additions & 33 deletions resources/public/content/Configuration.md

This file was deleted.

102 changes: 102 additions & 0 deletions resources/public/content/Configuring Smeagol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
Smeagol's core configuration comes from a configuration file, `config.edn`, which may be overridden by [[Environment Variables]]. The default file is at `resources/config.edn`; this default can be overridden by providing an environment variable, `SMEAGOL_CONFIG`, whose value is the full or relative pathname of a suitable file.


The default configuration file is as follows:

```
{
:content-dir "resources/public/content"
;; where content is served from.
:default-locale "en-GB" ;; default language used for messages
:formatters ;; formatters for processing markdown
;; extensions.
{"vega" smeagol.formatting/process-vega
"vis" smeagol.formatting/process-vega
"mermaid" smeagol.extensions.mermaid/process-mermaid
"backticks" smeagol.formatting/process-backticks
"pswp" smeagol.formatting/process-photoswipe}
:log-level :info ;; the minimum logging level; one of
;; :trace :debug :info :warn :error :fatal
:js-from :cdnjs ;; where to load JavaScript libraries
;; from: options are :local, :cdnjs
:passwd "resources/passwd"
;; where the password file is stored
:site-title "Smeagol" ;; overall title of the site, used in
;; page headings
:start-page "Introduction" ;; the page shown to a visitor to the
;; root URL.
:thumbnails {:small 64 ;; maximum dimension of thumbnails
;; stored in the /small directory
:med 400 ;; maximum dimension of thumbnails
;; stored in the /med directory
}}
```


## content-dir

The value of `content-dir` should be the full or relative path to the content to be served: the Markdown files, and the upload directories. Full paths are advised, where possible. The directory must be readable and writable by the process running Smeagol. The default is `resources/public/conten`


The value from the configuration file may be overridden with the value of the environment variable `SMEAGOL_CONTENT_DIR`.


## default-locale

The locale which you expect the majority of your visitors will use. Content negotiation will be done of course, and the best internationalisation file available will be used, but this sets a default for users who do not have any acceptable locale known to us. The default value is `en-GB`.


This parameter may be overridden with the environment variable `SMEAGOL-DEFAULT-LOCALE`.


## formatters

Specifications for formatters for markup extensions. The exact data stored will change before Smeagol 1.1.0. TODO: update this.


## log-level

The level at which logging should operate. Each setting implies all of the settings more severe than itself so


1. setting `:debug` will log all of `debug, info, warn, error` and| `fatal` messages;

2. setting `:info` will log all of `info, warn, error` and| `fatal` messages;


and so on, so that setting `:fatal` will show only messages which report reasons for Smeagol to fail.


The default setting is `:info`.


This parameter may be overridden with the environment variable `SMEAGOL-LOG-LEVEL`.

## TODO: Complete this doumentation!
2 changes: 1 addition & 1 deletion resources/public/content/Docker Image.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Where 127.0.0.1 is the IP address through which you want to forward port 80 (in

You can then browse to Smeagol by pointing your browser at http://localhost/.

As of version 0.99.10, the Docker image is now based on the Jetty, rather than the Tomcat, deployment of Smeagol (that is to say, it runs the executable jar file). This makes for a lighter weight Docker image. All configuration can be overridden with [[Environment Variables]], which can be passed into the Docker container when the image is invoked, or from a [[Configuration]] file.
As of version 0.99.10, the Docker image is now based on the Jetty, rather than the Tomcat, deployment of Smeagol (that is to say, it runs the executable jar file). This makes for a lighter weight Docker image. All configuration can be overridden with [[Environment Variables]], which can be passed into the Docker container when the image is invoked, or from a Configuration file, see [[Configuring Smeagol]].

The `config.edn` and `passwd` files and the `content` directory are copied into `/usr/local/etc` in the Docker image, and the appropriate environment variables are set up to point to them:
```
Expand Down
60 changes: 60 additions & 0 deletions resources/public/content/Example gallery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## How this works

The specification for this gallery is as follows:

```
{
slides: [
{ src: 'content/uploads/g1.jpg', w: 2592, h:1944,
title: 'Frost on a gate, Laurieston' },
{ src: 'content/uploads/g2.jpg', w: 2560, h:1920,
title: 'Feathered crystals on snow surface, Taliesin' },
{ src: 'content/uploads/g3.jpg', w: 2560, h:1920,
title: 'Feathered snow on log, Taliesin' },
{ src: 'content/uploads/g4.jpg', w: 2560, h:1920,
title: 'Crystaline growth on seed head, Taliesin' }],
options: {
timeToIdle: 100
},
openImmediately: true
}
```

The format of the specification is [JSON](https://www.json.org/json-en.html); there are (at present) three keys, as follows

### slides

Most be present. The value of `slides` is a list delimited by square brackets of slide objects. For more information, see the [authoritative documentation](https://photoswipe.com/documentation/getting-started.html) under the sub heading **'Creating an Array of Slide Objects'**.

### options

Optional. The value of `options` is a JSON object [as documented here](https://photoswipe.com/documentation/options.html).

### openImmediately

Optional. If the value of `openImmediately` is `true`, the gallery will open immediately, covering the whole page. If false, only a button with the label 'Open the gallery' will be shown. Selecting this button will cause the gallery to open.

## The Gallery

This page holds an example Photoswipe gallery.

```pswp
{
slides: [
{ src: 'content/uploads/g1.jpg', w: 2592, h:1944,
title: 'Frost on a gate, Laurieston' },
{ src: 'content/uploads/g2.jpg', w: 2560, h:1920,
title: 'Feathered crystals on snow surface, Taliesin' },
{ src: 'content/uploads/g3.jpg', w: 2560, h:1920,
title: 'Feathered snow on log, Taliesin' },
{ src: 'content/uploads/g4.jpg', w: 2560, h:1920,
title: 'Crystaline growth on seed head, Taliesin' }],
options: {
timeToIdle: 100
},
openImmediately: true
}
```

Loading

0 comments on commit 8618926

Please sign in to comment.