comparison src/plugins/plugin_xep_0277.py @ 1812:160b0d4c6520

plugin XEP-0071, XEP-0277: method clean_xhtml has been renamed to cleanXHTML
author souliane <souliane@mailoo.org>
date Tue, 19 Jan 2016 11:51:07 +0100
parents fed95a6c56f8
children 602a47ccc07c
comparison
equal deleted inserted replaced
1811:90ae9a2462c2 1812:160b0d4c6520
175 raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a <div/> element, this is not standard !")) 175 raise failure.Failure(exceptions.DataError(u"XHML content not wrapped in a <div/> element, this is not standard !"))
176 if data_elt.uri != NS_XHTML: 176 if data_elt.uri != NS_XHTML:
177 raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!'))) 177 raise failure.Failure(exceptions.DataError(_('Content of type XHTML must declare its namespace!')))
178 key = check_conflict(u'{}_xhtml'.format(elem.name)) 178 key = check_conflict(u'{}_xhtml'.format(elem.name))
179 data = data_elt.toXml() 179 data = data_elt.toXml()
180 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].clean_xhtml(data) 180 microblog_data[key] = yield self.host.plugins["TEXT-SYNTAXES"].cleanXHTML(data)
181 else: 181 else:
182 key = check_conflict(elem.name) 182 key = check_conflict(elem.name)
183 microblog_data[key] = unicode(elem) 183 microblog_data[key] = unicode(elem)
184 184
185 185
363 if type_ == '_rich': # convert input from current syntax to XHTML 363 if type_ == '_rich': # convert input from current syntax to XHTML
364 converted = yield synt.convert(data[attr], synt.getCurrentSyntax(profile), "XHTML") 364 converted = yield synt.convert(data[attr], synt.getCurrentSyntax(profile), "XHTML")
365 if '{}_xhtml'.format(elem_name) in data: 365 if '{}_xhtml'.format(elem_name) in data:
366 raise failure.Failure(exceptions.DataError(_("Can't have xhtml and rich content at the same time"))) 366 raise failure.Failure(exceptions.DataError(_("Can't have xhtml and rich content at the same time")))
367 else: # clean the XHTML input 367 else: # clean the XHTML input
368 converted = yield synt.clean_xhtml(data[attr]) 368 converted = yield synt.cleanXHTML(data[attr])
369 369
370 xml_content = u'<div xmlns="{ns}">{converted}</div>'.format( 370 xml_content = u'<div xmlns="{ns}">{converted}</div>'.format(
371 ns=NS_XHTML, 371 ns=NS_XHTML,
372 converted=converted) 372 converted=converted)
373 div_elt = xml_tools.ElementParser()(xml_content) 373 div_elt = xml_tools.ElementParser()(xml_content)