Skip to content

Instantly share code, notes, and snippets.

@paultreny
Created April 4, 2013 15:20
Show Gist options
  • Save paultreny/5311310 to your computer and use it in GitHub Desktop.
Save paultreny/5311310 to your computer and use it in GitHub Desktop.
comment these lines to enable closing <style> and <script> tags
# script
unparseable = content.split('<script')
content = unparseable.pop(0)
l = len(unparseable)
i = 0
while i < l:
tmp = unparseable[i].split('</script>')
content += '.......'
content += len(tmp.pop(0))*'.'
content += '.........'
content += ".........".join(tmp)
i += 1
# style
unparseable = content.split('<style')
content = unparseable.pop(0)
l = len(unparseable)
i = 0
while i < l:
tmp = unparseable[i].split('</style>')
content += '......'
content += len(tmp.pop(0))*'.'
content += '........'
content += "........".join(tmp)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment