def html_summary(item, **kwargs): if hasattr(item, 'icon'): p = kwargs.get('icon_path', icon_path(item.icon)) image = u'<img style="vertical-align:middle;" src="%s" width="128" />' % p else: image = u'' args = dict(image=image, title=format_html(item.label), name=format_html(item.name)) html = u'<div class="summary"><p class="title"> %(image)s' % args html += u'%(title)s</p>' % args html += u'\n<hr>' criteria = item.criteria # Crédits items = [] for label in ('author', 'authors'): value = criteria.get(label, 'None') if not value: continue if not isinstance(value, (list, tuple, set)): value = [value] for author in value: if author and author != "None": items.append(format_author(author, key=label, show_all=True)) items.sort() html += html_section(u'credits', u'Credits', items) # Criteria items = [] for label, value in item.criteria.items(): if label in ('icon', 'author', 'authors') or not value: continue items.append( u'<span class="key">%s</span>: <span class="value">%s</span>\n' % (format_html(label).capitalize(), format_html(value, key=label))) html += html_section(u'criteria', u'Criteria', items) # Tags items = [] for tag in item.tags: items.append(u'<span class="key">%s</span>\n' % tag) html += html_section(u'tags', u'Tags', items) html += u'</div>' return html
def html_metainfo_summary(project): items = [ '<span class="key">Name</span>: <span class="value">%s</span>\n' % (project.name), '<span class="key">Path</span>: <span class="value">%s</span>\n' % (project.path), ] for label, value in project.metadata.items(): if label in ("icon", "alias") or not value: continue value = pretty_print(getattr(project, label)) items.append('<span class="key">%s</span>: <span class="value">%s</span>\n' % (label.capitalize(), value)) return html_section("meta-information", "Meta-information", items)
def html_metainfo_summary(project): items = [ '<span class="key">Name</span>: <span class="value">%s</span>\n' % (project.name), '<span class="key">Path</span>: <span class="value">%s</span>\n' % (project.path) ] for label, value in project.metadata.items(): if label in ('icon', 'alias') or not value: continue value = pretty_print(getattr(project, label)) items.append( '<span class="key">%s</span>: <span class="value">%s</span>\n' % (label.capitalize(), value)) return html_section('meta-information', 'Meta-information', items)
def html_item_summary(project): excluded_categories = ['cache', 'world'] html = '' # Loop on all categories available in this project for category, desc in project.categories.items(): if category in excluded_categories: continue title = desc['title'] items = project.items(category) if not items: continue html_items = [] for item_name in sorted(items): model = items[item_name] html_items.append( '<span class="item"><span class="item-namebase">%s</span><span class="item-ext">%s</span></span>\n' % (model.filename.namebase, model.filename.ext)) html += html_section(category, title, html_items) return html
def html_item_summary(project): excluded_categories = ["cache", "world"] html = "" # Loop on all categories available in this project for category, desc in project.categories.items(): if category in excluded_categories: continue title = desc["title"] items = project.items(category) if not items: continue html_items = [] for item_name in sorted(items): model = items[item_name] html_items.append( '<span class="item"><span class="item-namebase">%s</span><span class="item-ext">%s</span></span>\n' % (model.filename.namebase, model.filename.ext) ) html += html_section(category, title, html_items) return html