Re: [web2py] How I can use code tag with Markmin?

2013-01-22 Thread Alan Etkin
How about

MARKMIN(text, extra={pre_with_code: lambda text: 
precode{0}/code/pre.
format(XML(text, sanitize=True))})

-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-22 Thread Massimo Di Pierro
This would be safe but t may mess up the output. In principe the text 
inside code/ should be allowed to contain any html including script but 
it should not be able to close the code tag. I think the right solution 
is:

MARKMIN(text, extra={pre_with_code: lambda text: 
precode{0}/code/pre.format(cgi.escape(text))})


On Tuesday, 22 January 2013 05:09:57 UTC-6, Alan Etkin wrote:

 How about

 MARKMIN(text, extra={pre_with_code: lambda text: 
 precode{0}/code/pre.
 format(XML(text, sanitize=True))})



-- 





[web2py] How I can use code tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
How I can use code tag with Markmin? Thank you.

-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Bruno Rocha
``
htmlbodyHello World/body/html
``:code_html


``
print hello world
``:code_python

On Tue, Jan 22, 2013 at 1:50 AM, Ignacio Ocampo naf...@gmail.com wrote:

 How I can use code tag with Markmin? Thank you.

 --





-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Bruno, thank you.

But if I only need the simple code?

code
anything
/code

How I can do it?

On Monday, January 21, 2013 9:56:35 PM UTC-6, rochacbruno wrote:

 ``
 htmlbodyHello World/body/html
 ``:code_html


 ``
 print hello world
 ``:code_python

 On Tue, Jan 22, 2013 at 1:50 AM, Ignacio Ocampo naf...@gmail.comjavascript:
  wrote:

 How I can use code tag with Markmin? Thank you.

 -- 
  
  
  




-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Bruno Rocha
``
Your code here
``

for testing: http://web2py.com/markmin

-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Thank you Bruno,

and precodeanything/code/pre :) ?

On Mon, Jan 21, 2013 at 10:09 PM, Bruno Rocha rochacbr...@gmail.com wrote:


 ``
 Your code here
 ``

 for testing: http://web2py.com/markmin

 --







-- 
Ignacio Ocampo Millán

-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Bruno Rocha
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:
precode{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:
precode{0}/code/pre.format(text)})
precode here is my code /code/pre

-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Massimo Di Pierro
This works

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

but is is a little dangerous since the user can do

``
/code/pre
scriptalert('oops!');/script
precode
``

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: 
 precode{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: 
 precode{0}/code/pre.format(text)})
 precode here is my code /code/pre



-- 





Re: [web2py] How I can use code tag with Markmin?

2013-01-21 Thread Ignacio Ocampo
Very fun! :)

On Mon, Jan 21, 2013 at 11:22 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 This works

 MARKMIN(text, extra={pre_with_code: lambda text:
 precode{0}/code/pre.**format(text)})

 but is is a little dangerous since the user can do

 ``
 /code/pre
 scriptalert('oops!');/script
 precode
 ``

 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:
 precode{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:
 precode{0}/code/pre.**format(text)})
 precode here is my code /code/pre

  --







-- 
Ignacio Ocampo Millán

--