# Path: oembed/constants.py
# URL_RE = re.compile(URL_PATTERN)
# 
# STANDALONE_URL_RE = re.compile('^\s*' + URL_PATTERN + '\s*$')


import re
import oembed
from django.utils.safestring import mark_safe
from oembed.constants import URL_RE, STANDALONE_URL_RE
from oembed.exceptions import OEmbedException
from oembed.parsers.base import BaseParser
            # based on the difference between replacement/original
            for j in xrange(indx + 1, len(matches)):
                matches[j][0] += difference
                matches[j][1] += difference
        return mark_safe(text)
    
    def extract_urls(self, text):
        urls = set()
        url_list = []
        for url in re.findall(URL_RE, text):
            if url not in urls:
                urls.add(url)
                url_list.append(url)
        
        return url_list


class TextParser(TextBlockParser):
    def parse_data(self, text, maxwidth, maxheight, template_dir, context, 
                   urlize_all_links):
        """
        Parses a block of text rendering links that occur on their own line
        normally but rendering inline links using a special template dir
        """
        block_parser = TextBlockParser()
        
        lines = text.splitlines()
        parsed = []
        
        for line in lines:

# Path: oembed/constants.py
# URL_RE = re.compile(URL_PATTERN)
# 
# STANDALONE_URL_RE = re.compile('^\s*' + URL_PATTERN + '\s*$')


# Path: oembed/parsers/text.py
import re
import oembed
from django.utils.safestring import mark_safe
from oembed.constants import URL_RE, STANDALONE_URL_RE
from oembed.exceptions import OEmbedException
from oembed.parsers.base import BaseParser

            # based on the difference between replacement/original
            for j in xrange(indx + 1, len(matches)):
                matches[j][0] += difference
                matches[j][1] += difference
        return mark_safe(text)
    
    def extract_urls(self, text):
        urls = set()
        url_list = []
        for url in re.findall(URL_RE, text):
            if url not in urls:
                urls.add(url)
                url_list.append(url)
        
        return url_list


class TextParser(TextBlockParser):
    def parse_data(self, text, maxwidth, maxheight, template_dir, context, 
                   urlize_all_links):
        """
        Parses a block of text rendering links that occur on their own line
        normally but rendering inline links using a special template dir
        """
        block_parser = TextBlockParser()
        
        lines = text.splitlines()
        parsed = []
        
        for line in lines:

            if STANDALONE_URL_RE.match(line):