Convert Markdown to HTML in the view by view.helpers.markdown().

This commit is contained in:
takezoe
2013-05-02 02:51:17 +09:00
parent d0716039fe
commit b2c6a0e24a
2 changed files with 3 additions and 5 deletions

View File

@@ -213,9 +213,7 @@ class RepositoryViewerController extends ControllerBase {
// process README.md // process README.md
val readme = files.find(_.name == "README.md").map { file => val readme = files.find(_.name == "README.md").map { file =>
import org.pegdown._ new String(JGitUtil.getContent(Git.open(getRepositoryDir(owner, repository)), file.id, true).get, "UTF-8")
val git = Git.open(getRepositoryDir(owner, repository))
new PegDownProcessor().markdownToHtml(new String(git.getRepository.open(file.id).getBytes, "UTF-8"))
} }
html.files( html.files(

View File

@@ -52,10 +52,10 @@
</tr> </tr>
} }
</table> </table>
@readme.map { html => @readme.map { content =>
<table class="table table-bordered"> <table class="table table-bordered">
<tr> <tr>
<td>@Html(html)</td> <td>@helpers.markdown(content)</td>
</tr> </tr>
</table> </table>
} }