Exemple #1
0
 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)
Exemple #2
0
 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
Exemple #3
0
 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)
Exemple #4
0
 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
Exemple #5
0
    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
Exemple #6
0
 def owriteSpecialLink(self, obj): # whats that?
     a = text.A(href=obj.target)
     if not obj.children:
         a.addText(obj.target)
     return a
Exemple #7
0
 def owriteURL(self, obj):
     a = text.A(href=obj.caption)
     if not obj.children:
         a.addText(obj.caption)
     return a
Exemple #8
0
 def owriteLink(self, obj): 
     a = text.A(href= obj.url or "#")
     if not obj.children:
         a.addText(obj.target)
     return a