include pronouns in page titles (re #56)

This commit is contained in:
Morgan Astra 2016-09-24 00:32:23 -07:00
parent 6739eadea3
commit cf48e336da

View File

@ -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) (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)
@ -81,7 +91,8 @@
[: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)
@ -102,7 +113,8 @@
(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