about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--project.clj1
-rwxr-xr-xquickstart.sh3
-rw-r--r--src/pronouns/pages.clj97
-rw-r--r--src/pronouns/web.clj2
5 files changed, 96 insertions, 11 deletions
diff --git a/README.md b/README.md
index c13301a..38f9fbd 100644
--- a/README.md
+++ b/README.md
@@ -42,8 +42,8 @@ $ java -cp target/pronouns-standalone.jar clojure.main -m pronouns.web
 
 Then browse to localhost:5000
 
-You can also just run quickstart.sh which will do all of these things for you. Do it like this
+You can also just run quickstart.sh which will do all of these things for you. Do it like this to get an example running on port 666
 
 ```
-$ ./quickstart.sh
+$ ./quickstart.sh 666
 ```
diff --git a/project.clj b/project.clj
index ea671fd..961c733 100644
--- a/project.clj
+++ b/project.clj
@@ -10,6 +10,7 @@
                  [ring/ring-devel "1.2.2"]
                  [ring-basic-authentication "1.0.5"]
                  [environ "0.5.0"]
+                 [hiccup "1.0.5"]
                  [com.cemerick/drawbridge "0.0.6"]]
   :min-lein-version "2.0.0"
   :plugins [[environ/environ.lein "0.2.1"]]
diff --git a/quickstart.sh b/quickstart.sh
index 9525b0c..c50fb02 100755
--- a/quickstart.sh
+++ b/quickstart.sh
@@ -1,5 +1,6 @@
 #!/bin/sh
 
+export port=$1
 lein uberjar
+open http://localhost:"$port"/ze/zir
 java -cp target/pronouns-standalone.jar clojure.main -m pronouns.web
-open http://localhost:5000/ze/zir
diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj
index f1f8b67..0d96e76 100644
--- a/src/pronouns/pages.clj
+++ b/src/pronouns/pages.clj
@@ -1,15 +1,98 @@
 (ns pronouns.pages
   (:require [clojure.string :as s]
-            [pronouns.util :as u]))
+            [pronouns.util :as u]
+            [hiccup.core :refer :all]))
+
+
+(defn wrap-pronoun
+  [pronoun]
+  [:b pronoun])
+
+(defn wrap-para
+  [whatever]
+  [:p whatever]
+  )
+
+(defn subject-example
+  [subject]
+  (wrap-para
+  [:span#sentence (wrap-pronoun subject) " went to the park."]))
+
+(defn object-example
+  [object]
+  (wrap-para
+  [:span#sentence "I went with " (wrap-pronoun object) "."]
+  ))
+
+(defn posessive-determiner-example
+  [subject possessive-determiner]
+  (wrap-para
+  [:span#sentence (wrap-pronoun subject) " brought " (wrap-pronoun possessive-determiner) " frisbee."]
+  ))
+
+(defn possessive-pronoun-example
+  [possessive-pronoun]
+  (wrap-para
+  [:span#sentence "At least I think it was " (wrap-pronoun possessive-pronoun) "."]
+  ))
+
+(defn reflexive-example
+  [subject reflexive]
+  (wrap-para
+  [:span#sentence (wrap-pronoun subject) " threw it to " (wrap-pronoun reflexive)]
+  ))
+
+
+(defn twitter-name [name]
+  [:a {:href (str "https://www.twitter.com/" name)} (str "@" name)]
+)
+
+(defn contact-block []
+  [:div {:class "contact"}
+   [:p "Written by " (twitter-name "morganastra") " and " (twitter-name "thelseraphim") "."]
+   [:p "visit the project on " [:a {:href "https://github.com/witch-house/pronoun.is"} "github."]]]
+)
+
+
+(defn about-block []
+  [:div {:class "about"}
+   [:p "Full usage:"]
+   [:p
+    [:tt "http://pronoun.is/subject-pronoun/object-pronoun/possessive-determiner/possessive-pronoun/reflexive"]
+    " displays examples of your pronouns. If we have a good guess we'll let you use just the first one or two."]
+   [:p "Quick examples:"]
+   [:p "My name is Thel Seraphim, my " [:a {:href "http://pronoun.is/she"} "http://pronoun.is/she"] "."]
+   [:p "My name is Morgan Astra, my " [:a {:href "http://pronoun.is/ze/zir"} "http://pronoun.is/ze/zir"] "."]
+   ]
+)
+
+
+
+(defn examples-block
+  [subject object possessive-determiner possessive-pronoun reflexive]
+  [:div {:class "examples"}
+   [:p [:h1 "Usage examples:"]]
+   (subject-example subject)
+   (object-example object)
+   (posessive-determiner-example subject possessive-determiner)
+   (possessive-pronoun-example possessive-pronoun)
+   (reflexive-example subject reflexive)])
+
+
 
 (defn format-pronoun-examples
   [subject object possessive-determiner possessive-pronoun reflexive]
-  (s/join "\n"
-          [(str subject " went to the park")
-           (str "I went with " object)
-           (str subject " brought " possessive-determiner " frisbee")
-           (str "at least I think it was " possessive-pronoun)
-           (str subject " threw it to " reflexive)]))
+  (html
+   [:html
+   [:head ""]
+   [:body
+    (examples-block subject object possessive-determiner possessive-pronoun reflexive)
+    (about-block)
+    (contact-block)]
+    ]
+   )
+ )
+
 
 (defn parse-pronouns-with-lookup [pronouns-string pronouns-table]
   (let [inputs (s/split pronouns-string #"/")
diff --git a/src/pronouns/web.clj b/src/pronouns/web.clj
index 32d0883..ef6e666 100644
--- a/src/pronouns/web.clj
+++ b/src/pronouns/web.clj
@@ -25,7 +25,7 @@
 
   (GET "/*" {params :params}
        {:status 200
-        :headers {"Content-Type" "text/plain"}
+        :headers {"Content-Type" "text/html"}
         :body (pages/pronouns (:* params) pronouns-table)})
 
   (ANY "*" []