Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Text-MediawikiFormat CPAN distribution.

Report information
The Basics
Id: 25417
Status: resolved
Worked: 6 hours (360 min)
Priority: 0/
Queue: Text-MediawikiFormat

People
Owner: derek [...] ximbiot.com
Requestors: oidouque-bitcard.org [...] wincent.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.05
Fixed in: (no value)



Subject: Content of <pre> blocks should behave as if <nowiki> were applied
Special wiki characters should have no effect within <pre> blocks: INPUT: <pre>[[foo]]</pre> MEDIAWIKI: <pre>[[foo]]</pre> Text::MediaWiki: <pre><a href='foo'>foo</a></pre> Here's a slightly more complex example showing how this can cause things to go wrong in unexpected ways: INPUT: <pre>[1, 2, 3, [4, 5, 6]]</pre> MEDIAWIKI: <pre>[1, 2, 3, [4, 5, 6]]</pre> Text::MediaWiki: <pre>[1, 2, 3, <a href='4,'>5, 6</a>]</pre> This is with Text::MediaWiki 0.05, Perl v5.8.6, Mac OS X 10.4.8. Also tested on Red Hat Enterprise Linux 3 ES (Perl v5.8.0).
From: oidouque-bitcard.org [...] wincent.com
Attaching a patch that adds some test cases for this issue (and also for bug #25418). The patch should be applied to "t/bugs.t". Output of "make test" after applying the patch: PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/absolute_links.........ok t/base...................ok t/bugs...................ok 13/18# Failed test (t/bugs.t at line 121) # got: '<pre><a href='foo'>foo</a></pre> # ' # expected: '<pre>[[foo]]</pre>' t/bugs...................NOK 16# Failed test (t/bugs.t at line 126) # got: '<pre>[1, 2, 3, <a href='4,'>5, 6</a>]</pre> # ' # expected: '<pre>[1, 2, 3, [4, 5, 6]]</pre>' t/bugs...................NOK 17# Failed test (t/bugs.t at line 131) # got: '<p>foo [[bar]]</p> # <pre>baz # </pre> # ' # expected: 'foo <nowiki>[[bar]]</nowiki> baz' t/bugs...................NOK 18# Looks like you failed 3 tests of 18. t/bugs...................dubious Test returned status 3 (wstat 768, 0x300) DIED. FAILED tests 16-18 Failed 3/18 tests, 83.33% okay t/embedded-links.........ok t/explicit...............ok t/implicit...............ok t/kake...................ok t/lists-nested...........ok t/lists-no-indent........ok t/lists..................ok t/merge-hash.............ok t/tag-override-use-as....ok t/tag-override...........ok t/Wiki...................ok Failed Test Stat Wstat Total Fail Failed List of Failed ------------------------------------------------------------------------ ------- t/bugs.t 3 768 18 3 16.67% 16-18 Failed 1/14 test scripts, 92.86% okay. 3/159 subtests failed, 98.11% okay. make: *** [test_dynamic] Error 2
8c8 < use Test::More tests => 15; --- > use Test::More tests => 18; 116a117,132 > > # http://rt.cpan.org/Public/Bug/Display.html?id=25417 > $wikitext = '<pre>[[foo]]</pre>'; > $htmltext = Text::MediawikiFormat::format ($wikitext); > is $htmltext, '<pre>[[foo]]</pre>', 'link markup should be ignored inside <pre> blocks'; > > # http://rt.cpan.org/Public/Bug/Display.html?id=25417 > $wikitext = '<pre>[1, 2, 3, [4, 5, 6]]</pre>'; > $htmltext = Text::MediawikiFormat::format ($wikitext); > is $htmltext, '<pre>[1, 2, 3, [4, 5, 6]]</pre>', 'incidental link markup should be ignored inside <pre> blocks'; > > # http://rt.cpan.org/Public/Bug/Display.html?id=25418 > $wikitext = 'foo <nowiki>[[bar]]</nowiki> baz'; > $htmltext = Text::MediawikiFormat::format ($wikitext); > is $htmltext, 'foo <nowiki>[[bar]]</nowiki> baz', 'nowiki should work inline'; >
I've fixed this. It will be released with the upcoming 1.0 release.