comparison frontends/src/jp/cmd_blog.py @ 1881:386d61abfac2

jp (blog/preview): xhtml cleaning is now used on preview
author Goffi <goffi@goffi.org>
date Sat, 05 Mar 2016 15:43:14 +0100
parents a97db84c048d
children ed444e9aa078
comparison
equal deleted inserted replaced
1880:68944e270c40 1881:386d61abfac2
341 341
342 syntax = self.guessSyntaxFromPath(sat_conf, current_file_path) 342 syntax = self.guessSyntaxFromPath(sat_conf, current_file_path)
343 343
344 if syntax != 'XHTML': 344 if syntax != 'XHTML':
345 with open(current_file_path, 'rb') as f: 345 with open(current_file_path, 'rb') as f:
346 content_xhtml = self.host.bridge.syntaxConvert(f.read(), syntax, 'XHTML', False, self.profile) 346 # we use safe=True because we want to have a preview as close as possible to what the
347 # people will see
348 content_xhtml = self.host.bridge.syntaxConvert(f.read(), syntax, 'XHTML', True, self.profile)
347 349
348 # at this point the syntax is converted, we can display the preview 350 # at this point the syntax is converted, we can display the preview
349 351
350 with tempfile.NamedTemporaryFile(suffix='.xhtml', delete=False) as f: 352 with tempfile.NamedTemporaryFile(suffix='.xhtml', delete=False) as f:
351 # XXX: we don't delete file automatically because browser need it (and webbrowser.open can return before it is read) 353 # XXX: we don't delete file automatically because browser need it (and webbrowser.open can return before it is read)