Exemple #1
0
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
Exemple #2
0
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
Exemple #3
0
    auth.fboudon,
    auth.jchopard,
    auth.tcokelaer,
    auth.dbarbeau,
    auth.sdufourko,
    auth.gcerutti,
    auth.cgodin,
    auth.jcoste,
    auth.emoscardi,
    auth.pfernique,
    auth.cpradal,
]

random.shuffle(author_lst)

authors = ', '.join([format_author(author) for author in author_lst])
args['authors'] = authors

CREDITS = """
<html>
<head>
    <link rel="stylesheet" type="text/css" href="%(stylesheet)s">
</head>

<body>
<h2 class="subtitle">OpenAleaLab</h2>
<p class="introduction">Platform is written by (random order) ... </p>

%(authors)s

<p class="introduction">Components are written by numerous authors, see "Plugins" tab for more information</p>
Exemple #4
0
def format_label_author(author):
    return format_author(author, email=False)
Exemple #5
0
def format_label_author(author):
    return format_author(author, email=False)