Beispiel #1
0
 def parse_link(matchobj):
     link = LinkPattern(MAGICLINKS_RE, self.markdown)
     href = link.sanitize_url(link.unescape(matchobj.group(0).strip()))
     if href:
         href = self.escape(href)
         return self.markdown.htmlStash.store('<a href="%(href)s">%(href)s</a>' % {'href': href}, safe=True)
     else:
         return matchobj.group(0)
Beispiel #2
0
 def parse_link(matchobj):
     link = LinkPattern(MAGICLINKS_RE, self.markdown)
     href = link.sanitize_url(link.unescape(matchobj.group(0).strip()))
     if href:
         if is_inner(href):
             clean = clean_inner(href)
             return self.markdown.htmlStash.store('<a href="%s">%s</a>' % (clean, clean[1:]), safe=True)
         else:
             return self.markdown.htmlStash.store('<a href="%(href)s" rel="nofollow">%(href)s</a>' % {'href': href}, safe=True)
     else:
         return matchobj.group(0)
Beispiel #3
0
 def parse_link(matchobj):
     link = LinkPattern(MAGICLINKS_RE, self.markdown)
     href = link.sanitize_url(link.unescape(matchobj.group(0).strip()))
     if href:
         if is_inner(href):
             clean = clean_inner(href)
             return self.markdown.htmlStash.store(
                 '<a href="%s">%s</a>' % (clean, clean[1:]), safe=True)
         else:
             return self.markdown.htmlStash.store(
                 '<a href="%(href)s" rel="nofollow">%(href)s</a>' %
                 {'href': href},
                 safe=True)
     else:
         return matchobj.group(0)
Beispiel #4
0
        def parse_link(matchobj):
            matched_link = matchobj.group(0).strip()
            if matched_link[0] == '<':
                matched_link = matched_link[1:]
            if matched_link[-1] == '>':
                matched_link = matched_link[:-1]

            link = LinkPattern(MAGICLINKS_RE, self.markdown)
            href = link.sanitize_url(link.unescape(matched_link))
            if href:
                if is_inner(href):
                    clean = clean_inner(href)
                    return self.markdown.htmlStash.store('<a href="%s">%s</a>' % (clean, clean[1:]), safe=True)
                else:
                    clean = clean_outer(href)
                    return self.markdown.htmlStash.store('<a href="%s" rel="nofollow">%s</a>' % (clean, href), safe=True)
            else:
                return matchobj.group(0)