Exemple #1
0
                text += '<a href="%s" class="image"><img src="%s" width="%s" height="%s"></a>' % (
                    desc_url, url, width, height)
                text += '</div></div></div><div class="gallerytext"><p>'
                if len(res) > 1 and res[1] == 'thumb':
                    # need to test length because of cases like https://en.wikipedia.org/wiki/Talk:Federal_Assault_Weapons_Ban/Archive_2#RfC:_Is_inclusion_of_the_word_.22cosmetic.22_in_the_Criteria_section_appropriate.3F
                    inner_text = '|'.join(res[2:]).strip()
                else:
                    inner_text = '|'.join(res[1:]).strip()
                text += parser.parse(inner_text)
                text += '</p></div></li>'
                start_text += text
    start_text += '</ul>'
    return start_text


parser.registerTagHook('gallery', galleryTagHook)


def slinkHook(parser_env, namespace, body):
    print(body)
    vals = body.split('|')
    href = vals[1].strip()
    text = href[1:]
    return '<a href="%s">&#167; %s</a>' % (vals[1], text)


def linkHook(parser_env, namespace, body):
    (article, pipe, text) = body.partition('|')
    href = article.strip().capitalize().replace(' ', '_')
    text = (text or article).strip()
    if not text.startswith('comment_'):