Skip to content
Browse files

Merge pull request #613 from wbamberg/802197-master

Fix for Bug 802197 - Search is broken when using the online version of the docs ...
  • Loading branch information...
2 parents 06a55c0 + c81cda5 commit 614f1d733da14854871879033cb8fe4eb089b7b1 @wbamberg wbamberg committed
Showing with 10 additions and 10 deletions.
  1. +10 −10 python-lib/cuddlefish/docs/linkrewriter.py
View
20 python-lib/cuddlefish/docs/linkrewriter.py
@@ -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):

0 comments on commit 614f1d7

Please sign in to comment.
Something went wrong with that request. Please try again.