Exemple #1
0
    def handleMatch(self, m):
        if m.group(3):
            # [A]{foo:B} -- A is the label, B is the target
            manual_label = m.group(2)
            target = m.group(3)
        else:
            # [A]{foo} -- A is the label and the target
            manual_label = None
            target = m.group(2)

        # Find the thingy and figure out its URL
        if self.thingy_type.lower() == u'pokemon':
            obj = splinext.pokedex.db.pokemon_query(target).one()
            name = obj.full_name
        else:
            obj = splinext.pokedex.db.get_by_name_query(self.thingy_table, target).one()
            name = obj.name
        url = pokedex_helpers.make_thingy_url(obj)

        # Construct a link node
        el = markdown.etree.Element('a')
        el.set('href', url)
        el.text = markdown.AtomicString(manual_label or name)
        return el
Exemple #2
0
 def object_url(self, category, obj):
     return pokedex_helpers.make_thingy_url(obj)
Exemple #3
0
 def object_url(self, category, obj):
     return pokedex_helpers.make_thingy_url(obj)