src/cm/views/texts.py
changeset 457 f62f7f0bcaa4
parent 455 33c7e20efcb7
child 480 b9b802261109
equal deleted inserted replaced
456:b2a7c015362b 457:f62f7f0bcaa4
   300 def from_html_links_to_inline_imgs(content, inline=True, full_path=True):
   300 def from_html_links_to_inline_imgs(content, inline=True, full_path=True):
   301   """
   301   """
   302   Replaces (html) links to attachs with embeded inline images
   302   Replaces (html) links to attachs with embeded inline images
   303   """
   303   """
   304   content = re.sub("%s" %settings.SITE_URL, '', content) # changes absolute urls to relative urls
   304   content = re.sub("%s" %settings.SITE_URL, '', content) # changes absolute urls to relative urls
   305   attach_re = r'(?:/text/(?P<key>\w*))?/attach/(?P<attach_key>\w*)/'
   305   attach_re = r'"(?:/text/(?P<key>\w*))?/attach/(?P<attach_key>\w*)/'
   306   attach_str_textversion = r'/text/%s/attach/%s/'
   306   attach_str_textversion = r'/text/%s/attach/%s/'
   307   attach_str = r'/attach/%s/'
   307   attach_str = r'/attach/%s/'
   308   for match in re.findall(attach_re, content):
   308   for match in re.findall(attach_re, content):
   309     if match[0]:
   309     if match[0]:
   310       link = attach_str_textversion %match
   310       link = attach_str_textversion %match