=base:build-info.json
{"layout":"article"
,"publicationStatus":"Public"
}
=base:preamble.json
{"author": "Lucas DiCioccio"
,"date": "2022-05-03T01:00:00Z"
,"title": "Scripting subsets of page contents in Dhall."
}
=base:topic.json
{"topics":["web", "haskell"]
,"keywords":["dhall", "configuration languages", "programming"]
}
=base:social.json
{"twitter": "lucasdicioccio"
,"linkedin": "lucasdicioccio"
,"github": "lucasdicioccio"
,"cohost": "lucasdicioccio"
,"mastodon": "https://fosstodon.org/@lucasdicioccio"
}
=base:summary.cmark
A demo of using Dhall as an intermediary step for my blog-engine sections.
=base:main-content.cmark
Since I've started building my own blog engine, I wanted some limited #scripting
capabilities in the text-processing engine. A specific case I had in mind was
to generate some tables or listings for what you currently find on the
[/readings.html](/readings.html) or on the [/tips.html](/tips.html) page. I
would like something like [Microformats](http://microformats.org/), but
tactically applied to individual articles, with little ceremony.
A more telling example could be a #photo gallery where we list a dozen of
images. For each image you'd want a title, an URL, a preferred background color
for the frame, maybe a caption etc. Hand-editing such galleries is a lot of
work, and the extra ceremony to store less than 100 records in a DB is not
worth it. There's a gap to fill
This article demonstrates and discusses a PoC using the Dhall programming
language as a specific step.
## high-level need
What is common in the type of pages where I would like some minimal templating is:
- I want to reference and organize a moderately large amount of items.
- items within a collection have a common structure (e.g., a link to a page would have a title, an URL, some language, and some description from myself).
- I want to present, ideally with some mechanical template to keep the styling/HTML-structure consistent.
Thus I have __three distinct characteristics to carve out__:
- 1. define the structure of items
- 2. list a collection of items
- 3. implement some template I use to present these
Separating 1. and 2. is a matter of getting some type and some syntax to write values.
Separating 3. requires a novel feature in my blog-engine: to interpret some structure into some HTML chunk to embed in a longer article. Current generators only produce targets as fully-contained output objects (that then must be embedded via other HTML primitives like `` or `