100 Days of Code Day 3: Blog Processor Scripts and Swift on Linux.

|

Today I rewrote the blog processor scripts using Swift 3. It was a whole lot easier than using node.js. This time around, I feed the script a TextBundle file exported from Ulysses and it converts it into a Kirby Baseblog-friendly format. At this point, it is a bunch of spaghetti code, but I could see myself making it customizable for custom Kirby templates. In the end, I’ll probably put my code on GitHub, but only when the code is of higher quality.

Ulysses iOS exports the Textbundle file to some apps as a zip archive. I wrote a very small bash script that handles this case and calls the Swift utility. I’ve looked into file watcher utilities on Linux, and while none are as good as Hazel, I think I could make it work.

The real challenge came in when I tried to build the script on my Linux VPS. There are many frameworks that Swift on Linux doesn’t have access to, so there’s still a bit more work to do. For example importing Darwin or using NSRegularExpression will most likely never be supported. I worked around a lot of these issues, but at this point, this is a rabbit hole that would take my attention off of more important things. I’ll revisit this at some point, but this whole thing is another reason why a collocated Mac mini or an always-on iMac would be nice…