home » zplus/freepost.git
Author zPlus <-> 2016-04-22 16:02:54
Committer zPlus <-> 2016-04-22 16:02:54
Commit c811f30 (patch)
Tree 58d9cfa
Parent(s)

Fix Markdown->HTML conversion


commits diff: a7d870e..c811f30
2 files changed, 7 insertions, 2 deletionsdownload


Diffstat
-rw-r--r-- template/comment.twig 2
-rw-r--r-- twig.php 7

Diff options
View
Side
Whitespace
Context lines
Inter-hunk lines
+1/-1 M   template/comment.twig
index b29fe29..df2fc38
old size: 2K - new size: 2K
@@ -40,7 +40,7 @@
40 40 </div>
41 41
42 42 <div class="text">
43 - {{ comment.text|markdown|raw }}
43 + {{ comment.text|markdown|raw }}
44 44 </div>
45 45 </div>
46 46

+6/-1 M   twig.php
index d64436c..f69390d
old size: 2K - new size: 2K
@@ -5,6 +5,7 @@ require_once 'database.php';
5 5 require_once 'date.php';
6 6 require_once 'parsedown.php';
7 7 require_once 'template/Twig/Autoloader.php';
8 + require_once 'htmlpurifier/HTMLPurifier.standalone.php';
8 9
9 10 Twig_Autoloader::register();
10 11
@@ -34,7 +35,11 @@ $twig->addFilter ('ago', new Twig_Filter_Function (function ($datetime) {
34 35 $twig->addFilter ('markdown', new Twig_Filter_Function(function ($markdown) {
35 36 $parsedown = new Parsedown ();
36 37
37 - return $parsedown->text (htmlspecialchars ($markdown));
38 + $purifier_settings = HTMLPurifier_Config::createDefault ();
39 + $purifier_settings->set ('Core', 'EscapeInvalidTags', true);
40 + $purifier = new HTMLPurifier ($purifier_settings);
41 +
42 + return $purifier->purify ($parsedown->text ($markdown));
38 43 }));
39 44
40 45 // Return document root