💾 Archived View for jsreed5.org › log › 2023 › 202312 › 20231203-file-divergence.gmi captured on 2024-07-08 at 23:50:12. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-12-28)

-=-=-=-=-=-=-

File Divergence

2023-12-03

---

A few years ago I wrote a "microblogging" script to keep an offline, Twitter-style micro-journal. The "timeline" file created by this script uses Markdown and has a simple structure: each post has a simply-ascending header, a post date, the post content itself, a list of any embedded attachments, and any reply information. I chose Markdown because it's easy to manipulate in a plain text editor but also renders well into a Web-like page. This makes the timeline itself file highly portable.

The structure of the file has some shortcomings. I use Syncthing to synchronize my journal between all my devices, but sometimes I'll add a post to the journal on two different devices before they have a chance to update each other. This causes a divergence between the files, as well as between potential attachments and reply links.

Given that I use a simple numbering system for each post, I don't have an easy way to reconcile diverging timeline files. I can't simply append posts from one file to another: not only might the posts no longer be in chronological order, but naively changing numbered post headers will likely break reply links. The same thing happens if I split the files into individual posts and rearrange them chronologically--without saving some kind of graph information from replies, I can't determine the correct new post number to reply to. I could potentially dump everything into a database structure and regenerate the file from there, but that introduces extra dependencies and undermines my goal of having a single fully-portable timeline file.

This might be a shortcoming I'll simply have to live with. Portability is my primary concern when it comes to the tools I write for myself, and this problem appears rarely enough that it is often easy to rectify by hand. Still, it would be fun to find a robust and elegant scripted solution.

---

Up One Level

Home

[Last updated: 2023-12-03]