   (gstring/unescapeEntities
    (clojure.string/replace (trim-newline (trim str)) #"\s+" " ")))
 
-
-;;;; CSS modifications
-(defn toggle-class
-  "Toggle CSS class of provided DOM element. A third paramenter as boolean can
-  be provided to force removing or adding the class."
-  ([dom-element class] (.classList/toggle dom-element class))
-  ([dom-element class bool] (.classList/toggle dom-element class bool)))
-
-(defn remove-class
-  "Remove a specific class of a DOM element."
-  [dom-element class]
-  (toggle-class dom-element class false))
-
-(defn add-class
-  "Add a specific class to a DOM element."
-  [dom-element class]
-  (toggle-class dom-element class true))
-
-
-;;;; Language
-(defn language
-  "Returns currently selected language."
-  []
-  (load-from-app-state :layout/lang))
-
-(defn language-next!
-  "Set new language. Should be a keyword."
-  [lang]
-  (store-to-app-state! 'layout/lang lang))
-
-(defn language-locale
-  "Return String as a locale for DateTime instances etc. Defaults to en-US."
-  []
-  (let [lang (language)]
-    (case lang
-      :de "de-DE"
-      "en-US")))
-(s/fdef language-locale
-  :ret string?)
-
-
-;;;; Other
-(defn get-value-by-id
-  "Return value of element matching the id."
-  [id]
-  (let [element (.getElementById js/document (prefix-name id))]
-    (when element (.-value element))))
-
 (defn remove-trailing-slash
   "Remove trailing slash if it exists."
   [s]

            [inflections.core :refer [plural]]
            [discuss.config :as config]
            [discuss.parser :as parser]
            [discuss.utils.logging :as log]))

(defn prefix-name
  "Create unique id for DOM elements."

  :args (s/cat :s string?)
  :ret string?)

(defn prepend-slash
  "Prepend slash to string if none found."
  [s]
  (if (string/starts-with? s "/") s (str "/" s)))
(s/fdef prepend-slash
  :args (s/cat :s string?)
  :ret string?)


;;;; CSS modifications
(defn toggle-class
  "Toggle CSS class of provided DOM element. A third paramenter as boolean can
  be provided to force removing or adding the class."
  ([dom-element class] (.classList/toggle dom-element class))
  ([dom-element class bool] (.classList/toggle dom-element class bool)))

(defn remove-class
  "Remove a specific class of a DOM element."
  [dom-element class]
  (toggle-class dom-element class false))

(defn add-class
  "Add a specific class to a DOM element."
  [dom-element class]
  (toggle-class dom-element class true))


;;;; Language
(defn language
  "Returns currently selected language."
  []
  (load-from-app-state :layout/lang))

(defn language-next!
  "Set new language. Should be a keyword."
  [lang]
  (store-to-app-state! 'layout/lang lang))

(defn language-locale
  "Return String as a locale for DateTime instances etc. Defaults to en-US."
  []
  (let [lang (language)]
    (case lang
      :de "de-DE"
      "en-US")))
(s/fdef language-locale
  :ret string?)


;;;; Other
(defn get-value-by-id
  "Return value of element matching the id."
  [id]
  (let [element (.getElementById js/document (prefix-name id))]
    (when element (.-value element))))

(defn log
  "Print argument as JS object to be accessible from the console."
  [arg]
