Change fragment prefix to »+?«

This commit is contained in:
Knoch 2020-02-08 16:56:21 +01:00
parent dc85729101
commit 47ffa62e83
2 changed files with 7 additions and 8 deletions

View File

@ -4,8 +4,7 @@ import string
from lxml import etree from lxml import etree
FRAGMENT_PREFIX = "in" FRAGMENT_TAG = "+?"
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 +22,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"\s*%s\s*" % re.escape(FRAGMENT_TAG), '', 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')

View File

@ -6,11 +6,11 @@ Wirklich auf den Punkt!
@slide @slide
@title @title
;in Wirklich auf den Punkt! +? Wirklich auf den Punkt!
@content @content
* ;in Stichpunkt 1 * +? Stichpunkt 1
* ;in Stichpunkt 2 * +? Stichpunkt 2
* ;in Stichpunkt 3 * +? Stichpunkt 3
* ;in Stichpunkt 4 * +? Stichpunkt 4