feat: to-html

This commit is contained in:
2026-02-27 18:45:14 -07:00
parent fa42052a6a
commit f811a519b5
5 changed files with 11 additions and 5 deletions

View File

@@ -180,8 +180,8 @@
parser, return a map with the following keys
• :top-level-nodes The nodes that /should/ be at the top-level.
• :first-section-nodes The nodes that should be wrapped in a new
section node
• :rest Everything else!"
section node.
• :rest Everything else."
[nodes]
(let [[of-top-level remaining-nodes]
(->> nodes (split-with #(of-type? % "property-drawer" "keyword")))

View File

@@ -72,6 +72,12 @@
[:article
rendered]]])))
(defn to-html
"Read `f` with `slurp` as an Org document and return a string of
rendered HTML."
[f]
(str (hiccup/html {} (-> f slurp element/read-string org-document))))
;;; Further dispatching on `org-element`

View File

@@ -37,8 +37,7 @@
(force-create-sym-link (fs/file dest "Temml-Plex.css")
(io/resource "net/deertopia/doerg/Temml-Plex.css"))
(fs/delete-if-exists (fs/file dest "index.html"))
(->> (h/html (-> src slurp element/read-string render/org-document))
str (spit (fs/file dest "index.html"))))
(->> src render/to-html str (spit (fs/file dest "index.html"))))
(defn render-edn [& {:keys [src dest]
:or {src some-org-file

View File

@@ -0,0 +1,2 @@
(ns net.deertopia.doerg.render-test
(:require [net.deertopia.doerg.render :as sut]))

View File

@@ -1,5 +1,4 @@
#+title: aghhh
#+latex_header: \usepackage{ifxetex}
- blah blah prose prose prose \(c = \sqrt{x^2 + y^2}\), alal.
- this thing is \(x\)