Skip to content

Instantly share code, notes, and snippets.

Avatar
🕶️
(probably) completing resting

Nikita Prokopov tonsky

🕶️
(probably) completing resting
View GitHub Profile
View config-parse.clj
(require '[clojure.string :as str])
(defn parse-line [line]
(let [line (str/replace line #"[\\]\s*(\n\s*|$)" "")]
(when-not (str/blank? line)
(let [[k v] (str/split line #"=" 2)]
[(str/trim k) (when-not (str/blank? v) (str/trim v))]))))
(defn parse [text]
(let [lines (str/split text #"(?<![\s\\])\s*\n")]
You can’t perform that action at this time.