Ejemplo n.º 1
0
def format_languages(req, ref):
    ldict = {l.hid: l for l in ref.languages}
    in_note = {}
    lnotes = map(normalize_language_explanation, (ref.language_note or '').split(','))

    for lnote in lnotes:
        note = []
        start = 0
        m = None
        for m in LANG_PATTERN.finditer(lnote):
            note.append(lnote[start:m.start()])
            note.append('[')
            if m.group('id') in ldict:
                in_note[m.group('id')] = 1
                lang = ldict[m.group('id')]
                note.append(link(req, lang, label=lang.id, title=lang.name))
            else:
                note.append(m.group('id'))
            note.append(']')
            start = m.end()
        if m:
            note.append(lnote[m.end():])
        yield HTML.li(*note)

    for lang in ldict.values():
        if lang.hid not in in_note:
            yield HTML.li(
                lang.name + ' [', link(req, lang, label=lang.id, title=lang.name), ']')
Ejemplo n.º 2
0
def format_links(req, lang):
    def link(href, label, img, alt=None):
        return HTML.li(
            HTML.a(
                HTML.img(src=req.static_url('glottolog3:static/' + img),
                         height="20",
                         width="20",
                         alt=alt or label),
                ' ',
                label,
                href=href,
                target="_blank",
                title=label,
            ))

    links = []
    if lang.iso_code:
        for isosite in ISOSite.__subclasses__():
            isosite = isosite()
            links.append(link(*isosite.href_label_img_alt(lang.iso_code)))
    pss = [ps() for ps in PartnerSite.__subclasses__()]
    for domain, _links in groupby(lang.jsondata['links'],
                                  lambda l: URL(l['url']).domain()):
        for ps in pss:
            if ps.match(domain):
                links.extend([link(*ps.href_label_img_alt(l)) for l in _links])
    return HTML.ul(*links, **{'class': "nav nav-tabs nav-stacked"})
Ejemplo n.º 3
0
 def _format(loan):
     if loan.source_word.name == 'Unidentifiable' \
             and not loan.source_word.language and not loan.source_word.description:
         yield 'unidentifiable'
     else:
         yield link(req, loan.source_word)
         if loan.source_word.description and loan.source_word.description != '?':
             yield " '%s'" % loan.source_word.description
         if loan.source_word.language:
             yield ' '
             yield link(req, loan.source_word.language)
         if not loan.certain:
             yield ' (uncertain)'
Ejemplo n.º 4
0
Archivo: util.py Proyecto: clld/wold2
 def _format(loan):
     if loan.source_word.name == 'Unidentifiable' \
             and not loan.source_word.language and not loan.source_word.description:
         yield 'unidentifiable'
     else:
         yield link(req, loan.source_word)
         if loan.source_word.description and loan.source_word.description != '?':
             yield " '%s'" % loan.source_word.description
         if loan.source_word.language:
             yield ' '
             yield link(req, loan.source_word.language)
         if not loan.certain:
             yield ' (uncertain)'
Ejemplo n.º 5
0
def toc(s):
    if not s:
        return '', ''

    def link(id_, label):
        return HTML.a(label, href='#{0}'.format(id_))

    def toplink(html):
        a = html.new_tag(
            'a',
            href='#top',
            title='go to top of the page',
            style="vertical-align: bottom")
        a.string = '⇫'
        return a

    def permalink(html, id_):
        a = html.new_tag(
            'a',
            **{
                'href': '#{0}'.format(id_),
                'title': 'Permalink to this headline',
                'class': "headerlink"})
        a.string = '¶'
        return a

    toc_, count = [], 0
    text = BeautifulSoup(s, 'html5lib')
    for d in text.descendants:
        if d.name in ['h1', 'h2', 'h3', 'h4', 'h5']:
            count += 1
            id_ = 'section{0}'.format(count)
            toc_.append((id_, int(d.name[1:]), d.get_text()))
            d.insert(0, text.new_tag('a', id=id_))
            d.append(toplink(text))
            d.append(permalink(text, id_))

    if toc_:
        top_level = min(t[1] for t in toc_)
        nt = OrderedDict()
        curr = []
        for id_, level, label in toc_:
            if level == top_level:
                curr = nt[(id_, label)] = []
            elif level == top_level + 1:
                curr.append((id_, label))
        toc_ = HTML.ul(*[HTML.li(link(*t), HTML.ul(*[HTML.li(link(*tt)) for tt in ns]))
                         for t, ns in nt.items()])
    else:
        toc_ = ''
    return '{0}'.format(text), toc_
