2011/8/8 Ajay <[email protected]>:
> I am handling with a Wikipedia like project. I can convert the text
> file to html code using the markdown. My problem is I want to render
> this html code to a html file. Here is my code,
>
> class articles:
>    def GET(self):
>        form_name=web.input()
>        article_name=form_name.page
>        article_file_path=os.path.join('articles',article_name)
>        fp = open(article_file_path,'rU')
>        text = fp.read()
>        body = markdown2.markdown(text)
>        return render.article_files(article_name, body)
>
>
> I'm passing article_name and body(html code) to article_files.html.
> The body looks like,
>
> <h1>Hai</h1>
> <p>Welcome<em>Ajay</em></p>
>
> The problem is, the body displays as it is. That is the html code is
> printed in the screen with all tags. I want to render this html code
> (body) like, "Hai" in bold letters etc. My HTML file is,
>
> $def with(title,content)
> <html>
> <head>
> <title>$title</title>
> </head>
> <body>
>    <form name="form" method="GET">
>        $content
>    </form>
> </body>
> </html>

Use $:content.

special characters are escaped automatically. $: prevents that escaping.

Anand

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/webpy?hl=en.

Reply via email to