diff --git a/src/awesomewm.d.tl/generator/snippets.tl b/src/awesomewm.d.tl/generator/snippets.tl index daeff11..7eb86df 100644 --- a/src/awesomewm.d.tl/generator/snippets.tl +++ b/src/awesomewm.d.tl/generator/snippets.tl @@ -69,8 +69,14 @@ function snippets.render_records_from_Parameters(items: List 0 end):concat("\n") - end):filter(function(p: string): boolean return #p > 0 end):concat("\n") + end):filter( + function (s: string): boolean + return not utils.is_empty(s) + end):concat("\n") + end):filter( + function (s: string): boolean + return not utils.is_empty(s) + end):concat("\n") end function snippets.render_record_functions(items: List): string diff --git a/src/awesomewm.d.tl/utils.tl b/src/awesomewm.d.tl/utils.tl index f4debbb..ff97a48 100644 --- a/src/awesomewm.d.tl/utils.tl +++ b/src/awesomewm.d.tl/utils.tl @@ -43,6 +43,10 @@ function utils.capitalize(s: string): string return (s:gsub("^%l", string.upper)) end +function utils.is_empty(s: string): boolean + return s == nil or s == "" +end + -- At some point, we should probably write a wrapper to make penlight's function work with pcalls. function utils.do_or_fail(func: function(...: any): (T | nil, string), ...: any): T local logger = require "logger"