Ejemplo n.º 6
0
 def format(self, item):
     if not item.wals_id:
         return ''
     return link(self.dt.req,
                 item,
                 href=self.dt.req.route_url('wals', id=item.id),
                 label="WALS %sA" % item.wals_id)
Ejemplo n.º 7
0
 def format(self, item):
     item = self.get_obj(item)
     if item.family:
         label = link(self.dt.req, item.family) if self._link else item.family.name
     else:
         label = 'isolate'
     return HTML.div(map_marker_img(self.dt.req, item), ' ', label)
Ejemplo n.º 8
0
 def format(self, item):
     concept = self.get_obj(item)
     if concept:
         return link(self.dt.req, concept,
                     **{'title': concept.english_name})
     else:
         return ''
Ejemplo n.º 9
0
def format_comment(req, comment):
    """
    We collect source ids found in comment, retrieve the corresponding source objects from
    the database in a single query and then replace the ids with formatted source links.
    """
    parts = []
    sources = {}
    pos = 0
    comment = comment.replace('~', ' ')
    for match in Reference.pattern.finditer(comment):
        preceding = comment[pos:match.start()]
        parts.append(preceding)
        parts.append(match.group('key'))
        sources[match.group('key')] = None
        if match.group('pages'):
            parts.append(': {0}'.format(match.group('pages')))
        pos = match.end()
    parts.append(comment[pos:])

    for rp in DBSession.query(Refprovider).filter(
            Refprovider.id.in_(sources.keys())):
        sources[rp.id] = rp.ref

    return ' '.join(
        link(req, sources[p]) if sources.get(p) else p
        for p in parts).replace(' : ', ': ')
Ejemplo n.º 10
0
def format_comment(req, comment):
    """
    We collect source ids found in comment, retrieve the corresponding source objects from
    the database in a single query and then replace the ids with formatted source links.
    """
    parts = []
    sources = {}
    pos = 0
    comment = comment.replace('~', ' ')
    for match in REF_PATTERN.finditer(comment):
        preceding = comment[pos:match.start()]
        parts.append(preceding)
        add_braces = \
            (preceding.strip().split() or ['aaa'])[-1] not in ['in', 'of', 'per', 'by']
        if add_braces:
            parts.append('(')
        parts.append(match.group('id'))
        sources[match.group('id')] = None
        if add_braces:
            parts.append(')')
        pos = match.end()
    parts.append(comment[pos:])

    for source in DBSession.query(Source).filter(Source.id.in_(sources.keys())):
        sources[source.id] = source

    return HTML.p(*[link(req, sources[p]) if p in sources else p for p in parts] )
Ejemplo n.º 11
0
def format_iso_retirement(req, lang):
    ir = lang.iso_retirement
    _md, comment = [], ''
    if ir.description:
        comment = HTML.div(
            HTML.p(HTML.strong("Excerpt from change request document:")),
            HTML.blockquote(md(req, ir.description, small=True)))

    if ir.change_request:
        _md.append((
            'Change request:',
            link(
                req,
                Refprovider.get('iso6393:{0}'.format(ir.change_request)).ref,
                label=ir.change_request)))
    _md.append(('ISO 639-3:', ir.id))
    _md.append(('Name:', ir.name))
    if ir.reason:
        _md.append(('Reason:', ir.reason))
    _md.append(('Effective:', ir.effective))

    return infobox(
        HTML.p(
            HTML.strong("Retired in ISO 639-3: "),
            linkify_iso_codes(req, ir.remedy, class_='iso639-3')),
        HTML.ul(*[HTML.li(HTML.strong(dt), Markup(' '), dd) for dt, dd in _md], **{'class': 'inline'}),
        comment)
Ejemplo n.º 12
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(
             link(self.dt.req, c.contribution),
             style="background-color: #%s;" % c.contribution.color,
             class_='dt-full-cell') for c in item.contribution_assocs],
         class_='nav nav-pills nav-stacked')
Ejemplo n.º 13
0
 def format(self, item):
     obj = self.get_obj(item)
     if obj:
         return HTML.div(link(self.dt.req, obj),
                         style="background-color: #%s;" % obj.color,
                         class_='dt-full-cell')
     return ''  # pragma: no cover
