Ejemplo n.º 1
0
def template_equation(p, equation, features):
    elements = reversed(sorted([(equation[c], c) for c in equation]))
    p(html.h2(u'Equation:'))
    with p(html.p_block({u'style':
                         u'font-family:sans;font-size:14pt;font-weight:bold;'})):
        p(u'= ' + u' + '.join([u'%s×[%s]<br />' % (unicode(weight), 
                                             html.span_smaller(features[column]))
                                                for weight,column in elements
                                                    if column is not None]))
        p(u' + %s' % equation[None])
Ejemplo n.º 2
0
def template_rankings(p, items, rankings):
    with p(html.table()):
        with p(html.tr()):
            with p(html.td_block({u'valign':u'top'})):
                p(html.h2('Rankings:'))
            with p(html.td_block({u'valign':u'top'})):
                p(u'&nbsp;')
                p(u'<button id="rerank">Re-rank</button>')
            with p(html.td_block({u'valign':u'top'})):
                p(u'<img src="http://www.labmeeting.com/images/upload/spinner.gif" style="display:none;" id="loading" />')
    r = [u'%s (%s)' % (html.b(items[i]), html.span_smaller(u'%s' % score))
                                                    for score,i in rankings]
    p.sub(partial_list(r))