From ec62e36ee31ffd6a0ee2370451448b8967f4d10a Mon Sep 17 00:00:00 2001 From: Thel Seraphim Date: Fri, 13 Mar 2015 19:34:43 -0700 Subject: [PATCH] include hiccup library and small functioning example, don't merge until it looks nice. --- README.md | 4 ++-- project.clj | 1 + quickstart.sh | 3 ++- src/pronouns/pages.clj | 9 ++++++++- 4 files changed, 13 insertions(+), 4 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..ce6d3b4 100755 --- a/quickstart.sh +++ b/quickstart.sh @@ -1,5 +1,6 @@ #!/bin/sh +export port=$1 lein uberjar java -cp target/pronouns-standalone.jar clojure.main -m pronouns.web -open http://localhost:5000/ze/zir +open http://localhost:"$port"/ze/zir diff --git a/src/pronouns/pages.clj b/src/pronouns/pages.clj index f1f8b67..16c92b4 100644 --- a/src/pronouns/pages.clj +++ b/src/pronouns/pages.clj @@ -1,16 +1,23 @@ (ns pronouns.pages (:require [clojure.string :as s] - [pronouns.util :as u])) + [pronouns.util :as u] + [hiccup.core :refer :all])) + +(defn subject-example + [subject] + [:span#blah [:b subject] " went to the park."]) (defn format-pronoun-examples [subject object possessive-determiner possessive-pronoun reflexive] (s/join "\n" [(str subject " went to the park") + (html (subject-example subject)) (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)])) + (defn parse-pronouns-with-lookup [pronouns-string pronouns-table] (let [inputs (s/split pronouns-string #"/") n (count inputs)]