This works

MARKMIN(text, extra={"pre_with_code": lambda text: 
"<pre><code>{0}</code></pre>".format(text)})

but is is a little dangerous since the user can do

``
</code></pre>
<script>alert('oops!');</script>
<pre><code>
``

The argument of text should be escaped somehow. Not sure how since you want 
to allow verbatim code.


On Monday, 21 January 2013 22:30:51 UTC-6, rochacbruno wrote:
>
> for this I thinnk you sould use extra render.
>
>
> {{text = "`` here is my code ``:pre_with_code"}}
> {{=MARKMIN(text, extra={"pre_with_code": lambda text: 
> "<pre><code>{0}</code></pre>".format(text)})}}
>
> Tested on shell
>
> In [4]: text = "`` here is my code ``:pre_with_code"
>
> In [5]: print MARKMIN(text, extra={"pre_with_code": lambda text: 
> "<pre><code>{0}</code></pre>".format(text)})
> <pre><code> here is my code </code></pre>
>
>

-- 



Reply via email to