b/rb/log 3: interpolation
now it generates the homepage, too
mood: proudsoftwareblog/reblogdevlogso, some good progress, and some bad progress, as is tradition with hobby projects.
on the plus side:
- i've implemented a tolerable templating language for html. in retrospect i could've used an existing one, but surprisingly, there are very few runtime templating systems in rust!
- with the same language i've implemented some templating, so you can customize the layout of your own site.
- i've started refactoring things. i'm only just getting started, but i've decided on the final structure of the code. it might end up being a total rewrite, but y'know what, that's fine.
- i fixed a bug revealed while writing this very post, where escaped html gets un-escaped when rendering. oops.
on the minus side:
- i have already incurred so hilariously much technical debt. the code is horribly glued together instead of elegantly architected. such is life, when building a prototype; before i get to v0.2, i'll rewrite most of it.
- i haven't really had time to work on it for, like, three weeks. it's fitting nicely enough into my workflow, but it could be fitting nicer, but i haven't had a ton of free time lately.
all told, pretty positive! i've even started that refactor – it's just gonna be slow going, with the other things i have going on.
anyway – while i'll likely rewrite the implementation, the language itself just needs some usability tweaks to be where i want it. i didn't use an existing one because, as mentioned, there doesn't seem to be an accepted standard for runtime templates, but also because i dislike the idea of embedding another dsl into my html.
so instead i have, for example, this mildly cursed thing:
<hgroup>
<h2>posts</h2>
</hgroup>
<ul class="grid-list">
<dyn for="post" in="posts.en"><dyn if="post.published">
<li>
<hgroup>
<h3><a dyn:href="post.url"><dyn value="post.title"></dyn></a></h3>
<p><dyn value="post.subtitle" /></p>
<time class="post" dyn:datetime="post.published"><dyn value="post.published" format="%-d %b. %Y"></dyn></time>
<dyn for="tag" in="post.tags">
<span class="tag"><dyn value="tag"></dyn></span>
</dyn>
</hgroup>
</li>
</dyn></dyn>
</ul>
there are definitely some kinks to iron out here, to be clear, and i doubt the final version will even look all that similar. but i quite like that this is all html, which syntax-highlights as html, instead of another language that my editor needs special support for.
it's also deliberately underpowered – it's only meant to represent your input as html, so it can't do anything advanced. if you want anything advanced, modify the input accordingly. (don't include a whole worse programming language in the templating language, please.)
all told: i'm quite excited! my blog is easier and easier to maintain with every feature. and hopefully, that trend progresses!