From e642784901ba022983b4bc4cc806a2d1d774cc4b Mon Sep 17 00:00:00 2001 From: Amitai Schleier Date: Wed, 4 Sep 2019 19:01:28 -0400 Subject: Fix inverted footnote config with MultiMarkdown. Bug spotted and fix from Giuseppe Bilotta . Extend mdwn tests to cover MultiMarkdown, where applicable. --- t/mdwn.t | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 't') diff --git a/t/mdwn.t b/t/mdwn.t index ca3180139..fc11cadae 100755 --- a/t/mdwn.t +++ b/t/mdwn.t @@ -9,12 +9,36 @@ BEGIN { use_ok("IkiWiki"); } %config=IkiWiki::defaultconfig(); $config{srcdir}=$config{destdir}="/dev/null"; $config{disable_plugins}=["htmlscrubber"]; -IkiWiki::loadplugins(); -IkiWiki::checkconfig(); -is(IkiWiki::htmlize("foo", "foo", "mdwn", - "C. S. Lewis wrote books\n"), - "

C. S. Lewis wrote books

\n", "alphalist off by default"); +foreach my $multimarkdown (qw(1 0)) { + $config{multimarkdown} = $multimarkdown; + undef $IkiWiki::Plugin::mdwn::markdown_sub + if defined $IkiWiki::Plugin::mdwn::markdown_sub; + IkiWiki::loadplugins(); + IkiWiki::checkconfig(); + + is(IkiWiki::htmlize("foo", "foo", "mdwn", + "C. S. Lewis wrote books\n"), + "

C. S. Lewis wrote books

\n", + "alphalist off by default for multimarkdown = $multimarkdown"); + + like(IkiWiki::htmlize("foo", "foo", "mdwn", + "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), + qr{

This works.*fnref:1.*}, + "footnotes on by default for multimarkdown = $multimarkdown"); + + $config{mdwn_footnotes} = 0; + unlike(IkiWiki::htmlize("foo", "foo", "mdwn", + "An unusual link label: [^1]\n\n[^1]: http://example.com/\n"), + qr{

An unusual link label: .*fnref:1.*}, + "footnotes can be disabled for multimarkdown = $multimarkdown"); + + $config{mdwn_footnotes} = 1; + like(IkiWiki::htmlize("foo", "foo", "mdwn", + "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), + qr{

This works.*fnref:1.*}, + "footnotes can be enabled for multimarkdown = $multimarkdown"); +} $config{mdwn_alpha_lists} = 1; like(IkiWiki::htmlize("foo", "foo", "mdwn", @@ -28,20 +52,6 @@ like(IkiWiki::htmlize("foo", "foo", "mdwn", "B. Two\n"), qr{

A. One\sB. Two

\n}, "alphalist can be disabled"); -like(IkiWiki::htmlize("foo", "foo", "mdwn", - "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), - qr{

This works\^1}, "footnotes can be disabled"); - -$config{mdwn_footnotes} = 1; -like(IkiWiki::htmlize("foo", "foo", "mdwn", - "This works[^1]\n\n[^1]: Sometimes it doesn't.\n"), - qr{

This works