Compare commits
No commits in common. "develop" and "master" have entirely different histories.
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1,4 +0,0 @@
|
|||
|
||||
*.log
|
||||
|
||||
\.lein-repl-history
|
24
README.md
24
README.md
|
@ -120,30 +120,6 @@ metadata and passes it to sedit, attempting to redefine the function from the re
|
|||
the basic clojure 'all data is immutable' reason. But, when you invoke (use 'namespace :reload), it
|
||||
is able to redefine all the functions, so I must be able to work out how this is done.
|
||||
|
||||
## Development Mode
|
||||
|
||||
### Run application:
|
||||
|
||||
```
|
||||
lein clean
|
||||
lein figwheel dev
|
||||
```
|
||||
|
||||
Figwheel will automatically push cljs changes to the browser.
|
||||
|
||||
Wait a bit, then browse to [http://localhost:3449](http://localhost:3449).
|
||||
|
||||
## Production Build
|
||||
|
||||
|
||||
To compile clojurescript to javascript:
|
||||
|
||||
```
|
||||
lein clean
|
||||
lein cljsbuild once min
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2013 Simon Brooke <stillyet-github@googlemail.com>
|
||||
|
|
58
project.clj
58
project.clj
|
@ -1,56 +1,8 @@
|
|||
(defproject fedit "0.1.0-SNAPSHOT"
|
||||
:description "An attempt to reconstruct the Cambridge Lisp 'fedit' in core editor, as a precursor to attempting to reconstruct the InterLisp DEdit editor"
|
||||
:url "https://github.com/simon-brooke/fedit"
|
||||
:license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
|
||||
:url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
|
||||
:url "http://example.com/FIXME"
|
||||
:license {:name "Eclipse Public License"
|
||||
:url "http://www.eclipse.org/legal/epl-v10.html"}
|
||||
:dependencies [[org.clojure/clojure "1.8.0"]
|
||||
[org.clojure/clojurescript "1.9.908"]
|
||||
[hiccup "1.0.5"]
|
||||
[jline "2.11"]
|
||||
[markdown-clj "1.0.2"]
|
||||
[reagent "0.7.0"]
|
||||
[re-frame "0.10.5"]]
|
||||
|
||||
:plugins [[lein-cljsbuild "1.1.5"]]
|
||||
|
||||
:min-lein-version "2.5.3"
|
||||
|
||||
:source-paths ["src/clj" "src/cljc"]
|
||||
|
||||
:clean-targets ^{:protect false} ["resources/public/js/compiled" "target" "classes" "bin"]
|
||||
|
||||
:figwheel {:css-dirs ["resources/public/css"]}
|
||||
|
||||
:profiles
|
||||
{:dev
|
||||
{:dependencies [[binaryage/devtools "0.9.4"]]
|
||||
|
||||
:plugins [[lein-figwheel "0.5.13"]]}}
|
||||
|
||||
:cljsbuild
|
||||
{:builds
|
||||
[{:id "dev"
|
||||
:source-paths ["src/cljs" "src/cljc"]
|
||||
:figwheel {:on-jsload "fedit.core/mount-root"}
|
||||
:compiler {:main fedit.core
|
||||
:output-to "resources/public/js/compiled/app.js"
|
||||
:output-dir "resources/public/js/compiled/out"
|
||||
:asset-path "js/compiled/out"
|
||||
:source-map-timestamp true
|
||||
:preloads [devtools.preload]
|
||||
:external-config {:devtools/config {:features-to-install :all}}
|
||||
}}
|
||||
|
||||
{:id "min"
|
||||
:source-paths ["src/cljs" "src/cljc"]
|
||||
:compiler {:main fedit.core
|
||||
:output-to "resources/public/js/compiled/app.js"
|
||||
:optimizations :advanced
|
||||
:closure-defines {goog.DEBUG false}
|
||||
:pretty-print false}}
|
||||
|
||||
|
||||
]}
|
||||
|
||||
|
||||
)
|
||||
[jline "2.11"]]
|
||||
:clean-targets ["classes" "bin"])
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset='utf-8'>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="js/compiled/app.js"></script>
|
||||
<script>fedit.core.init();</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1 +0,0 @@
|
|||
(ns fedit.core)
|
|
@ -1,81 +0,0 @@
|
|||
(ns fedit.format
|
||||
"Essentially, a pretty-printer which renders Clojure as HTML"
|
||||
(:require [clojure.string :as s]
|
||||
[hiccup.core :refer [html]]
|
||||
[markdown.core :refer [md-to-html-string]]))
|
||||
|
||||
(declare format-object)
|
||||
|
||||
(defn format-inline
|
||||
[o]
|
||||
[:span {:class "clojure"} o])
|
||||
|
||||
(defn format-string
|
||||
[o]
|
||||
[:span (md-to-html-string o)])
|
||||
|
||||
(defn format-block
|
||||
[o]
|
||||
[:div {:class "clojure"} o])
|
||||
|
||||
(defn format-quoted
|
||||
[q]
|
||||
(format-inline (str "'" (nth q 1))))
|
||||
|
||||
|
||||
(defn format-sequence
|
||||
[s]
|
||||
(let [lpar (if (vector? s) "[" "(")
|
||||
rpar (if (vector? s) "]" ")")]
|
||||
(conj
|
||||
(vec
|
||||
(cons
|
||||
:div
|
||||
(cons
|
||||
{:class "clojure"}
|
||||
(cons
|
||||
lpar
|
||||
(map format-object s)))))
|
||||
rpar)))
|
||||
|
||||
(defn format-map
|
||||
[m]
|
||||
(let [c (count (keys m))]
|
||||
(vec
|
||||
(cons
|
||||
:table
|
||||
(for
|
||||
[i (range c) k (keys m)]
|
||||
[:tr
|
||||
[:td (if (zero? i) "{")]
|
||||
[:th (format-object k)]
|
||||
[:td (format-object (m k))]
|
||||
[:td (if (= (inc i) c) "}")]])))))
|
||||
|
||||
(defn format-object
|
||||
[o]
|
||||
(cond
|
||||
(and
|
||||
(list? o)
|
||||
(= (first o) 'quote)
|
||||
(not (seq? (nth o 1))))
|
||||
(format-quoted o)
|
||||
(or
|
||||
(nil? o)
|
||||
(true? o)
|
||||
(number? o)
|
||||
(symbol? o))
|
||||
(format-inline o)
|
||||
(keyword? o)
|
||||
(format-inline (str ":" (name o)))
|
||||
(string? o)
|
||||
(format-string o)
|
||||
(or
|
||||
(vector? o)
|
||||
(list? o))
|
||||
(format-sequence o)
|
||||
(map? o)
|
||||
(format-map o)
|
||||
true
|
||||
(format-block o)))
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
(ns fedit.config)
|
||||
|
||||
(def debug?
|
||||
^boolean goog.DEBUG)
|
|
@ -1,22 +0,0 @@
|
|||
(ns fedit.core
|
||||
(:require [reagent.core :as reagent]
|
||||
[re-frame.core :as re-frame]
|
||||
[fedit.events :as events]
|
||||
[fedit.views :as views]
|
||||
[fedit.config :as config]))
|
||||
|
||||
|
||||
(defn dev-setup []
|
||||
(when config/debug?
|
||||
(enable-console-print!)
|
||||
(println "dev mode")))
|
||||
|
||||
(defn mount-root []
|
||||
(re-frame/clear-subscription-cache!)
|
||||
(reagent/render [views/main-panel]
|
||||
(.getElementById js/document "app")))
|
||||
|
||||
(defn ^:export init []
|
||||
(re-frame/dispatch-sync [::events/initialize-db])
|
||||
(dev-setup)
|
||||
(mount-root))
|
|
@ -1,4 +0,0 @@
|
|||
(ns fedit.db)
|
||||
|
||||
(def default-db
|
||||
{:name "re-frame"})
|
|
@ -1,8 +0,0 @@
|
|||
(ns fedit.events
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[fedit.db :as db]))
|
||||
|
||||
(re-frame/reg-event-db
|
||||
::initialize-db
|
||||
(fn [_ _]
|
||||
db/default-db))
|
|
@ -1,7 +0,0 @@
|
|||
(ns fedit.subs
|
||||
(:require [re-frame.core :as re-frame]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::name
|
||||
(fn [db]
|
||||
(:name db)))
|
|
@ -1,8 +0,0 @@
|
|||
(ns fedit.views
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[fedit.subs :as subs]
|
||||
))
|
||||
|
||||
(defn main-panel []
|
||||
(let [name (re-frame/subscribe [::subs/name])]
|
||||
[:div "Hello from " @name]))
|
Loading…
Reference in a new issue