I want to store blog posts in EDN file like the one shown below and then convert them to HTML.
Here is a sample file:
:title "The first blog post"
[:p "First paragraph"]
[:li "List Item 1"]
[:li "List Item 2"]
[:li "List Item 3"]]
[:p "Second paragraph"]]]}
Then I try to read it using the following code:
(:require [cl-www.logic :refer [render-everything]]
[cl-www.common :refer [prettify-html]]
(:import (org.jsoup Jsoup)
(def path "/Users/myuser/cl-www/resources/p-2022-12-17.edn")
(let [post-data (-> path
post-struct (:body post-data)
html (->> html-struct
When I run
(test-edn) I get the following error:
Execution error (IllegalArgumentException) at hiccup.compiler/normalize-element (compiler.clj:59).
[:div [:p "First paragraph"] [:ul [:li "List Item 1"] [:li "List Item 2"] [:li "List Item 3"]] [:p "Second paragraph"]] is not a valid element name.
How can I fix it, i. e.
- manually write a EDN file, then
- read it in Clojure,
- insert into a Hiccup structure, and
- export it to HTML?