Merge branch 'release/v1.11'

This commit is contained in:
Morgan Astra 2017-03-04 23:13:18 -08:00
commit fedfc3ae45
8 changed files with 50 additions and 23 deletions

View File

@ -49,7 +49,7 @@ It is possible to use these example sentences to demonstrate the usage of words
## License ## License
Copyright © 2014-2016 Morgan Astra <m@morganastra.me> Copyright © 2014-2017 Morgan Astra <m@morganastra.me>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as it under the terms of the GNU Affero General Public License as
@ -62,5 +62,5 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/> */ along with this program. If not, see <http://www.gnu.org/licenses/>

View File

@ -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" :description "Pronoun.is is a website for personal pronoun usage examples"
:url "http://pronoun.is" :url "http://pronoun.is"
:license "GNU Affero General Public License 3.0" :license "GNU Affero General Public License 3.0"
@ -14,5 +14,6 @@
[lein-ring "0.9.7"]] [lein-ring "0.9.7"]]
:hooks [environ.leiningen.hooks] :hooks [environ.leiningen.hooks]
:uberjar-name "pronouns-standalone.jar" :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}) :ring {:handler pronouns.web/app})

View File

@ -20,7 +20,7 @@ footer {
.title { .title {
} }
.about { .usage {
} }
.contact { .contact {

View File

@ -1,5 +1,5 @@
;; pronoun.is - a website for pronoun usage examples ;; 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 ;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as ;; it under the terms of the GNU Affero General Public License as

View File

@ -1,5 +1,5 @@
;; pronoun.is - a website for pronoun usage examples ;; 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 ;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as ;; it under the terms of the GNU Affero General Public License as
@ -21,6 +21,14 @@
[hiccup.core :refer :all] [hiccup.core :refer :all]
[hiccup.util :refer [escape-html]])) [hiccup.util :refer [escape-html]]))
(defn prose-comma-list
[items]
(let [c (count items)]
(cond
(<= c 1) (or (first items) "")
(= c 2) (s/join " and " items)
:else (str (s/join ", " (butlast items)) ", and " (last items)))))
(defn href (defn href
[url text] [url text]
[:a {:href url} text]) [:a {:href url} text])
@ -49,7 +57,9 @@
(defn possessive-pronoun-example (defn possessive-pronoun-example
[possessive-pronoun] [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 (defn reflexive-example
[subject reflexive] [subject reflexive]
@ -58,16 +68,16 @@
(wrap-pronoun reflexive) (wrap-pronoun reflexive)
".")) "."))
(defn title-block [title] (defn header-block [header]
[:div {:class "section title"} [:div {:class "section title"}
[:h1 title]]) (href "/" [:h1 header])])
(defn examples-block (defn examples-block
[subject object possessive-determiner possessive-pronoun reflexive] [subject object possessive-determiner possessive-pronoun reflexive]
(let [sub-obj (str subject "/" object) (let [sub-obj (s/join "/" [subject object])
header-str (str "Here are some usage examples for my " header-str (str "Here are some example sentences using my "
sub-obj sub-obj
" pronouns")] " pronouns:")]
[:div {:class "section examples"} [:div {:class "section examples"}
[:h2 header-str] [:h2 header-str]
[:p (subject-example subject) [:p (subject-example subject)
@ -76,12 +86,13 @@
(possessive-pronoun-example possessive-pronoun) (possessive-pronoun-example possessive-pronoun)
(reflexive-example subject reflexive)]])) (reflexive-example subject reflexive)]]))
(defn about-block [] (defn usage-block []
[:div {:class "section about"} [:div {:class "section usage"}
[:p "Full usage: " [:p "Full usage: "
[:tt "http://pronoun.is/subject-pronoun/object-pronoun/possessive-determiner/possessive-pronoun/reflexive"] [:tt "http://pronoun.is/subject-pronoun/object-pronoun/possessive-determiner/possessive-pronoun/reflexive"]
" displays examples of your pronouns."] " 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 [] (defn contact-block []
(let [twitter-name (fn [handle] (href (str "https://www.twitter.com/" handle) (let [twitter-name (fn [handle] (href (str "https://www.twitter.com/" handle)
@ -91,6 +102,10 @@
(twitter-name "morganastra") (twitter-name "morganastra")
", whose " ", whose "
(href "http://pronoun.is/ze/zir?or=she" "pronoun.is/ze/zir?or=she")] (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 " [:p "pronoun.is is free software under the "
(href "https://www.gnu.org/licenses/agpl.html" "AGPLv3") (href "https://www.gnu.org/licenses/agpl.html" "AGPLv3")
"! visit the project on " "! visit the project on "
@ -98,11 +113,12 @@
[:p "<3"]])) [:p "<3"]]))
(defn footer-block [] (defn footer-block []
[:footer (about-block) (contact-block)]) [:footer (usage-block) (contact-block)])
(defn format-pronoun-examples (defn format-pronoun-examples
[pronoun-declensions] [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
[:html [:html
[:head [:head
@ -110,7 +126,7 @@
[:meta {:name "viewport" :content "width=device-width"}] [:meta {:name "viewport" :content "width=device-width"}]
[:link {:rel "stylesheet" :href "/pronouns.css"}]] [:link {:rel "stylesheet" :href "/pronouns.css"}]]
[:body [:body
(title-block title) (header-block title)
(map #(apply examples-block %) pronoun-declensions) (map #(apply examples-block %) pronoun-declensions)
(footer-block)]]))) (footer-block)]])))
@ -137,7 +153,7 @@
[:meta {:name "viewport" :content "width=device-width"}] [:meta {:name "viewport" :content "width=device-width"}]
[:link {:rel "stylesheet" :href "/pronouns.css"}]] [:link {:rel "stylesheet" :href "/pronouns.css"}]]
[:body [:body
(title-block title) (header-block title)
[:div {:class "section table"} [:div {:class "section table"}
[:p "pronoun.is is a website for personal pronoun usage examples"] [:p "pronoun.is is a website for personal pronoun usage examples"]
[:p "here are some pronouns the site knows about:"] [:p "here are some pronouns the site knows about:"]
@ -153,7 +169,7 @@
[:meta {:name "viewport" :content "width=device-width"}] [:meta {:name "viewport" :content "width=device-width"}]
[:link {:rel "stylesheet" :href "/pronouns.css"}]] [:link {:rel "stylesheet" :href "/pronouns.css"}]]
[:body [:body
(title-block title) (header-block title)
[:div {:class "section examples"} [:div {:class "section examples"}
[:p [:h2 (str "We couldn't find those pronouns in our database." [:p [:h2 (str "We couldn't find those pronouns in our database."
"If you think we should have them, please reach out!")]]] "If you think we should have them, please reach out!")]]]

View File

@ -1,5 +1,5 @@
;; pronoun.is - a website for pronoun usage examples ;; 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 ;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as ;; it under the terms of the GNU Affero General Public License as

View File

@ -1,5 +1,5 @@
;; pronoun.is - a website for pronoun usage examples ;; 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 ;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as ;; it under the terms of the GNU Affero General Public License as

View File

@ -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 []) => "")