diff --git a/mustache_lint/mustache_lint.php b/mustache_lint/mustache_lint.php index 3e324b65..daa8cedb 100644 --- a/mustache_lint/mustache_lint.php +++ b/mustache_lint/mustache_lint.php @@ -117,6 +117,12 @@ $content = preg_replace('([{}]{2,3})', '{{=<% %>=}}${0}<%={{ }}=%>', $content); return '"' . $content . '"'; }, + 'shortentext' => function ($text) { + [$length, $content] = explode(',', $text, 2); + $length = intval(trim($length)); + $content = trim($content); + return substr($content, 0, $length) . (strlen($content > $length) ? '...' : ''); + }, 'js' => [$jshelper, 'add_js'], ], 'partials_loader' => new simple_core_component_mustache_loader($theme),