diff options
author | Morgan Astra <m@morganastra.me> | 2016-08-09 21:05:50 -0700 |
---|---|---|
committer | Morgan Astra <m@morganastra.me> | 2016-08-09 21:05:50 -0700 |
commit | e3c5f5d366af76cb39f2716455cb220abdc0bfae (patch) | |
tree | f384b07b11a1f70a7d9f6621ab4a5cb3379e4296 /src/pronouns/pages.clj | |
parent | cd832bcd7049e9d4ce80ef2907e084edc5813319 (diff) |
get rid of useless config var and use dynamic var for *pronouns-table*, clean up project.clj
Diffstat (limited to 'src/pronouns/pages.clj')
-rw-r--r-- | src/pronouns/pages.clj | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index bf67f75..708d912 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -1,5 +1,6 @@ (ns pronouns.pages (:require [clojure.string :as s] + [pronouns.config :refer [*pronouns-table*]] [pronouns.util :as u] [hiccup.core :refer :all] [hiccup.util :refer [escape-html]])) @@ -89,20 +90,22 @@ (about-block) (contact-block)]]))) -(defn lookup-pronouns [pronouns-string pronouns-table] +(defn lookup-pronouns [pronouns-string] (let [inputs (s/split pronouns-string #"/") n (count inputs)] + (println *pronouns-table*) (if (>= n 5) (take 5 inputs) - (u/table-lookup inputs pronouns-table)))) + (u/table-lookup inputs *pronouns-table*)))) (defn make-link [path] (let [link (str "/" path) label path] [:li [:a {:href link} label]])) -(defn front [pronouns-table] - (let [abbreviations (u/abbreviate pronouns-table) +(defn front [] + (let [blah (println *pronouns-table*) + abbreviations (u/abbreviate *pronouns-table*) links (map make-link abbreviations) title "Pronoun Island"] (html @@ -135,15 +138,13 @@ (about-block) (contact-block)]]))) -(defn pronouns [params pronouns-table] +(defn pronouns [params] (let [path (params :*) alts (or (params "or") []) pronouns (concat [path] (u/vec-coerce alts)) - pronoun-declensions (filter some? (map #(lookup-pronouns (escape-html %) - pronouns-table) - pronouns))] - (println path) - (println pronoun-declensions) + pronoun-declensions (filter some? (map #(lookup-pronouns + (escape-html %)) + pronouns))] (if (seq pronoun-declensions) (format-pronoun-examples pronoun-declensions) (not-found)))) |