Ejemplo n.º 14
0
def format_iso_retirement(req, lang):
    ir = lang.jsondata['iso_retirement']
    _md, comment = [], ''
    if ir['comment']:
        comment = HTML.div(
            HTML.p(HTML.strong("Excerpt from change request document:")),
            HTML.blockquote(md(req, ir['comment'], small=True)))

    if ir['change_request']:
        _md.append(('Change request:',
                    link(req,
                         Refprovider.get('iso6393:{0}'.format(
                             ir['change_request'])).ref,
                         label=ir['change_request'])))
    _md.append(('ISO 639-3:', ir['code']))
    _md.append(('Name:', ir['name']))
    if ir['reason']:
        _md.append(('Reason:', ir['reason']))
    _md.append(('Effective:', ir['effective']))

    return infobox(
        HTML.p(HTML.strong("Retired in ISO 639-3: "),
               linkify_iso_codes(req, ir['remedy'], class_='iso639-3')),
        HTML.ul(
            *[
                HTML.li(HTML.strong(dt), Markup(' '), dd)
                for dt, dd in _md
            ], **{'class': 'inline'}), comment)
Ejemplo n.º 15
0
def toc(soup):
    def link(id_, label):
        return HTML.a(label, href='#{0}'.format(id_))

    def toplink(html):
        a = html.new_tag(
            'a',
            href='#top',
            title='go to top of the page',
            style="vertical-align: bottom")
        a.string = '⇫'
        return a

    def permalink(html, id_):
        a = html.new_tag(
            'a',
            **{
                'href': '#{0}'.format(id_),
                'title': 'Permalink to this headline',
                'class': "headerlink"})
        a.string = '¶'
        return a

    toc_, count = [], 0
    for d in soup.descendants:
        if d.name in ['h1', 'h2', 'h3', 'h4', 'h5']:
            count += 1
            id_ = 'section{0}'.format(count)
            toc_.append((id_, int(d.name[1:]), d.get_text()))
            d.insert(0, soup.new_tag('a', id=id_))
            d.append(toplink(soup))
            d.append(permalink(soup, id_))

    if toc_:
        top_level = min(t[1] for t in toc_)
        nt = OrderedDict()
        curr = []
        for id_, level, label in toc_:
            if level == top_level:
                curr = nt[(id_, label)] = []
            elif level == top_level + 1:
                curr.append((id_, label))
        toc_ = HTML.ul(*[HTML.li(link(*t), HTML.ul(*[HTML.li(link(*tt)) for tt in ns]))
                         for t, ns in nt.items()])
    else:
        toc_ = ''
    return '{0}'.format(soup), toc_
Ejemplo n.º 16
0
def rendered_sentence_concepts(sentence, req, concept=None):
    units = []
    for i, (_, c) in enumerate(sentence.iter_form_and_concept()):
        units.extend([
            '\u00a0' if i != 0 else '',
            link(req, c, label=c.french_gloss) if concept != c else c.french_gloss,
        ])
    return HTML.span(*units)
Ejemplo n.º 17
0
def languoid_link(req, languoid, active=True, classification=False):
    content = [link(req, languoid) if active else languoid.name]
    if classification:
        if languoid.fc or languoid.sc:
            content.append(
                icon("icon-info-sign",
                     title="classification comment available"))
    return HTML.span(*content, **dict(class_="level-" + languoid.level.value))
Ejemplo n.º 18
0
def format_justifications(req, refs):
    r = []
    for ref in refs:
        label = ref.source.name
        if ref.description:
            label += '[%s]' % ref.description
        r.append(HTML.li(link(req, ref.source, label=label)))
    return HTML.ul(*r)
Ejemplo n.º 19
0
 def format(self, item):
     coll = item.source_word_assocs if self.dt.type == 'donor' \
         else item.target_word_assocs
     attr = 'source_word' if self.dt.type == 'donor' else 'target_word'
     return ', '.join([
         link(self.dt.req, getattr(l, attr)) for l in coll
         if getattr(l, attr).language == self.dt.language
     ])
Ejemplo n.º 20
0
 def format(self, item):
     obj = self.get_obj(item)
     my_link = []
     for i in obj:
         my_link.append(
             link(self.dt.req, i.cognateset,
                  **self.get_attrs(i.cognateset)))
     return my_link
Ejemplo n.º 21
0
def languoid_link(req, languoid, active=True, classification=False):
    link_attrs = {}
    content = [link(req, languoid, **link_attrs) if active else languoid.name]
    if classification:
        if languoid.fc or languoid.sc:
            content.append(
                icon("icon-info-sign", title="classification comment available"))
    return HTML.span(*content, **dict(class_="level-" + languoid.level.value))
