UNPKG

730 Btext/coffeescriptView Raw
1HTML = {}
2
3HTML.parseAttributes = (hash) ->
4 Object.keys(hash).map((key) ->
5 "#{key}=\"#{hash[key]}\""
6 ).join ' '
7
8Handlebars.registerHelper 'ul', (context, options) ->
9 "<ul #{HTML.parseAttributes(options.hash)}>" + context.map((item) ->
10 "<li>#{options.fn(item)}</li>"
11 ).join('\n') + "</ul>"
12
13Handlebars.registerHelper 'ol', (context, options) ->
14 "<ol #{HTML.parseAttributes(options.hash)}>" + context.map((item) ->
15 "<li>#{options.fn(item)}</li>"
16 ).join('\n') + "</ol>"
17
18Handlebars.registerHelper 'br', (count, options) ->
19 br = '<br>'
20
21 unless Utils.isUndefined count
22 i = 0
23
24 while i < count - 1
25 br += '<br>'
26 i++
27
28 Utils.safeString br