def visit_img(self, element): """ <img src="URI" /> --> <object xlink:href="URI /> """ key = xlink('href') attrib = {} attrib[key] = element.attrib.get("src") return moin_page.object(attrib)
def visit_a(self, element): key = xlink('href') attrib = {} href = postproc_text(self.markdown, element.attrib.get("href")) if allowed_uri_scheme(href): attrib[key] = href else: return href return self.new_copy(moin_page.a, element, attrib)
def visit_xhtml_img(self, element): """ <img src="URI" /> --> <object xlink:href="URI /> """ key = xlink('href') attrib = {} if self.base_url: attrib[key] = ''.join([self.base_url, element.get(html.src)]) else: attrib[key] = element.get(html.src) return moin_page.object(attrib)
def visit_xhtml_a(self, element): """ <a href="URI">Text</a> --> <a xlink:href="URI">Text</a> """ key = xlink('href') attrib = {} if self.base_url: attrib[key] = ''.join([self.base_url, element.get(html.href)]) else: attrib[key] = element.get(html.href) return self.new_copy(moin_page.a, element, attrib)
def visit_xhtml_img(self, element): """ <img src="URI" /> --> <object xlink:href="URI /> """ key = xlink('href') attrib = self.convert_attributes(element) # adding type_ attrib makes html_out create an image tag rather than an object tag attrib[moin_page.type_] = 'image/' if self.base_url: attrib[key] = ''.join([self.base_url, element.get(html.src)]) else: attrib[key] = element.get(html.src) return moin_page.object(attrib)
def visit_xhtml_object(self, element): """ <object data="href"></object> --> <object xlink="href" /> """ key = xlink('href') attrib = {} if self.base_url: attrib[key] = ''.join([self.base_url, element.get(html.data)]) else: attrib[key] = element.get(html.data) # Convert the href attribute into unicode attrib[key] = unicode(attrib[key]) return moin_page.object(attrib)
def visit_object(self, element): """ <object data="href"></object> --> <object xlink="href" /> """ key = xlink('href') attrib = {} if self.base_url: attrib[key] = ''.join([self.base_url, element.get(html.data)]) else: attrib[key] = element.get(html.data) # Convert the href attribute into unicode attrib[key] = unicode(attrib[key]) return moin_page.object(attrib)
def visit_xhtml_a(self, element): """ <a href="URI">Text</a> --> <a xlink:href="URI">Text</a> """ key = xlink('href') attrib = {} href = element.get(html.href) if self.base_url: attrib[key] = ''.join([self.base_url, href]) else: if allowed_uri_scheme(href): attrib[key] = href else: return href return self.new_copy(moin_page.a, element, attrib)
def visit_xhtml_a(self, element): """ <a href="URI">Text</a> --> <a xlink:href="URI">Text</a> """ key = xlink('href') attrib = {} href = element.get(html.href) if self.base_url: attrib[key] = ''.join([self.base_url, href]) else: if allowed_uri_scheme(href): attrib[key] = href else: # invalid uri schemes like: <p><a href="javascript:alert('hi')">Test</a></p> are converted to: <p><javascript:alert('hi')"</p> return href return self.new_copy(moin_page.a, element, attrib)