Ejemplo n.º 22
0
def segment_link(req, glyph, segments, ns=False):
    if glyph not in segments:
        if ns:
            return ""
        return HTML.a(glyph, name="glyph-" + glyph, style="font-size: 1em; color: lightgray;")
    res = link(req, segments[glyph])
    del segments[glyph]
    return res
Ejemplo n.º 23
0
 def format(self, item):
     doculect = self.get_obj(item)
     if doculect:
         title = '{}'.format(doculect.name)  #,
         # doculect.family, doculect.subfamily)
         return link(self.dt.req, doculect, **{'title': title})
     else:
         return ''
Ejemplo n.º 24
0
 def format(self, item):
     obj = self.get_obj(item)
     if obj:
         return HTML.div(
             link(self.dt.req, obj),
             style="background-color: #%s;" % obj.color,
             class_='dt-full-cell')
     return ''  # pragma: no cover
Ejemplo n.º 25
0
 def format(self, item):
     if not item.wals_id:
         return ''
     return link(
         self.dt.req,
         item,
         href=self.dt.req.route_url('wals', id=item.id),
         label="WALS %sA" % item.wals_id)
Ejemplo n.º 26
0
 def format(self, item):
     item = self.get_obj(item)
     if item.family:
         label = link(self.dt.req,
                      item.family) if self._link else item.family.name
     else:
         label = 'isolate'
     return HTML.div(map_marker_img(self.dt.req, item), ' ', label)
Ejemplo n.º 27
0
def segment_link(req, glyph, segments, ns=False):
    if glyph not in segments:
        if ns:
            return ''
        return HTML.a(
            glyph, name="glyph-" + glyph, style='font-size: 1em; color: lightgray;')
    res = link(req, segments[glyph])
    del segments[glyph]
    return res
Ejemplo n.º 28
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(HTML.span(
             link(self.dt.req, c.valueset.parameter),
             ' ',
             concepticon_link(self.dt.req, c.valueset.parameter)
         )) for c in item.counterparts],
         class_='unstyled'
     )
Ejemplo n.º 29
0
def desc(req, d, sources=None):
    if sources is None:
        sources = {k: Source.get(k) for k in "moisikesling2011 hayes2009 moran2012a moranetal2012".split()}
    if not d:
        return d
    for k, v in sources.items():
        a = link(req, v)
        d = re.sub("\*\*(?P<id>%s)\*\*" % k, text_type(a), d)
    return d
Ejemplo n.º 30
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(HTML.span(
             link(self.dt.req, c.valueset.parameter),
             ' ',
             concepticon_link(self.dt.req, c.valueset.parameter)
         )) for c in item.counterparts],
         class_='unstyled'
     )
Ejemplo n.º 31
0
 def format(self, item):
     links = []
     for it in self.get_obj(item):
         try:
             links.append(
                 link(self.dt.req, it, **self.get_attrs(it)))
         except AssertionError:
             links.append(it)
     return '; '.join(links)
Ejemplo n.º 32
0
 def format(self, item):
     return HTML.ul(*[
         HTML.li(link(self.dt.req, c.contribution),
                 style="background-color: #%s;" %
                 c.contribution.color,
                 class_='dt-full-cell')
         for c in item.contribution_assocs
     ],
                    class_='nav nav-pills nav-stacked')
Ejemplo n.º 33
0
def desc(req, d, sources=None):
    if sources is None:
        sources = {k: Source.get(k) for k in
                   'moisikesling2011 hayes2009 moran2012a moranetal2012'.split()}
    if not d:
        return d
    for k, v in sources.items():
        a = link(req, v)
        d = re.sub('\*\*(?P<id>%s)\*\*' % k, text_type(a), d)
    return d
Ejemplo n.º 34
0
def amsd_linked_references(req, obj):
    chunks = []
    for ref in sorted(getattr(obj, 'references', []),
                      key=lambda x: x.source.note or ''):
        if ref.source:
            chunks.append(
                HTML.li(HTML.span(link(req, ref.source), class_='citation')))
    if chunks:
        return HTML.span(*chunks)
    return ''  # pragma: no cover
