<commit_before>(ns slice.handler
  (:require [slice.dev :refer [browser-repl start-figwheel]]
            [hiccup.page :as hiccup]
            [clojure.edn :as edn]
            [compojure.core :refer [GET POST defroutes]]
            [compojure.route :refer [not-found resources]]
            [ring.middleware.defaults :refer [api-defaults wrap-defaults]]
            [selmer.parser :refer [render-file]]
            [environ.core :refer [env]]
            [prone.middleware :refer [wrap-exceptions]]))

(defroutes routes
  (GET "/" [] (render-file "templates/index.html" {:dev (env :dev?)}))

  (GET "/state" [] (slurp "state.edn"))
  (POST "/state" {:keys [body params]}
        (let [new-state (-> body slurp edn/read-string)]
          (spit "document.html"
                (hiccup/html5
                 (hiccup/include-css "document.css")
                 (:html new-state)))
          (spit "document.css" (:css new-state))
          (spit "state.edn" (dissoc new-state :html :css))
          "saved"))
<commit_msg>different markup location<commit_after>(ns slice.handler
  (:require [slice.dev :refer [browser-repl start-figwheel]]
            [hiccup.page :as hiccup]
            [clojure.edn :as edn]
            [compojure.core :refer [GET POST defroutes]]
            [compojure.route :refer [not-found resources]]
            [ring.middleware.defaults :refer [api-defaults wrap-defaults]]
            [selmer.parser :refer [render-file]]
            [environ.core :refer [env]]
            [prone.middleware :refer [wrap-exceptions]]))

(defroutes routes
  (GET "/" [] (render-file "templates/index.html" {:dev (env :dev?)}))

  (GET "/state" [] (slurp "state.edn"))
  (POST "/state" {:keys [body params]}
        (let [new-state (-> body slurp edn/read-string)]
          (spit "resources/public/document.html"
                (hiccup/html5
                 (hiccup/include-css "default.css")
                 (hiccup/include-css "document.css")
                 (:html new-state)))
          (spit "resources/public/document.css" (:css new-state))
          (spit "state.edn" (dissoc new-state :html :css))
          "saved"))

{'fraction_non_alphanumeric': 0.15639589169000934, 'fraction_numerical': 0.0009337068160597573, 'mean_word_length': 2.1842496285289745, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2819070', 'n_tokens_mistral': 700, 'n_tokens_neox': 695, 'n_words': 154}