Have you ever used Lua? It’s a pretty cool language. It is also one of my favourite programming languages, for which I made a case in a past blog post. One of my favourite aspects of Lua’s design that I like to preach about is how it’s really tight and small, while also being genuinely really sweet to write. Today, I’d like to focus on its Lisp-like aspect: domain specific languages (DSLs)—specifically, we will use it to build a templating language for HTML. But first, let me set some background. What’s in a template engine? As a fellow blogger on the Internet maintaining their own blogging software, I’ve used my fair share of templating engines for generating HTML. The premise of a templating engine is really simple: you have a bunch of literal text, and into that literal…
Lua can be a really cool HTML templating engine
Advertisement