Using ELisp as an HTML templating engine
reddit / emacs
----------------------------------------------------------------------
verticaleyes · 2022-04-09 09:31
----------------------------------------------------------------------
verticaleyes · 2022-04-09 09:37
I've been porting my blogging setup from Hakyll to an ELisp based
custom solution, and was in need for a templating engine. I found out
that Elisp don't really need one.
This is a tldr; video, if you find it interesting, there is an
accompnying blog post with details: https://bitspook.in/blog/using-
elisp-as-an/
For the curious, here is my (very much wip) blogging setup:
https://github.com/bitspook/press.el
Although it's wip, I'll appreciate feedback/criticism/ideas/code-
reviews
---
Hope you like it; I started making kind of videos I wished there was
more of, but I find making videos a very boring (and exhausting) thing
to do. I wonder if there is a fluent way of building videos; something
that can convert code to videos so I don't have to fumble around
KDEnlive/OBS.
----------------------------------------------------------------------
agumonkey · 2022-04-09 13:27
And it may even extend the thinking over react since react are
functions from A -> tree which are very much like macros
----------------------------------------------------------------------
noman_032018 · 2022-04-09 14:07
It has been pretty nice since Emacs added these things. I often use
async, esxml & libxml to do in Emacs what I'd otherwise have to switch
environment for.
I'd tried using org-project for blogging but it's languishing as a
WIP.
----------------------------------------------------------------------
stayclassytally · 2022-04-09 14:23
Ohh never though of them that way
----------------------------------------------------------------------
agumonkey · 2022-04-09 14:49
Maybe i'm over exaggerating the similarity due to remains of lisp-love
but eval over sexp AST looks a lot like react re-render over dom tree
(react being lazier though :)
----------------------------------------------------------------------
verticaleyes · 2022-04-09 15:18
What's async and esxml that you talk of, and what do you use it for?
I've tried doing async in Elisp but found it to be clunky. May be I
was doing things wrong.
----------------------------------------------------------------------
noman_032018 · 2022-04-09 15:31
[Async is this](https://github.com/jwiegley/emacs-async), and yeah
it's a bit clunky due to how you have to pass data inline or come up
with your own exchange method (writing and loading sexps to & from
files is viable, as are readable datastructures). You *can* backquote
and unquote values in a lambda you pass to the Emacs child instance,
but sometimes it gets complicated-enough that it's not worth messing
with (particularly when they aren't readable, so you have to make them
so).
[esxml](https://github.com/tali713/esxml) is a code-generation library
for Elisp, but the part that I use more often is in [esxml-
query](https://github.com/tali713/esxml#extracting-data-from-html-and-
xml-documents-with-esxml-queryel).
I use it for stuff like grabbing forum threads & images, among other
things.
----------------------------------------------------------------------
repelliuss · 2022-04-09 22:49
I was thinking of creating a simple templating engine that works in
the same spirit of this. My plan is embedding elisp in html then
replacing them with the results of evaluation.
Though I wasn't aware of this and may like this better with cherries
on top.
----------------------------------------------------------------------
sreekumar_r · 2022-04-10 05:16
There are plenty of tools based on org-mode to create static websites.
And Emacs lisp has got better things to do.
Watch this video:
[Search Engine prototype using Elisp and
JavaScript](https://www.youtube.com/watch?v=bHGVp9c7fPg)