Example #1
0
 def test_stomp_target(self):
     attrs = {
         (None, u'href'): u'http://example.com',
         (None, u'target'): u'foo'
     }
     assert (target_blank(attrs) == {
         (None, u'href'): 'http://example.com',
         (None, u'target'): u'_blank'
     })
Example #2
0
 def test_empty(self):
     attrs = {}
     assert target_blank(attrs) == attrs
Example #3
0
 def test_mailto(self):
     attrs = {(None, u'href'): u'mailto:[email protected]'}
     assert target_blank(attrs) == attrs
Example #4
0
 def test_mailto(self):
     attrs = {(None, u'href'): u'mailto:[email protected]'}
     assert target_blank(attrs) == attrs
Example #5
0
 def test_stomp_target(self):
     attrs = {(None, u'href'): u'http://example.com', (None, u'target'): u'foo'}
     assert (
         target_blank(attrs) ==
         {(None, u'href'): 'http://example.com', (None, u'target'): u'_blank'}
     )
Example #6
0
def target_blank_except_footnote(attrs, new=False):
    if "class" in attrs and attrs["class"] == "footnote-backref":
        return attrs
    else:
        return callbacks.target_blank(attrs, new)
Example #7
0
 def test_empty(self):
     attrs = {}
     assert target_blank(attrs) == attrs
Example #8
0
def target_blank_except_footnote(attrs, new=False):
    if "class" in attrs and \
       attrs["class"] in ("footnote-backref", "footnote-ref"):
        return attrs
    else:
        return callbacks.target_blank(attrs, new)
Example #9
0
 def test_add_target(self):
     attrs = {(None, 'href'): 'http://example.com'}
     assert (target_blank(attrs) == {
         (None, 'href'): 'http://example.com',
         (None, 'target'): '_blank'
     })
Example #10
0
 def test_stomp_target(self):
     attrs = {(None, "href"): "http://example.com", (None, "target"): "foo"}
     assert target_blank(attrs) == {
         (None, "href"): "http://example.com",
         (None, "target"): "_blank",
     }
Example #11
0
 def test_mailto(self):
     attrs = {(None, "href"): "mailto:[email protected]"}
     assert target_blank(attrs) == attrs
Example #12
0
 def test_add_target(self):
     attrs = {(None, 'href'): 'http://example.com'}
     assert (
         target_blank(attrs) ==
         {(None, 'href'): 'http://example.com', (None, 'target'): '_blank'}
     )