<commit_before>;; requires s.el to be available and loaded
(require 's)
(require 'cl-lib)

(defun get-string-from-file (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (buffer-string)))

(defun sorted-helm-themes ()
  (cl-sort (mapcar 'symbol-name (helm-themes--candidates)) 'string-lessp :key 'downcase))

(defun generate-theme-files ()
  (mapc
   (lambda (theme)
     (helm-themes--load-theme theme)
     (htmlize-file "./sample.exs" (concat "./html/" theme ".html")))
   (sorted-helm-themes)))

(defun generate-index-html (tpl iframes-html)
  (s-format tpl 'elt (list spacemacs-version iframes-html)))

(defun generate-iframes-html (tpl themes)
  (s-join ""
          (mapcar
           (lambda (theme)
             (s-format tpl 'elt (list theme)))
           themes)))

(defun generate-site-files ()
  (delete-directory "./html")
  (generate-theme-files)
  (append-to-file
   (generate-index-html (get-string-from-file "./templates/layout.html")
                        (generate-iframes-html(get-string-from-file "./templates/iframe.html") (sorted-helm-themes)))
   nil "./html/index.html"))
<commit_msg>Remove and recreate the html directory on every run<commit_after>;; requires s.el to be available and loaded
;; Just evaluate the buffer the files will be generated in ./html
(require 's)
(require 'cl-lib)

(defun get-string-from-file (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (buffer-string)))

(defun sorted-helm-themes ()
  (cl-sort (mapcar 'symbol-name (helm-themes--candidates)) 'string-lessp :key 'downcase))

(defun generate-theme-files ()
  (mapc
   (lambda (theme)
     ;; (helm-themes--load-theme theme)
     (htmlize-file "./sample.exs" (concat "./html/" theme ".html")))
   (sorted-helm-themes)))

(defun generate-index-html (tpl iframes-html)
  (s-format tpl 'elt (list spacemacs-version iframes-html)))

(defun generate-iframes-html (tpl themes)
  (s-join ""
          (mapcar
           (lambda (theme)
             (s-format tpl 'elt (list theme)))
           themes)))

(defun generate-site-files ()
  (if (file-exists-p "./html")
    (delete-directory "./html" t))
  (mkdir "./html")
  (generate-theme-files)
  (append-to-file
   (generate-index-html (get-string-from-file "./templates/layout.html")
                        (generate-iframes-html(get-string-from-file "./templates/iframe.html") (sorted-helm-themes)))
   nil "./html/index.html"))

{'fraction_non_alphanumeric': 0.16735366859027206, 'fraction_numerical': 0.0, 'mean_word_length': 3.004950495049505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3768633', 'n_tokens_mistral': 829, 'n_tokens_neox': 815, 'n_words': 185}