Ejemplo n.º 35
0
def desc(req, d, sources=None):
    if sources is None:
        sources = {k: Source.get(k) for k in
                   'MoisikEsling2011 Hayes2009 Moran2012a Moran_etal2012'.split()}
    if not d:
        return d
    for k, v in sources.items():
        a = link(req, v)
        d = re.sub(r'\*\*(?P<id>%s)\*\*' % k, str(a), d)
    return d
Ejemplo n.º 36
0
 def format(self, item):
     links = set()
     for rel in item.counterparts:
         for source in rel.sources:
             try:
                 links.add(
                     link(self.dt.req, source, **self.get_attrs(source)))
             except AssertionError:
                 links.add(str(source))
     return '; '.join(links)
Ejemplo n.º 37
0
def markdown_handle_links(req, m):
    for lnk in re.findall(r'(\[(.+?)\]\(.+?\))', m):
        # create links to parameters/...
        if 'wiki/Meaning:-' in lnk[0]:
            m = m.replace(lnk[0],
                          link(req, lnk[1], rsc='parameter', label=lnk[1]))
        # delete links
        else:
            m = m.replace(lnk[0], lnk[1])
    return markdown(m.replace('\\n', '\n'))
Ejemplo n.º 38
0
 def format(self, item):
     obj = self.get_obj(item).unitvalues
     my_link = []
     found_functions = []
     for i in obj:
         if i.unitparameter not in found_functions:
             my_link.append(
                 link(self.dt.req, i.unitparameter,
                      **self.get_attrs(i.unitparameter)))
         found_functions.append(i.unitparameter)
     return my_link
Ejemplo n.º 39
0
def cobl_linked_references(req, obj, comments=False):
    chunks = []
    if comments:
        for i, ref in enumerate(
                sorted(getattr(obj, 'references', []),
                       key=lambda x: x.source.name or '')):
            if ref.source:
                r = ''
                r += HTML.span(link(req, ref.source), class_='citation')
                d = None
                if ref.description:
                    d = ref.description.split('{')
                    if len(d) == 1:
                        r += HTML.span(": {}".format(d[0] if d[0] else ''),
                                       class_='pages')
                    else:
                        r += HTML.span(": {}".format(d[0] if d[0] else ''),
                                       class_='pages')
                        if d[1]:
                            r += HTML.blockquote(d[1][:-1])
                chunks.append(HTML.li(r))
        if chunks:
            return HTML.span(*chunks)
    else:
        for i, ref in enumerate(
                sorted(getattr(obj, 'references', []),
                       key=lambda x: x.source.name or '')):
            if ref.source:
                if i > 0:
                    chunks.append('; ')
                d = ref.description.split('{')[0] if ref.description else None
                chunks.append(
                    HTML.span(
                        link(req, ref.source),
                        HTML.span(': {}'.format(d) if d else '',
                                  class_='pages'),
                        class_='citation',
                    ))
        if chunks:
            return HTML.span(*chunks)
    return ''
Ejemplo n.º 40
0
def languoid_link(req, languoid, active=True, classification=False):
    link_attrs = {}
    if languoid.status and languoid.status.value:
        link_attrs['class'] = 'Language ' + languoid.status.value
    if languoid.status and languoid.status != LanguoidStatus.established:
        link_attrs['title'] = '%s - %s' % (languoid.name, languoid.status.description)
    content = [link(req, languoid, **link_attrs) if active else languoid.name]
    if classification:
        if languoid.fc or languoid.sc:
            content.append(
                icon("icon-info-sign", title="classification comment available"))
    return HTML.span(*content, **dict(class_="level-" + languoid.level.value))
Ejemplo n.º 41
0
def format_justifications(req, refs):
    seen = {}
    r = []
    for ref in refs:
        key = (ref.source.pk, ref.description)
        if key in seen:
            continue
        seen[key] = 1
        label = ref.source.name
        if ref.description:
            label += '[%s]' % ref.description
        r.append(HTML.li(link(req, ref.source, label=label)))
    return HTML.ul(*r)
Ejemplo n.º 42
0
    def test_link(self):
        from clld.web.util.helpers import link

        link(self.env['request'], common.Language(id='id', name='Name'))
        link(self.env['request'], common.Value.first(), class_='right')

        with self.utility(Mock(return_value={}), ILinkAttrs):
            link(self.env['request'], common.Value.first())
Ejemplo n.º 43
0
    def test_link(self):
        from clld.web.util.helpers import link

        link(self.env['request'], common.Language(id='id', name='Name'))
        link(self.env['request'], common.Value.first())

        with self.utility(Mock(return_value={}), ILinkAttrs):
            link(self.env['request'], common.Value.first())
