joplin / plugin-templates

Create templates in Joplin and use them to create new notes and todos.
MIT License
163 stars 23 forks source link

Allow logical comparisons in handlebars #77

Closed ImperialSquid closed 11 months ago

ImperialSquid commented 1 year ago

Fixes: #56, #64

Adds the compare helper and various useful comparisons

Example use case:

---
topics:
  label: How many topic headers to use?
  type: num

---

{{#compare topics ">=" 1}}
# Header 1

{{#compare topics ">=" 2}}
# Header 2

{{#compare topics ">=" 3}}
# Header 3

{{/compare}}
{{/compare}}
{{/compare}}

Not included, but is a good idea:

ImperialSquid commented 1 year ago

@nishantwrp

nishantwrp commented 11 months ago

Thank you so much for this pull request @ImperialSquid. I have decided to take this one step further and allow users to do even more with templates. This pull request motivated me to do this. I've created another pull request for that and included your commits in that pr (so, closing this one).

Pull Request: #79