]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
mdwn: Make flags passed to libdiscount explicit
authorSimon McVittie <smcv@debian.org>
Sun, 14 May 2017 16:34:12 +0000 (17:34 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 14 May 2017 16:34:12 +0000 (17:34 +0100)
The Perl binding defaults to MKD_NOHEADER|MKD_NOPANTS anyway, but
making them explicit means we can use other flags of our choice,
and makes it easier to justify why those flags are appropriate.

IkiWiki/Plugin/mdwn.pm

index daf9d592e4189e1e06d279b568e43db3b3858262..436f2461da9399cd7d80aaf09d42f06c2391f59a 100644 (file)
@@ -64,14 +64,26 @@ sub htmlize (@) {
                        if (! $@) {
                                $markdown_sub=sub {
                                        my $t=shift;
+
                                        # Workaround for discount binding bug
                                        # https://rt.cpan.org/Ticket/Display.html?id=73657
                                        return "" if $t=~/^\s*$/;
+
+                                       my $flags=0;
+
+                                       # Disable Pandoc-style % Title, % Author, % Date
+                                       # Use the meta plugin instead
+                                       $flags |= Text::Markdown::Discount::MKD_NOHEADER();
+
+                                       # Disable Unicodification of quote marks, em dashes...
+                                       # Use the typography plugin instead
+                                       $flags |= Text::Markdown::Discount::MKD_NOPANTS();
+
                                        # Workaround for discount's eliding
                                        # of <style> blocks.
                                        # https://rt.cpan.org/Ticket/Display.html?id=74016
                                        $t=~s/<style/<elyts/ig;
-                                       my $r=Text::Markdown::Discount::markdown($t);
+                                       my $r=Text::Markdown::Discount::markdown($t, $flags);
                                        $r=~s/<elyts/<style/ig;
                                        return $r;
                                }