christopher-ramirez / secretary

Take the power of Jinja2 templates to OpenOffice and LibreOffice.
Other
190 stars 48 forks source link

Markdown filter is broken #21

Closed bijanebrahimi closed 8 years ago

bijanebrahimi commented 8 years ago

Hi, with the basic example in the README file i run the example code and got really good results except when using markdown filter. here is my code:

{{ content | markdown }}
from secretary import Renderer
engine = Renderer()
result = engine.render("template-book.odt", content='this is a **bold** text! ')
with open('rendered_document.odt', 'wb') as handler:
    handler.write(result)

and here is what I will get in the rendered ODT document:

b'<text:p text:style-name="Standard">this is a <text:span text:style-
name="markdown_bold">bold</text:span> text!</text:p>\n'

the final ODT formated text is kinda escaped in the rendered document. please help me fix this bug :)

bijanebrahimi commented 8 years ago

OK, I Just make progress. now I just realized i should probably use safe filter after markup filter.

{{ content | markdown | safe }}

that solved the escaping characters like <, >! (That I check using grep inside content.xml)

but unfortunately the problem is still there.

bijanebrahimi commented 8 years ago

Using the markdown field (Copy/Pasting it into my ODT template file) from simple_template.odt solved my problem. I think it's more like a LibreOffice problem. I'm currently using 5.0.2.2-fresh version which now switching to 4.4.5 to see if it makes any difference.