diff --git a/resources/config.edn b/resources/config.edn index 78390bb..35a85e4 100644 --- a/resources/config.edn +++ b/resources/config.edn @@ -28,22 +28,25 @@ ;; ; ; ; ; ; ; ; ; ; { :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 + :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 :cloudflare ;; where to load JavaScript libraries - ;; from: options are :local, :cloudflare + :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 diff --git a/resources/public/content/Configuration.md b/resources/public/content/Configuration.md deleted file mode 100644 index 4e5d987..0000000 --- a/resources/public/content/Configuration.md +++ /dev/null @@ -1,33 +0,0 @@ -Smeagol reads a configuration file, whose content should be formatted as a clojure map. - -The default content is as follows: - -``` -{ - :site-title "Smeagol" ;; overall title of the site, used in page headings - :default-locale "en-GB" ;; default language used for messages - :content-dir "/usr/local/etc/content" - ;; where content is served from - :passwd "/usr/local/etc/passwd" - ;; where the password file is stored - :log-level :info ;; the minimum logging level; one of - ;; :trace :debug :info :warn :error :fatal - :formatters {"vega" smeagol.formatting/process-vega - "vis" smeagol.formatting/process-vega - "mermaid" smeagol.formatting/process-mermaid - "backticks" smeagol.formatting/process-backticks} -} -``` - -The values should be: - -* `:content-dir` The directory in which your editable content is stored; -* `:default-locale` A string comprising a lower-case [ISO 639](https://en.wikipedia.org/wiki/ISO_639) code specifying a language, optionally followed by a hyphen and an upper-case [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166) specifying a country. -* `:formatters` A map of formatters used in [[Extensible Markup]], q.v. -* `:log-level` The minimum level of log messages to be logged; one of `:trace :debug :info :warn :error :fatal` -* `:passwd` The path to your `passwd` file - see [[Security and authentication]]; -* `:site-title` The title for your wiki. - -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. - -Note that all the values in the configuration can be overridden with [[Environment Variables]]. diff --git a/resources/public/content/Configuring Smeagol.md b/resources/public/content/Configuring Smeagol.md new file mode 100644 index 0000000..8f6472e --- /dev/null +++ b/resources/public/content/Configuring Smeagol.md @@ -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! diff --git a/resources/public/content/Docker Image.md b/resources/public/content/Docker Image.md index 9341628..2a3f766 100644 --- a/resources/public/content/Docker Image.md +++ b/resources/public/content/Docker Image.md @@ -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: ``` diff --git a/resources/public/content/User Documentation.md b/resources/public/content/User Documentation.md index 51489af..604f317 100644 --- a/resources/public/content/User Documentation.md +++ b/resources/public/content/User Documentation.md @@ -67,7 +67,7 @@ To upload a file (including an image file), select the link `Upload a file` from Selecting the link will take you to the `Upload a file` page. This will prompt you for the file you wish to upload. Select your file, and then select the green `Save!` button. -After your file has uploaded, you will be shown a link which can be copied and pasted into a Wiki page to link to that file. +After your file has uploaded, you will be shown a link which can be copied and pasted into a Wiki page to link to that file. When you upload a PNG or JPG image file, multiple copies of the file may be saved at different resolutions, and you will be shown links to each of these. The `Upload a file` form also has a link to the list of all files which have been uploaded, to help with finding the one you're looking for! You must be logged in to upload files. diff --git a/resources/public/content/_side-bar.md b/resources/public/content/_side-bar.md index ad01779..6cfc4f2 100644 --- a/resources/public/content/_side-bar.md +++ b/resources/public/content/_side-bar.md @@ -1,6 +1,7 @@ * [[Introduction]] * [[Change log]] * [[User Documentation]] +* [[Configuring Smeagol]] * [[Deploying Smeagol]] * [[Developing Smeagol]] diff --git a/resources/templates/wiki.html b/resources/templates/wiki.html index 9413902..cf0655e 100644 --- a/resources/templates/wiki.html +++ b/resources/templates/wiki.html @@ -2,10 +2,10 @@ {% block extra-headers %} - {% script "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe-ui-default.min.js" %} - {% script "https://cdnjs.cloudflare.com/ajax/libs/photoswipe/4.1.3/photoswipe.min.js" %} - {% style "vendor/node_modules/photoswipe/dist/photoswipe.css" %} - {% style "vendor/node_modules/photoswipe/dist/default-skin/default-skin.css" %} + + + {% style "/vendor/node_modules/photoswipe/dist/photoswipe.css" %} + {% style "/vendor/node_modules/photoswipe/dist/default-skin/default-skin.css" %} diff --git a/src/smeagol/routes/wiki.clj b/src/smeagol/routes/wiki.clj index 95c1828..e33cbdc 100644 --- a/src/smeagol/routes/wiki.clj +++ b/src/smeagol/routes/wiki.clj @@ -240,12 +240,13 @@ uploaded (if upload (ul/store-upload params data-path)) user (session/get :user) summary (format "%s: %s" user (or (:summary params) "no summary"))] -;; (if -;; uploaded +;; TODO: Get this working! it MUST work! +;; (if-not +;; (empty? uploaded) ;; (do ;; (map ;; #(git/git-add git-repo (str :resource %)) -;; uploaded) +;; (remove nil? uploaded)) ;; (git/git-commit git-repo summary {:name user :email (auth/get-email user)}))) (layout/render "upload.html" (merge (util/standard-params request)