示例#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'
     })
示例#2
0
 def test_empty(self):
     attrs = {}
     assert target_blank(attrs) == attrs
示例#3
0
 def test_mailto(self):
     attrs = {(None, u'href'): u'mailto:[email protected]'}
     assert target_blank(attrs) == attrs
示例#4
0
 def test_mailto(self):
     attrs = {(None, u'href'): u'mailto:[email protected]'}
     assert target_blank(attrs) == attrs
示例#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'}
     )
示例#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)
示例#7
0
 def test_empty(self):
     attrs = {}
     assert target_blank(attrs) == attrs
示例#8
0
文件: content.py 项目: box327/Yuzuki
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)
示例#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'
     })
示例#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",
     }
示例#11
0
 def test_mailto(self):
     attrs = {(None, "href"): "mailto:[email protected]"}
     assert target_blank(attrs) == attrs
示例#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'}
     )