-
-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
emmy.sci, publish library as Clerk notebooks #124
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3548220
add clerk
sritchie 657ab71
Merge branch 'main' into sritchie/add_clerk
sritchie 695c2b6
prepare
sritchie fba6710
tex fixes
sritchie 5bf49a8
save more namespaces
sritchie f7bc372
fix quadrature
sritchie 6a52170
fully remove hiccup
sritchie f57af8a
fix italics
sritchie 85bf690
reshuffle sci
sritchie 8f0b3c7
build fixes
sritchie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,69 @@ | ||
{:deps | ||
{io.github.clj-kondo/clj-kondo-bb | ||
{:git/tag "v2023.01.20" :git/sha "adfc7df"}} | ||
|
||
{:deps {org.babashka/http-server {:mvn/version "0.1.11"} | ||
org.babashka/cli {:mvn/version "0.2.23"} | ||
io.github.clj-kondo/clj-kondo-bb | ||
{:git/tag "v2023.01.20" :git/sha "adfc7df"}} | ||
:tasks | ||
{test:clj | ||
{:requires ([babashka.cli :as cli]) | ||
:init | ||
(do (def cli-opts | ||
(cli/parse-opts *command-line-args* {:coerce {:port :int}})) | ||
|
||
(defn X [cmd] | ||
(let [args *command-line-args*] | ||
(if (even? (count args)) | ||
(apply shell cmd args) | ||
(do (println "Please supply an even number of arguments!") | ||
(System/exit 1)))))) | ||
|
||
repl | ||
{:doc "Start a REPL with `emmy.env` loaded." | ||
:task (shell "clj -M:test:dev:repl")} | ||
|
||
test:clj | ||
{:doc "Run CLJ tests." | ||
:task (shell "clojure -X:test:runner")} | ||
|
||
test:cljs | ||
{:doc "Run CLJS tests." | ||
:task (shell "npm run test")} | ||
|
||
clerk-watch | ||
{:doc "Runs `user/serve!` with a watcher process generating custom JS." | ||
:task (X "clojure -X:nextjournal/clerk user/serve!")} | ||
|
||
build-static | ||
{:doc "Generate a fresh static build." | ||
:task | ||
(apply shell | ||
"clojure -X:nextjournal/clerk" | ||
*command-line-args*)} | ||
|
||
serve | ||
{:doc "Serve static assets" | ||
:requires ([babashka.http-server :as server]) | ||
:task (server/exec | ||
(merge {:port 8080 | ||
:dir "public/build"} | ||
cli-opts))} | ||
|
||
release-gh-pages | ||
{:doc "Generate a fresh static build and release it to Github Pages." | ||
:task | ||
(do (shell "rm -rf public/build") | ||
(run 'build-static) | ||
(shell "npm run gh-pages"))} | ||
|
||
publish-local | ||
{:doc "Generate a fresh static build and start a local webserver." | ||
:task | ||
(do (run 'build-static) | ||
(run 'serve))} | ||
|
||
release | ||
{:doc "Release the library to Clojars." | ||
:task (shell "clojure -T:build publish")} | ||
|
||
lint | ||
{:doc "Lint with clj-kondo." | ||
:task (exec 'clj-kondo.core/exec) | ||
:exec-args {:lint ["src" "test"]}}}} | ||
:exec-args {:lint ["src" "test" "dev"]}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(ns emmy.sci-extensions | ||
"SCI environment extensions, meant to apply to Emmy's Clerk documentation | ||
build." | ||
(:require [emmy.env.sci] | ||
[sci.core :as sci] | ||
[sci.ctx-store])) | ||
|
||
(sci.ctx-store/swap-ctx! | ||
sci/merge-opts | ||
{:namespaces emmy.env.sci/context-opts}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,45 @@ | ||
(ns user | ||
(:require [nextjournal.clerk :as clerk] | ||
[emmy.env])) | ||
(:require [mentat.clerk-utils.build :as b] | ||
[nextjournal.clerk.config :as cc])) | ||
|
||
(alter-var-root #'*warn-on-reflection* (constantly true)) | ||
(try (requiring-resolve 'cljs.analyzer.api/ns-resolve) | ||
(catch Exception _ nil)) | ||
(require '[emmy.env]) | ||
|
||
(comment | ||
;; Activate this line to start the clerk server. | ||
(clerk/serve! | ||
{:browse? true :port 7778})) | ||
(alter-var-root #'cc/*bounded-count-limit* | ||
(constantly 10)) | ||
|
||
(comment | ||
;; call clerk/show on files to be rendered: | ||
(clerk/show! "src/emmy/calculus/derivative.cljc") | ||
(clerk/show! "src/emmy/differential.cljc")) | ||
(alter-var-root #'*warn-on-reflection* (constantly true))) | ||
|
||
(def index | ||
"Hmm, let's create this... TODO" | ||
"dev/index.md") | ||
|
||
(def notebooks | ||
["src/emmy/**/**.cljc" | ||
"src/emmy/**/**.clj"]) | ||
|
||
(def defaults | ||
{#_#_:index index | ||
:browse? true | ||
:watch-paths ["src" "dev"]}) | ||
|
||
(def static-defaults | ||
(assoc defaults | ||
:browse? false | ||
:paths notebooks | ||
:cname "emmy.mentat.org" | ||
:git/url "https://github.com/mentat-collective/emmy")) | ||
|
||
(defn serve! | ||
([] (serve! {})) | ||
([opts] | ||
(b/serve! | ||
(merge defaults opts)))) | ||
|
||
(def halt! b/halt!) | ||
|
||
(defn build! [opts] | ||
(b/build! | ||
(merge static-defaults opts))) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this yet, since none of the viewers are actually using Emmy code on the client side.