Compare commits
No commits in common. "9096a1b0d5a2e73e5cd5f86fb40a8ac2cd7c4508" and "89f02dc72d83d6b6874d3bb5b646384b54211a42" have entirely different histories.
9096a1b0d5
...
89f02dc72d
@ -4,7 +4,8 @@ import string
|
||||
|
||||
from lxml import etree
|
||||
|
||||
FRAGMENT_TAG = "+?"
|
||||
FRAGMENT_PREFIX = "in"
|
||||
FRAGMENT_TAG = ";%s" % FRAGMENT_PREFIX
|
||||
FRAGMENT_CLASS = "fragment"
|
||||
|
||||
# Search and delete the FRAGMENT_TAG anywhere in the given HTML
|
||||
@ -22,7 +23,7 @@ def defragmentize(html):
|
||||
class_list += " %s" % FRAGMENT_CLASS
|
||||
|
||||
fragment.set('class', class_list)
|
||||
fragment.text = re.sub(r"\s*%s\s*" % re.escape(FRAGMENT_TAG), '', fragment.text).strip()
|
||||
fragment.text = re.sub(r"\s*;%s\s*" % FRAGMENT_PREFIX, '', fragment.text).strip()
|
||||
|
||||
return etree.tostring(dom, method='html', encoding='utf-8',
|
||||
pretty_print=True).decode('utf-8')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user