Compare commits

..

No commits in common. "89f02dc72d83d6b6874d3bb5b646384b54211a42" and "c36f83c205213278124a28840b64ae09d4b033e2" have entirely different histories.

View File

@ -5,7 +5,7 @@ import string
from lxml import etree from lxml import etree
FRAGMENT_PREFIX = "in" FRAGMENT_PREFIX = "in"
FRAGMENT_TAG = ";%s" % FRAGMENT_PREFIX FRAGMENT_TAG = "^%s" % FRAGMENT_PREFIX
FRAGMENT_CLASS = "fragment" FRAGMENT_CLASS = "fragment"
# Search and delete the FRAGMENT_TAG anywhere in the given HTML # Search and delete the FRAGMENT_TAG anywhere in the given HTML
@ -23,7 +23,7 @@ def defragmentize(html):
class_list += " %s" % FRAGMENT_CLASS class_list += " %s" % FRAGMENT_CLASS
fragment.set('class', class_list) fragment.set('class', class_list)
fragment.text = re.sub(r"\s*;%s\s*" % FRAGMENT_PREFIX, '', fragment.text).strip() fragment.text = re.sub(r"\W*\^%s\W*" % FRAGMENT_PREFIX, '', fragment.text).strip()
return etree.tostring(dom, method='html', encoding='utf-8', return etree.tostring(dom, method='html', encoding='utf-8',
pretty_print=True).decode('utf-8') pretty_print=True).decode('utf-8')