helpers / handlebars-helpers

188 handlebars helpers in ~20 categories. Can be used with Assemble, Ghost, YUI, express.js etc.
http://assemble.io/helpers/
MIT License
2.22k stars 365 forks source link

Handle empty fields #412

Open Froostx opened 1 year ago

Froostx commented 1 year ago

I'm using XplatGenerateReleaseNotes plugin for my release notes.

I want to handle my #if that recognizes when a custom field is empty. I found in the plugin source code that there is a helper called "isEmpty", but I can't get it to work. Maybe the helper.isEmpty doesn't work for strings?

Here is my template:

{{#return_parents_only this.workItems this.relatedWorkItems}}
{{#if (or (contains (lookup this.fields 'System.WorkItemType') 'User Story') (contains (lookup this.fields 'System.WorkItemType') 'Feature'))}}
{{#if (isEmpty (lookup this.fields 'Custom.ReleaseNotes'))}}
emtpy
{{else}}
{{#with fields}}
* **{{{get 'System.Title' this}}}:** {{{sanitize (get 'Custom.ReleaseNotes' this)}}}
{{/with}}
{{/if}}
{{/if}}
{{/return_parents_only}}

Any ideas will be very helpful :) thx