From f7e3f082cebec1c7f601bb3d3ed021c7acf6d841 Mon Sep 17 00:00:00 2001 From: Morgan Astra Date: Sun, 7 Aug 2016 03:18:47 -0700 Subject: [PATCH] add descriptive headers for multiple pronoun sets #38 --- src/pronouns/pages.clj | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index 2a0c732..dcade59 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -43,13 +43,17 @@ (defn examples-block [subject object possessive-determiner possessive-pronoun reflexive] - [:div {:class "examples"} - [:p [:h2 "Here are some usage examples for my pronouns:"]] - (subject-example subject) - (object-example object) - (posessive-determiner-example subject possessive-determiner) - (possessive-pronoun-example possessive-pronoun) - (reflexive-example subject reflexive)]) + (let [sub-obj (str subject "/" object) + header-str (str "Here are some usage examples for my " + sub-obj + " pronouns")] + [:div {:class "examples"} + [:p [:h2 header-str]] + (subject-example subject) + (object-example object) + (posessive-determiner-example subject possessive-determiner) + (possessive-pronoun-example possessive-pronoun) + (reflexive-example subject reflexive)])) (defn about-block [] [:div {:class "about"} @@ -72,8 +76,6 @@ (defn format-pronoun-examples [pronoun-declension alternates] - (println pronoun-declension) - (println alternates) (let [title "Pronoun Island: English Language Examples"] (html [:html @@ -88,7 +90,7 @@ (about-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 #"/") n (count inputs)] (if (>= n 5) @@ -124,16 +126,13 @@ "https://github.com/witch-house/pronoun.is/blob/master/resources/pronouns.tab")) (defn pronouns [params pronouns-table] - (println params) (let [path (params :*) ors (u/vec-coerce (params "or")) - a (println path) - pronoun-declension (parse-pronouns-with-lookup (escape-html path) - pronouns-table) - alternates (map #(parse-pronouns-with-lookup (escape-html %) - pronouns-table) - ors) - ] + pronoun-declension (lookup-pronouns (escape-html path) + pronouns-table) + alternates (map #(lookup-pronouns (escape-html %) + pronouns-table) + ors)] (println pronoun-declension) (if pronoun-declension (format-pronoun-examples pronoun-declension alternates)