def test_simple_link(self): """ Create a link """ textdoc = OpenDocumentText() para = text.P() anchor = text.A(href="http://www.com/", type="simple", text="A link label") para.addElement(anchor) textdoc.text.addElement(para)
def owriteCategoryLink(self, obj): if True: # FIXME, collect and add to the end of the page return SkipChildren() if not obj.colon and not obj.children: a = text.A(href=obj.target) a.addText(obj.target) return a
def test_link(self): """ Create a link """ textdoc = OpenDocumentText() para = text.P() anchor = text.A(href="http://www.com/", text="A link label") para.addElement(anchor) textdoc.text.addElement(para) self.assertEqual(1, 1)
def owriteNamedURL(self, obj): # FIXME handle references a = text.A(href=obj.caption) if not obj.children: name = "[%s]" % self.namedLinkCount self.namedLinkCount += 1 a.addText(name) return a
def s_html_a(self, tag, attrs): href = None href = listget(attrs, 'href', None) if href: if href in ("", "#"): href == self.baseurl elif href.find("://") >= 0: pass elif href[0] == '/': href = self.basehost + href e = text.A(type="simple", href=href) else: e = text.A() # if self.curr.parentNode.qname != text.P().qname: # p = text.P() # self.curr.addElement(p) # self.curr = p self.curr.addElement(e) self.curr = e
def owriteSpecialLink(self, obj): # whats that? a = text.A(href=obj.target) if not obj.children: a.addText(obj.target) return a
def owriteURL(self, obj): a = text.A(href=obj.caption) if not obj.children: a.addText(obj.caption) return a
def owriteLink(self, obj): a = text.A(href= obj.url or "#") if not obj.children: a.addText(obj.target) return a