Skip to content
This repository has been archived by the owner on Feb 26, 2022. It is now read-only.

Commit

Permalink
Bug 802197 - Search is broken when using the online version of the do…
Browse files Browse the repository at this point in the history
…cs - on master
  • Loading branch information
Will Bamberg committed Oct 16, 2012
1 parent 29efb95 commit c81cda5
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions python-lib/cuddlefish/docs/linkrewriter.py
Expand Up @@ -45,18 +45,18 @@ def handle_endtag(self, tag):
def handle_startendtag(self, tag, attrs):
self.stack.append(self.__html_startend_tag(tag, self._rewrite_link(attrs)))

def _update_attribute(self, attr_name, attrs):
attr_value = attrs.get(attr_name, '')
if attr_value:
parsed = urlparse.urlparse(attr_value)
if not parsed.scheme:
attrs[attr_name] = self.link_prefix + attr_value

def _rewrite_link(self, attrs):
attrs = dict(attrs)
href = attrs.get('href', '')
if href:
parsed = urlparse.urlparse(href)
if not parsed.scheme:
attrs['href'] = self.link_prefix + href
src = attrs.get('src', '')
if src:
parsed = urlparse.urlparse(src)
if not parsed.scheme:
attrs['src'] = self.link_prefix + src
self._update_attribute('href', attrs)
self._update_attribute('src', attrs)
self._update_attribute('action', attrs)
return attrs

def handle_data(self, data):
Expand Down

0 comments on commit c81cda5

Please sign in to comment.