Advertisement

Alfred, Dropbox, Hazel, and Markdown? All in a day's work

TJ Luoma's Desk

"How does a geek-pastor use a computer?" is a question that I assume a lot of people ask themselves, although they probably don't.

But if they did, this would be one answer:

I need to make a list of the readings and sermon titles for the church secretary and choir director, so one can make the weekly worship guide, and the other can plan the music. I put my schedule up as a web page, like this:

The reading is linked to the text so that everyone involved can easily access the text (I'll need it for sermon preparation, and the choir director will need it to see what the text is about so she can try to match it to potential hymns/anthems).

Which reminds me: I have an Alfred shortcut for looking up Bible passages from the NRSV:

A month year of Sundays

Today the church secretary reminded me that I needed to update the list, as I had gone through all of the previous weeks that I had scheduled (oops). I decided that it was a good time to make a list of all of the Sundays between now and the end of 2015; that way I could start to fill in the dates of special events, vacation, etc.

So... how would a sane person make a list of Sundays? Maybe look at a calendar? Try to figure them out in your head?

Not me. I wrote a shell script:

Actually I made my loop a little more complex, in order to give me the Markdown formatting that I wanted for the list:

That gave me a nice, clean "unordered list" in HTML.

  • The first line under the date will be the Scripture Reading.

  • The second line will be the sermon title.

  • The third line (if any) will be any notes about that particular Sunday.

Fortunately I didn't have to include all of that in the output because I could use CSS' "generated content" feature to automatically add it for me:

Markdown

Markdown is a simple way of writing plain text which can be automatically translated into HTML (the language of web pages). But I don't want to have to remember to manually update the HTML page every time I edit the plain text Markdown file.

So I have Hazel do that for me:

Translation: Any time the file worship.mmd in the folder worship.luo.ma is updated, run that script on it, which will automatically convert it from Markdown to HTML and save it as the file index.html.

The ~/Sites/worship.luo.ma/ folder is linked to my Dropbox, so I can edit that file on any of my Macs (or on my iPad or iPhone), and every time I press "Save" the website version will update, usually in less than a minute (the amount of time it takes Dropbox to sync and Hazel to notice the file has changed).

(Have I mentioned how much I love having a MacMiniColo server? Because I do. A lot.)

You can see the result for yourself at http://worship.luo.ma, or view the Markdown file at http://worship.luo.ma/worship.mmd.

Now... if only I could get Hazel to clean up my actual desktop.