Note: there is now a GitHub repository for this project. Get the latest code there, including a downloadable Automator app
After sleeping on this I decided there were a few things I could do better. Having to put raw source in the document was annoying. I looked into several ways to do this, but found Ulysses had the answer.
If a line of text is “marked” in Ulysses (that’s the
:: notation) it gets exported as its own paragraph, but no other HTML tags are applied. This worked out perfectly. It gives me a way to highlight the WordPress tags in the document, and doesn’t require complicated scripting.
This makes handling the tags much easier. Simply write the tags out as a comma separated list on their own line directly after the heading and apply the marked markdown1 tag.
I also wanted a way to handle the WordPress “more” divider. It can be inserted anywhere as raw code:
<!--more-->. But it’s ugly and fragile when done that way. With the updated script, a single line containing
::MORE:: (all caps with the Ulysses marked tag) will be converted into the WordPress tag.
This is an example showing the line of tags and the more divider.
The updated code for the standalone script:
The updated code for the Automator application:
Now the tag list and more divider are handled with markdown. This also means that they can be rendered invisible in a PDF or ePub with an updated style sheet.
As always, pull requests are welcome.
- This is damn awkward to explain. Sorry. ↩