christopher-ramirez / secretary

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

[development] Markdown filter does not work anymore #61

Open RomainTT opened 6 years ago

RomainTT commented 6 years ago

I already said that I found an issue with the markdown filter but you did not seem to reproduce the issue... So I re-checked it more seriously and I can say I don't have any issue with the master branch, but it does not work on development.

Template

RAW CONTENT :
{{content}}
FILTERED CONTENT :
{{content|markdown}}
FILTERED CONTENT WITH SAFE :
{{content|markdown|safe}}

Code

from secretary import Renderer
template = 'template.odt'
engine = Renderer()
result = engine.render(template, content="hello world")
output = open('rendered_document.odt', 'wb')
output.write(result)

Output on master branch

RAW CONTENT :
hello world
FILTERED CONTENT :
hello world
FILTERED CONTENT WITH SAFE :
hello world

Output on development branch

RAW CONTENT :
hello world
FILTERED CONTENT :

FILTERED CONTENT WITH SAFE :
christopher-ramirez commented 6 years ago

Thank you for reporting this! I'll have a look into it.

A few changes have been introduced on the development branch with how the system outputs the final values. Maybe this has affected the Markdown filter since it work on much lower level.

RomainTT commented 6 years ago

Hi ! any news concerning this issue ?

235 commented 5 years ago

So I spent a bit of time on this.

Markdown works, but there are few edge cases when it's not rendered in the final document (but xml is present):

  1. The most crucial one that {{ text|markdown }} cannot be nested inside of a paragraph. Basically, it required break lines around.
  2. Also, it's really recommended to make your variables as Input field (see the documentation), as it's hardcoded to look for those in the code.

So, things work, just not as generic to support all cases.