parent
8af1a39d7e
commit
256119a574
3 changed files with 11 additions and 3 deletions
|
@ -166,6 +166,10 @@ use_bookmarks_method =
|
||||||
# colored text for example.
|
# colored text for example.
|
||||||
#enable_xhtml_im = true
|
#enable_xhtml_im = true
|
||||||
|
|
||||||
|
# If XHTML-IM is enabled, you may want to reject style parsing, to keep
|
||||||
|
# only semantic elements formatting.
|
||||||
|
#enable_css_parsing = true
|
||||||
|
|
||||||
# Stream Management (XEP-0198) is an extension designed to improve
|
# Stream Management (XEP-0198) is an extension designed to improve
|
||||||
# the reliability of XMPP in unreliable network conditions (such
|
# the reliability of XMPP in unreliable network conditions (such
|
||||||
# as mobile networks). It can however increase bandwidth usage.
|
# as mobile networks). It can however increase bandwidth usage.
|
||||||
|
|
|
@ -52,6 +52,7 @@ DEFAULT_CONFIG = {
|
||||||
'display_user_color_in_join_part': True,
|
'display_user_color_in_join_part': True,
|
||||||
'enable_avatars': False,
|
'enable_avatars': False,
|
||||||
'enable_carbons': True,
|
'enable_carbons': True,
|
||||||
|
'enable_css_parsing': True,
|
||||||
'enable_user_activity': True,
|
'enable_user_activity': True,
|
||||||
'enable_user_gaming': True,
|
'enable_user_gaming': True,
|
||||||
'enable_user_mood': True,
|
'enable_user_mood': True,
|
||||||
|
|
|
@ -17,13 +17,15 @@ import hashlib
|
||||||
import re
|
import re
|
||||||
from base64 import b64encode, b64decode
|
from base64 import b64encode, b64decode
|
||||||
from os import path
|
from os import path
|
||||||
from slixmpp.xmlstream import ET
|
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from xml import sax
|
from xml import sax
|
||||||
from xml.sax import saxutils
|
from xml.sax import saxutils
|
||||||
|
|
||||||
|
from slixmpp.xmlstream import ET
|
||||||
|
from poezio.config import config
|
||||||
|
|
||||||
digits = '0123456789' # never trust the modules
|
digits = '0123456789' # never trust the modules
|
||||||
|
|
||||||
XHTML_NS = 'http://www.w3.org/1999/xhtml'
|
XHTML_NS = 'http://www.w3.org/1999/xhtml'
|
||||||
|
@ -311,6 +313,7 @@ class XHTMLHandler(sax.ContentHandler):
|
||||||
|
|
||||||
self.tmp_dir = tmp_dir
|
self.tmp_dir = tmp_dir
|
||||||
self.extract_images = extract_images
|
self.extract_images = extract_images
|
||||||
|
self.enable_css_parsing = config.get('enable_css_parsing')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def result(self):
|
def result(self):
|
||||||
|
@ -336,7 +339,7 @@ class XHTMLHandler(sax.ContentHandler):
|
||||||
attrs = {name: value for ((ns, name), value) in attrs.items() if ns is None}
|
attrs = {name: value for ((ns, name), value) in attrs.items() if ns is None}
|
||||||
self.attrs.append(attrs)
|
self.attrs.append(attrs)
|
||||||
|
|
||||||
if 'style' in attrs:
|
if 'style' in attrs and self.enable_css_parsing:
|
||||||
style = _parse_css(attrs['style'])
|
style = _parse_css(attrs['style'])
|
||||||
self.append_formatting(style)
|
self.append_formatting(style)
|
||||||
|
|
||||||
|
@ -420,7 +423,7 @@ class XHTMLHandler(sax.ContentHandler):
|
||||||
builder.append('\n')
|
builder.append('\n')
|
||||||
self.is_pre = False
|
self.is_pre = False
|
||||||
|
|
||||||
if 'style' in attrs:
|
if 'style' in attrs and self.enable_css_parsing:
|
||||||
self.pop_formatting()
|
self.pop_formatting()
|
||||||
|
|
||||||
if 'title' in attrs:
|
if 'title' in attrs:
|
||||||
|
|
Loading…
Reference in a new issue