From d4ed336827d016564ef2530c1a43b78b4b658881 Mon Sep 17 00:00:00 2001 From: Simon Brooke Date: Thu, 7 Sep 2017 14:44:13 +0100 Subject: [PATCH] Mainly internationalisation improvements - not finished yet. --- README.md | 2 + project.clj | 2 +- resources/i18n/en-GB.edn | 107 ------------------ resources/i18n/en.edn | 1 - resources/passwd | 2 +- resources/public/contentDeveloping Smeagol.md | 55 --------- resources/templates/auth.html | 12 +- resources/templates/base.html | 22 ++-- resources/templates/edit-css.html | 6 +- resources/templates/edit-user.html | 14 +-- resources/templates/edit-users.html | 8 +- resources/templates/edit.html | 6 +- resources/templates/history.html | 8 +- resources/templates/passwd.html | 10 +- resources/templates/upload.html | 10 +- resources/templates/wiki.html | 4 +- src/smeagol/authenticate.clj | 4 +- src/smeagol/layout.clj | 23 +++- src/smeagol/routes/admin.clj | 6 +- src/smeagol/routes/wiki.clj | 2 +- src/smeagol/util.clj | 20 ++-- 21 files changed, 90 insertions(+), 234 deletions(-) delete mode 100644 resources/i18n/en-GB.edn delete mode 120000 resources/i18n/en.edn delete mode 100644 resources/public/contentDeveloping Smeagol.md diff --git a/README.md b/README.md index feeb116..03cd9d1 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ Smeagol is a simple Wiki engine inspired by [Gollum](https://github.com/gollum/g So at this stage Smeagol is a Wiki engine written in Clojure which uses Markdown as its text format, which does have user authentication, and which uses Git as its versioning and backup system. + + ## Status Smeagol is now a fully working small Wiki engine, and meets my own immediate needs. diff --git a/project.clj b/project.clj index d69830c..98d4e2a 100644 --- a/project.clj +++ b/project.clj @@ -8,7 +8,7 @@ [org.clojure/core.memoize "0.5.9"] [org.clojure/data.json "0.2.6"] [org.clojure/tools.logging "0.4.0"] - [org.clojars.simon_brooke/internationalisation "1.0.0"] + [org.clojars.simon_brooke/internationalisation "1.0.1-SNAPSHOT"] [clj-jgit "0.8.9"] [clj-yaml "0.4.0"] [com.cemerick/url "0.1.1"] diff --git a/resources/i18n/en-GB.edn b/resources/i18n/en-GB.edn deleted file mode 100644 index 775818d..0000000 --- a/resources/i18n/en-GB.edn +++ /dev/null @@ -1,107 +0,0 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;; -;;;; 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 -;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;;; en-GB.edn: English-language messages. -;;; This is essentially all the text in the chrome - that which isn't editable -;;; through the wiki itself - -;; ; ; ; ; ; ; ; ; ; -{:add-user-label "Add new user" ;; label for the add user link on edit users page - :change-pass-label "Change password!" - ;; text of the change password widget itself on the - ;; change password page - :change-pass-link "Change password" - ;; text of the change password link on the menu - :change-pass-prompt "To change your password" - ;; text of the change password widget prompt on the - ;; change password page - :change-col-hdr "Changes" ;; header for the changes column in history - :chpass-bad-match "Your proposed passwords don't match" - ;; error text if proposed passwords don't match - :chpass-fail "Your password was not changed" - ;; error text on fail other htan too short or bad match - :chpass-success "Your password was changed" - ;; confirmation text on password change - :chpass-too-short "You proposed password wasn't long enough: eight characters required" - ;; error text if proposed password is too short - :chpass-title-prefix "Change password for" - ;; prefix for title of change password page - :cookies-about "About cookies" ;; about cookies text - :cookies-more "This website stores session information as a 'cookie' on your browser. This helps us show you the content you want to see. This cookie does not identify you, and cannot be read by other websites. It is deleted by your browser as soon as you leave this site. This website does not use any third party cookies, so your visit here cannot be tracked by other websites." - ;; more about cookies text - :default-page-title "Introduction" ;; title of the default page in this wiki - :del-col-hdr "Delete" ;; header for delete column on edit users page - :del-user-fail "Could not delete user" - ;; error message on failure to delete user - :del-user-success "Successfully deleted user" - ;; confirmation message on deletion of user - :diff-title-prefix "Changes since version" - ;; prefix for the header of the changes page - :edit-col-hdr "Edit" ;; header for edit column on edit users page - :edit-page-link "Edit this page" - ;; text of the edit page link on the content frame - :edit-title-prefix "Edit" ;; prefix for title of edit content page - :edit-users-link "Edit users" ;; text of the edit users link on the menu - :edit-users-title "Select user to edit" - ;; title of edit users page - :email-prompt "Email address" ;; text of the email widget prompt on edit user page - :file-upload-link-text "You may link to this file using a link of the form" - ;; Text introducing the link to an uploaded file - :file-upload-prompt "File to upload" ;; prompt string for the file upload widget - :file-upload-title "Upload a file" ;; title for the file upload page - :is-admin-prompt "Is administrator?" - :home-link "Home" ;; text of the home link on the menu - :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" - ;; text of the action widget prompt on the login page - :logout-label "Log out!" ;; text of the logout widget on the logout page - :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 - :new-pass-prompt "New password" ;; text of the new password widget prompt on the change - ;; password and edit user pages - :old-pass-prompt "Your password" - ;; text of the old password widget prompt on the change - ;; password page, and password widget on login page - :rpt-pass-prompt "And again" ;; text of the new password widget prompt on the change - ;; password and edit user pages - :save-prompt "When you have finished editing" - ;; text of the save widget label on edit content - ;; and edit user page - :save-label "Save!" ;; text of the save widget itself - :save-user-fail "Failed to store user" - :save-user-success "Successfully stored user" - :username-prompt "Username" ;; text of the username widget prompt on edit user page - ;; text of the is admin widget prompt on edit user page - :user-title-prefix "Edit user" ;; prefix for title of edit user page - :vers-col-hdr "Version" ;; header for the version column in history - :what-col-hdr "What" ;; header for the what column in history - :what-changed-prompt "What have you changed?" - ;; text of the summary widget prompt on edit - ;; content page - :when-col-hdr "When" ;; header for the when column in history - :your-uname-prompt "Your username" ;; text of the username widget prompt on the login page - } diff --git a/resources/i18n/en.edn b/resources/i18n/en.edn deleted file mode 120000 index bc94dc4..0000000 --- a/resources/i18n/en.edn +++ /dev/null @@ -1 +0,0 @@ -en-GB.edn \ No newline at end of file diff --git a/resources/passwd b/resources/passwd index fe61aaf..2bc81ee 100644 --- a/resources/passwd +++ b/resources/passwd @@ -1 +1 @@ -{:admin {:admin true, :email "info@weft.scot", :password "admin"}} +{:admin {:admin true, :email "info@weft.scot", :password "admin"}, :simon {:email "simon@journeyman.cc", :admin true, :password "$s0$f0801$hIKgbtrGTP4Z7d0rQV7HyA==$PjSkX6m7qH1j3k5vI759KvApueEHMktBj9v/0sWiY0o="}} \ No newline at end of file diff --git a/resources/public/contentDeveloping Smeagol.md b/resources/public/contentDeveloping Smeagol.md deleted file mode 100644 index 52b3c58..0000000 --- a/resources/public/contentDeveloping Smeagol.md +++ /dev/null @@ -1,55 +0,0 @@ -## Prerequisites - -You will need [Leiningen](https://github.com/technomancy/leiningen) 2.0 or above installed. - -You will need [node](https://nodejs.org/en/) and [bower](https://bower.io/) installed. - -## Running - -To start a web server for the application during development, run: - - lein bower install - lein ring server - -To deploy Smeagol as a stand-alone application, compile it with: - - lein bower install - lein uberjar - -This will create a jar file in the `target` directory, named `smeagol-`*VERSION*`-standalone.jar`. You can run this file with: - - java -jar smeagol-VERSION-standalone.jar - -Test modification? - -Alternatively, if you want to deploy to a servlet container (which I would strongly recommend), the simplest thing is to run: - - lein bower install - lein ring uberwar - -(a command which I'm sure Smeagol would entirely appreciate) and deploy the resulting war file. - -## Experimental Docker image - -You can now run Smeagol as a [Docker](http://www.docker.com) image. Read more about [[Using the Docker Image]]. - -To run my Docker image, use - - docker run simonbrooke/smeagol - -Smeagol will run, obviously, on the IP address of your Docker image, on port 8080. To find the IP address, start the image using the command above and then use - - docker inspect --format '{{ .NetworkSettings.IPAddress }}' $(docker ps -q) - -Suppose this prints '10.10.10.10', then the URL to browse to will be http://10.10.10.10:8080/smeagol/ - -This image is _experimental_, but it does seem to work fairly well. What it does **not** yet do, however, is push the git repository to a remote location, so when you tear the Docker image down your edits will be lost. My next objective for this image is for it to have a cammand line parameter being the git address of a repository from which it can initialise the Wiki content, and to which it will periodically push local changes to the Wiki content. - -To build your own Docker image, run: - - lein clean - lein bower install - lein ring uberwar - lein docker build - -This will build a new Docker image locally; you can, obviously, push it to your own Docker repository if you wish. diff --git a/resources/templates/auth.html b/resources/templates/auth.html index 87ffbe2..b17f513 100644 --- a/resources/templates/auth.html +++ b/resources/templates/auth.html @@ -6,21 +6,21 @@ {% if user %}

- - + +

{% else %}

- +

- +

- - + +

{% endif %} diff --git a/resources/templates/base.html b/resources/templates/base.html index 103a537..7a31f07 100644 --- a/resources/templates/base.html +++ b/resources/templates/base.html @@ -1,7 +1,7 @@ - {{config.site-title}}: {{title}} + {% i18n site-title %}: {{title}} @@ -15,19 +15,19 @@ -

{{config.site-title}}: {{title}}

+

{% i18n site-title %}: {{title}}

{{header|safe}} {% if message %}
@@ -68,10 +68,10 @@
- {{config.cookies-more}} + {% i18n cookies-more %}
- {{config.cookies-about}} + {% i18n cookies-about %}