위키 피 디아와 유사한 프로젝트로 처리하고 있습니다. 마크 다운을 사용하여 텍스트 파일을 html 코드로 변환 할 수 있습니다. 내 문제는,이 html 코드를 html 파일로 렌더링하고 싶습니다. 내 코드는 다음과 같습니다web.py에서 HTML 렌더링
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)
article_files.html에 body_name과 body (html code)를 전달하고 있습니다. 몸 모양은 다음과 같습니다.
<h1>Hai</h1>
<p>Welcome<em>Ajay</em></p>
문제는 본체가 그대로 표시됩니다. 즉, HTML 코드가 모든 태그가있는 화면에 인쇄됩니다. 나는 이 아제
내 HTML 파일이 환영이 html 코드 (몸)와 같은,
하이
을 렌더링 할 :
$def with(title,content)
<html>
<head>
<title>$title</title>
</head>
<body>
<form name="form" method="GET">
$content
</form>
</body>
</html>
감사 Helgi를. 코드는 이제 아주 잘 작동합니다. –