contrib/nitrpg: add MDPanel to display MDContent
authorAlexandre Terrasa <alexandre@moz-code.org>
Mon, 23 Feb 2015 12:36:20 +0000 (13:36 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Tue, 21 Apr 2015 23:37:49 +0000 (19:37 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitrpg/src/templates/panels.nit

index 14538c5..a792703 100644 (file)
@@ -18,6 +18,7 @@
 module panels
 
 import templates_events
+import markdown
 
 # A panel can be displayed in a html page.
 #
@@ -98,6 +99,20 @@ class ErrorPanel
 
 end
 
+# A panel that display a markdown content rendered as HTML.
+class MDPanel
+       super Panel
+
+       # Markdown text to display.
+       var text: String
+
+       redef fun rendering do
+               add """<div class="panel">
+                           <div class="panel-body">{{{text.md_to_html}}}</div>
+                         </div>"""
+       end
+end
+
 # A panel that display repo statistics.
 class GameStatusPanel
        super Panel