From 89f740fe377af603d83499e6af171926bfe367ce Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Thu, 22 Sep 2016 17:30:09 -0700 Subject: [PATCH 1/6] remove errant punctuation from README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7b701d5..6000a89 100644 --- a/README.md +++ b/README.md @@ -62,5 +62,5 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License -along with this program. If not, see */ +along with this program. If not, see From 0729341510304ed74036b35074e1f58211bc25b1 Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Thu, 22 Sep 2016 17:44:16 -0700 Subject: [PATCH 2/6] rename 'about' section to 'usage' for #56 --- resources/pronouns.css | 2 +- src/pronouns/pages.clj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/pronouns.css b/resources/pronouns.css index c27bd5a..2d101e0 100644 --- a/resources/pronouns.css +++ b/resources/pronouns.css @@ -20,7 +20,7 @@ footer { .title { } -.about { +.usage { } .contact { diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index 60175c9..6f08e98 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -76,8 +76,8 @@ (possessive-pronoun-example possessive-pronoun) (reflexive-example subject reflexive)]])) -(defn about-block [] - [:div {:class "section about"} +(defn usage-block [] + [:div {:class "section usage"} [:p "Full usage: " [:tt "http://pronoun.is/subject-pronoun/object-pronoun/possessive-determiner/possessive-pronoun/reflexive"] " displays examples of your pronouns."] @@ -98,7 +98,7 @@ [:p "<3"]])) (defn footer-block [] - [:footer (about-block) (contact-block)]) + [:footer (usage-block) (contact-block)]) (defn format-pronoun-examples [pronoun-declensions] From cf48e336dabbbb9bbe20397c37ce1bb3257c49cc Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Sat, 24 Sep 2016 00:32:23 -0700 Subject: [PATCH 3/6] include pronouns in page titles (re #56) --- src/pronouns/pages.clj | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index 6f08e98..5b2ad36 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -21,6 +21,14 @@ [hiccup.core :refer :all] [hiccup.util :refer [escape-html]])) +(defn prose-comma-list + [items] + (let [c (count items)] + (cond + (<= c 1) (first items) + (= c 2) (s/join " and " items) + :else (str (s/join ", " (butlast items)) ", and " (last items))))) + (defn href [url text] [:a {:href url} text]) @@ -49,7 +57,9 @@ (defn possessive-pronoun-example [possessive-pronoun] - (render-sentence "At least I think it was " (wrap-pronoun possessive-pronoun) ".")) + (render-sentence "At least I think it was " + (wrap-pronoun possessive-pronoun) + ".")) (defn reflexive-example [subject reflexive] @@ -58,16 +68,16 @@ (wrap-pronoun reflexive) ".")) -(defn title-block [title] +(defn header-block [header] [:div {:class "section title"} - [:h1 title]]) + (href "/" [:h1 header])]) (defn examples-block [subject object possessive-determiner possessive-pronoun reflexive] - (let [sub-obj (str subject "/" object) - header-str (str "Here are some usage examples for my " + (let [sub-obj (s/join "/" [subject object]) + header-str (str "Here are some example sentences using my " sub-obj - " pronouns")] + " pronouns:")] [:div {:class "section examples"} [:h2 header-str] [:p (subject-example subject) @@ -81,7 +91,8 @@ [:p "Full usage: " [:tt "http://pronoun.is/subject-pronoun/object-pronoun/possessive-determiner/possessive-pronoun/reflexive"] " displays examples of your pronouns."] - [:p "This is a bit unwieldy. If we have a good guess we'll let you use just the first one or two."]]) + [:p "This is a bit unwieldy. If we have a good guess we'll let you use" + " just the first one or two."]]) (defn contact-block [] (let [twitter-name (fn [handle] (href (str "https://www.twitter.com/" handle) @@ -102,7 +113,8 @@ (defn format-pronoun-examples [pronoun-declensions] - (let [title "Pronoun Island: English Language Examples"] + (let [sub-objs (map #(s/join "/" (take 2 %)) pronoun-declensions) + title (str "Pronoun Island: " (prose-comma-list sub-objs) " examples")] (html [:html [:head From 349a4a220167de3d58a59107b423c1d08b53598c Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Sat, 24 Sep 2016 01:28:13 -0700 Subject: [PATCH 4/6] use midje for testing per #57 --- project.clj | 3 ++- src/pronouns/pages.clj | 8 ++++---- test/pronouns/pages_test.clj | 10 ++++++++++ 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 test/pronouns/pages_test.clj diff --git a/project.clj b/project.clj index cddf5f3..ae66432 100644 --- a/project.clj +++ b/project.clj @@ -14,5 +14,6 @@ [lein-ring "0.9.7"]] :hooks [environ.leiningen.hooks] :uberjar-name "pronouns-standalone.jar" - :profiles {:production {:env {:production true}}} + :profiles {:production {:env {:production true}} + :dev {:dependencies [[midje "1.6.3"]]}} :ring {:handler pronouns.web/app}) diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index 5b2ad36..9c1e02b 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -25,7 +25,7 @@ [items] (let [c (count items)] (cond - (<= c 1) (first items) + (<= c 1) (or (first items) "") (= c 2) (s/join " and " items) :else (str (s/join ", " (butlast items)) ", and " (last items))))) @@ -122,7 +122,7 @@ [:meta {:name "viewport" :content "width=device-width"}] [:link {:rel "stylesheet" :href "/pronouns.css"}]] [:body - (title-block title) + (header-block title) (map #(apply examples-block %) pronoun-declensions) (footer-block)]]))) @@ -149,7 +149,7 @@ [:meta {:name "viewport" :content "width=device-width"}] [:link {:rel "stylesheet" :href "/pronouns.css"}]] [:body - (title-block title) + (header-block title) [:div {:class "section table"} [:p "pronoun.is is a website for personal pronoun usage examples"] [:p "here are some pronouns the site knows about:"] @@ -165,7 +165,7 @@ [:meta {:name "viewport" :content "width=device-width"}] [:link {:rel "stylesheet" :href "/pronouns.css"}]] [:body - (title-block title) + (header-block title) [:div {:class "section examples"} [:p [:h2 (str "We couldn't find those pronouns in our database." "If you think we should have them, please reach out!")]]] diff --git a/test/pronouns/pages_test.clj b/test/pronouns/pages_test.clj new file mode 100644 index 0000000..04c14ce --- /dev/null +++ b/test/pronouns/pages_test.clj @@ -0,0 +1,10 @@ +(ns pronouns.pages-test + (:require [pronouns.pages :as pages] + [midje.sweet :refer :all])) + +(fact "prose-comma-list turns a list of strings into a prose list with commas" + (pages/prose-comma-list ["foo"]) => "foo" + (pages/prose-comma-list ["foo" "bar"]) => "foo and bar" + (pages/prose-comma-list ["foo" "bar" "baz"]) => "foo, bar, and baz" + (pages/prose-comma-list ["foo" "bar" "baz" "bobble"]) => "foo, bar, baz, and bobble" + (pages/prose-comma-list []) => "") From b2aeacd131615f4bfc02de4dcfe87b43e3c1da60 Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Sat, 4 Mar 2017 23:05:52 -0800 Subject: [PATCH 5/6] add Patreon link; update copyright years --- README.md | 2 +- src/pronouns/config.clj | 2 +- src/pronouns/pages.clj | 6 +++++- src/pronouns/util.clj | 2 +- src/pronouns/web.clj | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6000a89..f4bdae5 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ It is possible to use these example sentences to demonstrate the usage of words ## License -Copyright © 2014-2016 Morgan Astra +Copyright © 2014-2017 Morgan Astra This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as diff --git a/src/pronouns/config.clj b/src/pronouns/config.clj index b0c83d5..19e20f1 100644 --- a/src/pronouns/config.clj +++ b/src/pronouns/config.clj @@ -1,5 +1,5 @@ ;; pronoun.is - a website for pronoun usage examples -;; Copyright (C) 2014 - 2016 Morgan Astra +;; Copyright (C) 2014 - 2017 Morgan Astra ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index 9c1e02b..a9301e3 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -1,5 +1,5 @@ ;; pronoun.is - a website for pronoun usage examples -;; Copyright (C) 2014 - 2016 Morgan Astra +;; Copyright (C) 2014 - 2017 Morgan Astra ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as @@ -102,6 +102,10 @@ (twitter-name "morganastra") ", whose " (href "http://pronoun.is/ze/zir?or=she" "pronoun.is/ze/zir?or=she")] + [:p "Want to support this and similar websites? " + "Join us on " + (href "https://www.patreon.com/user?u=5238484" "Patreon") + "!"] [:p "pronoun.is is free software under the " (href "https://www.gnu.org/licenses/agpl.html" "AGPLv3") "! visit the project on " diff --git a/src/pronouns/util.clj b/src/pronouns/util.clj index 6d8d37e..a000201 100644 --- a/src/pronouns/util.clj +++ b/src/pronouns/util.clj @@ -1,5 +1,5 @@ ;; pronoun.is - a website for pronoun usage examples -;; Copyright (C) 2014 - 2016 Morgan Astra +;; Copyright (C) 2014 - 2017 Morgan Astra ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj index eda8376..e57d7ec 100644 --- a/src/pronouns/web.clj +++ b/src/pronouns/web.clj @@ -1,5 +1,5 @@ ;; pronoun.is - a website for pronoun usage examples -;; Copyright (C) 2014 - 2016 Morgan Astra +;; Copyright (C) 2014 - 2017 Morgan Astra ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as From 5e851322b2e862c9a4c4018413d8b7fb67a31428 Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Sat, 4 Mar 2017 23:13:08 -0800 Subject: [PATCH 6/6] v1.11 --- project.clj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.clj b/project.clj index ae66432..b14ac4e 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject witch-house/pronouns "1.10.0-SNAPSHOT" +(defproject witch-house/pronouns "1.11.0-SNAPSHOT" :description "Pronoun.is is a website for personal pronoun usage examples" :url "http://pronoun.is" :license "GNU Affero General Public License 3.0"