Impertio v0.1.2

impertiocomputer sciencerust

This has been an eventful weekend - I added RSS, made the SSG modular so I can add more markup formats in the future, added a config file, and added category listings that make use of the Org Macro format.

As always, the source of this file is available [[][here]].


I implemented RSS by extracting the metadata from the Org files (~TITLE~, ~AUTHOR~, ~DESC~) and feeding them to the wonderful crate that is [[][rss]].

My RSS feed is available [[][here]], if you would like to view it. I don't know why it downloads it, sorry about that.


I implemented config files using the [[][Serde crate]]. One of my favorite crates, other than [[][~anyhow~]].


I got over my fear of Rust Traits and implemented a generic Trait interface for my file handlers.

pub trait FileHandler: DynClone {
    fn new() -> Self where Self: Sized;
    fn handle_file(&mut self, ctx: FileContext) -> anyhow::Result<()>;
    fn extract_metadata(&mut self, ctx: FileContext) -> anyhow::Result;


As you may be able to tell, I had to fight a little with the Rust Trait system to get it to let me clone the implementations of the Trait. Stack Overflow led me to finding the tiny little crate, [[][~dyn-clone~]], which easily solved my problems.

Category Listings


That's it. That's all it takes to embed a listing into an Org file in Impertio. Currently I am messily pulling the metadata into the Org parser, which is not optimal. I'll /hopefully/ figure out how to do that differently in the future.

The Future

Currently I am not putting article content into the RSS feed Items, so I would like to do that in the future. My Org parser does not currently support inline styling (which was probably visible if you read this article before I implemented it... sorry about that), which I would like to fix. I'm currently doing syntax highlighting on the client side using [[][Highlight.js]], which is extremely undesirable. I am planning on switching to doing the syntax highlighting at compile time using the [[][Syntect crate]].


- [[][v0.1.1]]
- [[][v0.1.2]]