Hi there,
To start with, I have to say that Drafts is absolutely wonderful. I bounced off the app a couple of times in the past because I lacked a real use-case, but now I have a few key things I use it for, I’m using it a hundred times a day, and I adore it. I couldn’t live without it. It’s genius. Thank you for creating it!
On to my scenario:
I have an action to append entries to a log file.
The first attempt was a standard Drafts templating language-based action, which appends to a file using the following format:
**[[time|%H:%M]]**: [[draft]]
[[hashtags]]
This works, but it leads to inconsistency with line breaks in the file where if there are no hashtags we get a nice newline, but if there are hashtags, you have no line break between entries, e.g.
**11:10**: Test
#test
**11:10**: Test
**11:10**: Test
#test
My neat-freak tendencies rail against this, so I tried using conditional mustache templating to fix the issue, like so:
**{{format(date, "%H:%M")}}**: {{content}}
{{#hashtags}}{{hashtags}}{{/hashtags}}
{{^hashtags}}
{{/hashtags}}
However, nothing ever gets appended in the {{hashtag}}
-related section (the test
tag never appears). I just get several empty lines, as if the {{*hashtag}}
bits are getting entirely ignored:
**11:10**: Test
(note the four blank lines)
To work out if the conditionals are working, I tried:
**{{format(date, "%H:%M")}}**: {{content}}
{{#hashtags}}The hashtags are: {{hashtags}}{{/hashtags}}
{{^hashtags}}
There aren't any hashtags!
{{/hashtags}}
but the output (again, with tags on the draft) was
**11:07**: Test
There aren't any hashtags!
(note the two blank lines before and then one after the “There aren’t any…” line).
To further test, I tried:
**{{ format(date, "%H:%M") }}**: {{ content }}
{{ hashtags }}
Which should, essentially, replicate the Drafts templating language version. However, again, no hashtags are included in the text that gets appended. We get:
**11:14**: Test
(one blank line)
So I’m wondering: am I doing something very silly, or is that particular mustache tag not working at the moment?
This can be observed on both macOS and iOS, as tested so far.