Ejemplo n.º 44
0
    def test_link(self):
        from clld.web.util.helpers import link

        link(self.env["request"], common.Language(id="id", name="Name"))
        link(self.env["request"], common.Value.first(), class_="right")

        with self.utility(Mock(return_value={}), ILinkAttrs):
            link(self.env["request"], common.Value.first())
Ejemplo n.º 45
0
def markup_feature_desc(req, desc):
    for pattern, repl in [
        ('WALS feature number:\s*(?P<id>[0-9]+)\s*\[http://wals\.info\]',
         lambda match: external_link(
            'http://wals.info/feature/%sA' % match.group('id'),
            label='WALS feature number %sA' % match.group('id'))),
        ('Constenla feature number:\s*(?P<id>[a-z0-9]+)\s*\[[^\]]+\]',
         lambda match: link(
            req,
            Source.get('hvtypconstenlaintermedia'),
            label='Constenla feature number: ' + match.group('id')))]:
        desc = re.sub(pattern, repl, desc)

    return desc
Ejemplo n.º 46
0
Archivo: util.py Proyecto: clld/wold2
def get_meaning_properties(req, ctx):
    for attr, info, converter in [
        ('description', None, lambda s: s),
        ('typical_context', None, lambda s: s),
        ('semantic_field', None, lambda sf: link(req, sf)),
        ('semantic_category', None, lambda s: s),
        ('borrowed_score', hb_borrowed_score(), lambda f: '{0:.2f}'.format(f)),
        ('age_score', hb_age_score(), lambda f: '{0:.2f}'.format(f) if f else ''),
        ('simplicity_score', hb_simplicity_score(), lambda f: '{0:.2f}'.format(f)),
    ]:
        label = attr.capitalize().replace('_', ' ')
        if info:
            label = HTML.span(
                label, literal('&nbsp;'), infobutton(info, content_type='html'))
        yield (label, converter(getattr(ctx, attr)))
Ejemplo n.º 47
0
def format_comment(req, comment):
    """
    We collect source ids found in comment, retrieve the corresponding source objects from
    the database in a single query and then replace the ids with formatted source links.
    """
    parts = []
    sources = {}
    pos = 0
    comment = comment.replace('~', ' ')
    for match in Reference.pattern.finditer(comment):
        preceding = comment[pos:match.start()]
        parts.append(preceding)
        parts.append(match.group('key'))
        sources[match.group('key')] = None
        if match.group('pages'):
            parts.append(': {0}'.format(match.group('pages')))
        pos = match.end()
    parts.append(comment[pos:])

    for rp in DBSession.query(Refprovider).filter(Refprovider.id.in_(sources.keys())):
        sources[rp.id] = rp.ref

    return ' '.join(
        link(req, sources[p]) if sources.get(p) else p for p in parts).replace(' : ', ': ')
Ejemplo n.º 48
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(link(self.dt.req, l.contribution, label=l.id)) for l in item.languages],
         **dict(class_='inline'))
Ejemplo n.º 49
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(link(
             self.dt.req, c.survey)) for c in item.survey_assocs])
Ejemplo n.º 50
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(link(self.dt.req, c)) for c in item.countries], class_='unstyled')
Ejemplo n.º 51
0
 def format(self, item):
     return HTML.ul(*[HTML.li(link(self.dt.req, ref.source), ': ', ref.description) for ref in item.references], class_='unstyled')
Ejemplo n.º 52
0
 def format(self, item):
     return link(
         self.dt.req, item,
         label='Chapter {0} by {1}'.format(item.id, item.formatted_contributors()),
         url_kw=dict(ext='chapter.html'))
Ejemplo n.º 53
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(link(self.dt.req, ca.contributor))
           for ca in item.contributor_assocs if ca.ord == self.roleid])
Ejemplo n.º 54
0
 def format(self, item):
     return HTML.div(
         link(self.dt.req, item.dictionary),
         #' by ',
         #linked_contributors(self.dt.req, item.valueset.contribution)
     )
Ejemplo n.º 55
0
Archivo: base.py Proyecto: FieldDB/clld
 def format(self, item):
     obj = self.get_obj(item)
     return link(self.dt.req, obj, **self.get_attrs(item)) if obj else ''
Ejemplo n.º 56
0
 def format(self, item):
     return HTML.ul(
         *[HTML.li(link(
             self.dt.req, c.contribution)) for c in item.contribution_assocs])