|
|
|
|
@ -18,6 +18,9 @@ class ShowController(
|
|
|
|
|
val tagDao: TagDao
|
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
val markdownParser: Parser = Parser.builder().build()
|
|
|
|
|
val htmlRenderer: HtmlRenderer = HtmlRenderer.builder().build()
|
|
|
|
|
|
|
|
|
|
@GetMapping("/document/{id}")
|
|
|
|
|
fun show(
|
|
|
|
|
model: Model,
|
|
|
|
|
@ -26,11 +29,9 @@ class ShowController(
|
|
|
|
|
val document = docDao.findById(id) ?: throw DocumentNotFound()
|
|
|
|
|
model["document"] = document
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
val descHtml = Parser.builder().build().parse(document.description).let {
|
|
|
|
|
HtmlRenderer.builder().build().render(it)
|
|
|
|
|
model["descHtml"] = markdownParser.parse(document.description).let {
|
|
|
|
|
htmlRenderer.render(it)
|
|
|
|
|
}
|
|
|
|
|
model["descHtml"] = descHtml
|
|
|
|
|
|
|
|
|
|
val documentTags = tagDao.ofDocument(id)
|
|
|
|
|
model["documentTags"] = documentTags.sortedBy { it.name.lowercase() }
|
|
|
|
|
|