mirror of
https://github.com/seigler/dash-docs
synced 2025-07-27 09:46:12 +00:00
42 lines
1 KiB
Ruby
42 lines
1 KiB
Ruby
module Jekyll
|
|
|
|
class Clients < Liquid::Tag
|
|
def render(context)
|
|
page = context.environments.first['page']
|
|
r = ''
|
|
for h in page['client_info']
|
|
r += '<tr>'
|
|
r += '<th>' + h['text'] + '</th>'
|
|
hid = h['id']
|
|
td = h.fetch('td', 'td')
|
|
for c in page['clients']
|
|
if c.has_key?('incomplete')
|
|
next
|
|
end
|
|
ci = c[hid]
|
|
curi = c.fetch(hid + '_uri', nil)
|
|
r += '<' + td + ' class="clients ' + c['os']
|
|
if h.has_key?(ci)
|
|
r += ' ' + h[ci]
|
|
end
|
|
r += '">'
|
|
if curi
|
|
r += "<a href='" + curi + "'>" + ci + "</a>"
|
|
elsif ci
|
|
r += ci
|
|
elsif hid == '_os'
|
|
for os in c['os'].split(' ')
|
|
r += '<img class="icon" src="img/ico-' + os + '.png">'
|
|
end
|
|
end
|
|
r += "</" + td + ">"
|
|
end
|
|
r += '</tr>'
|
|
end
|
|
r
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
Liquid::Template.register_tag('clients', Jekyll::Clients)
|