My final goal is to be able to post updates here using any plain text editor on my PC, laptop, phone, iPod Touch or iPad. I’ve still got a few more steps to get there.
After a day and a bit of strapping various pre-written libraries together as well as a bit of my own logic, I’ve got something that does almost enough. I can create a Markdown-formatted text file in a chosen folder using only a couple of basic rules. The entry title must be on the first line of the file, the content starts on the fourth line, and there’s a block of metadata at the foot of the page. So three rules.
From this, the script can scan the folder, populate a MySQL database with details on each of the files, update the details on any files that have changed since the last scan, and publish the files that are marked to be published. And it can build an index listing each of the articles, blog-style. Since adding the metadata block, I can also mark different files to be formatted differently, so I can have a linked list like I’ve been doing lately.
I’m using PHP Markdown Extra to handle the conversion (I’ll want to use footnotes eventually), and Savvy for templating. It’s all ugly as sin so far but should look better once I’ve found a template I like. I think I’m tired of building layouts from scratch.
My biggest hurdle now is how to actually get this system online. Ideally I could point the script at a Dropbox folder, since all my devices can edit text files there. However my cheap hosting limits my options there. I can’t even rsync a folder from an always-on PC. So right now this is all academic, but I’m hoping to find a solution there.