Merge pull request #447 from reingart/master
fixing pypdf table rendering issues due attribute sanitization
This commit is contained in:
@@ -179,6 +179,7 @@
|
|||||||
'Exception instance attributes': 'Atributos de la instancia de Excepción',
|
'Exception instance attributes': 'Atributos de la instancia de Excepción',
|
||||||
'Exit Fullscreen': 'Exit Fullscreen',
|
'Exit Fullscreen': 'Exit Fullscreen',
|
||||||
'Expand Abbreviation': 'Expand Abbreviation',
|
'Expand Abbreviation': 'Expand Abbreviation',
|
||||||
|
'Expand Abbreviation (html files only)': 'Expand Abbreviation (html files only)',
|
||||||
'export as csv file': 'exportar como archivo CSV',
|
'export as csv file': 'exportar como archivo CSV',
|
||||||
'exposes': 'expone',
|
'exposes': 'expone',
|
||||||
'exposes:': 'expone:',
|
'exposes:': 'expone:',
|
||||||
@@ -237,6 +238,7 @@
|
|||||||
'invalid ticket': 'tiquete inválido',
|
'invalid ticket': 'tiquete inválido',
|
||||||
'Key bindings': 'Key bindings',
|
'Key bindings': 'Key bindings',
|
||||||
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
'Key bindings for ZenCoding Plugin': 'Key bindings for ZenCoding Plugin',
|
||||||
|
'Keyboard shortcuts': 'Keyboard shortcuts',
|
||||||
'language file "%(filename)s" created/updated': 'archivo de lenguaje "%(filename)s" creado/actualizado',
|
'language file "%(filename)s" created/updated': 'archivo de lenguaje "%(filename)s" creado/actualizado',
|
||||||
'Language files (static strings) updated': 'Archivos de lenguaje (cadenas estáticas) actualizados',
|
'Language files (static strings) updated': 'Archivos de lenguaje (cadenas estáticas) actualizados',
|
||||||
'languages': 'lenguajes',
|
'languages': 'lenguajes',
|
||||||
|
|||||||
@@ -58,8 +58,16 @@ def pyfpdf_from_html(html):
|
|||||||
pass
|
pass
|
||||||
pdf = MyFPDF()
|
pdf = MyFPDF()
|
||||||
pdf.add_page()
|
pdf.add_page()
|
||||||
|
# pyfpdf needs some attributes to render the table correctly:
|
||||||
html = sanitize(
|
html = sanitize(
|
||||||
html, escape=False) # should have better list of allowed tags
|
html, allowed_attributes={
|
||||||
|
'a': ['href', 'title'],
|
||||||
|
'img': ['src', 'alt'],
|
||||||
|
'blockquote': ['type'],
|
||||||
|
'td': ['align', 'bgcolor', 'colspan', 'height', 'width'],
|
||||||
|
'tr': ['bgcolor', 'height', 'width'],
|
||||||
|
'table': ['border', 'bgcolor', 'height', 'width'],
|
||||||
|
}, escape=False)
|
||||||
pdf.write_html(html, image_map=image_map)
|
pdf.write_html(html, image_map=image_map)
|
||||||
return XML(pdf.output(dest='S'))
|
return XML(pdf.output(dest='S'))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user