示例#1
0
文件: js_cdata.py 项目: AvdN/tdi
#!/usr/bin/env python
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')

from tdi.tools import javascript

x = javascript.cdata(u"""<!-- script1
//-->""")
print repr(x)

x = javascript.cdata("""<!-- script1
//-->""")
print repr(x)

x = javascript.cdata("""<!-- script1 - \xc3\xa9
//-->""", encoding='utf-8')
print repr(x)

x = javascript.cdata(u"""<![CDATA[
    script2
]]>""")
print repr(x)

x = javascript.cdata("""<![CDATA[
    script2
]]>""")
print repr(x)

x = javascript.cdata("""<![CDATA[
    script2 - \xc3\xa9
示例#2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import warnings as _warnings
_warnings.resetwarnings()
_warnings.filterwarnings('error')

# BEGIN INCLUDE
from tdi.tools import javascript

print javascript.cdata("""
//<![CDATA[
    the script.
//]]>
""".strip())