add descriptive headers for multiple pronoun sets #38

This commit is contained in:
Morgan Astra 2016-08-07 03:18:47 -07:00
parent f0f6c207da
commit f7e3f082ce

View File

@ -43,13 +43,17 @@
(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)
header-str (str "Here are some usage examples for my "
sub-obj
" pronouns")]
[:div {:class "examples"} [:div {:class "examples"}
[:p [:h2 "Here are some usage examples for my pronouns:"]] [:p [:h2 header-str]]
(subject-example subject) (subject-example subject)
(object-example object) (object-example object)
(posessive-determiner-example subject possessive-determiner) (posessive-determiner-example subject possessive-determiner)
(possessive-pronoun-example possessive-pronoun) (possessive-pronoun-example possessive-pronoun)
(reflexive-example subject reflexive)]) (reflexive-example subject reflexive)]))
(defn about-block [] (defn about-block []
[:div {:class "about"} [:div {:class "about"}
@ -72,8 +76,6 @@
(defn format-pronoun-examples (defn format-pronoun-examples
[pronoun-declension alternates] [pronoun-declension alternates]
(println pronoun-declension)
(println alternates)
(let [title "Pronoun Island: English Language Examples"] (let [title "Pronoun Island: English Language Examples"]
(html (html
[:html [:html
@ -88,7 +90,7 @@
(about-block) (about-block)
(contact-block)]]))) (contact-block)]])))
(defn parse-pronouns-with-lookup [pronouns-string pronouns-table] (defn lookup-pronouns [pronouns-string pronouns-table]
(let [inputs (s/split pronouns-string #"/") (let [inputs (s/split pronouns-string #"/")
n (count inputs)] n (count inputs)]
(if (>= n 5) (if (>= n 5)
@ -124,16 +126,13 @@
"https://github.com/witch-house/pronoun.is/blob/master/resources/pronouns.tab")) "https://github.com/witch-house/pronoun.is/blob/master/resources/pronouns.tab"))
(defn pronouns [params pronouns-table] (defn pronouns [params pronouns-table]
(println params)
(let [path (params :*) (let [path (params :*)
ors (u/vec-coerce (params "or")) ors (u/vec-coerce (params "or"))
a (println path) pronoun-declension (lookup-pronouns (escape-html path)
pronoun-declension (parse-pronouns-with-lookup (escape-html path)
pronouns-table) pronouns-table)
alternates (map #(parse-pronouns-with-lookup (escape-html %) alternates (map #(lookup-pronouns (escape-html %)
pronouns-table) pronouns-table)
ors) ors)]
]
(println pronoun-declension) (println pronoun-declension)
(if pronoun-declension (if pronoun-declension
(format-pronoun-examples pronoun-declension alternates) (format-pronoun-examples pronoun-declension alternates)