Задать вопрос

Тел: +7 965 3737 888

502

Просмотров

0

Ответов

Generic markup converter

<p>I'm a big fan of Markdown, and often set up models to automatically apply it to certain fields before saving. But that's not really flexible, because if I then distribute the code someone else might want to use reStructuredText or Textile or whatever, and then they have to hack my code.
</p>
<p>So here's a function which looks for a setting called MARKUP_FILTER and, based on what it finds there (see the docstring for what it looks at), chooses a text-to-HTML conversion function and applies it to a piece of text. Since Textile, Markdown and reStructuredText all support various useful options, it has the ability to pick up arbitrary keyword arguments and pass them through.
</p>

Вопрос полезен? Да0/Нет0
file_4769.py(2.5Кб)
None