Permalink
Browse files

Item13390: Don't link escaped ![[squarebracket]]

WysiwygPlugin is rendering escaped square bracket links, which are then
converted back to non-escaped bracketed links.

Add a unit test.  Also found another test that was passing with a
rendered escaped link.
  • Loading branch information...
gac410 committed May 1, 2015
1 parent c904b11 commit 4430aeefc71806089c6a2c807344edeee24a96e2
@@ -456,8 +456,8 @@ s/<([A-Za-z]+[^>]*?)((?:\s+\/)?)>/'<' . $this->_protectTag($1, 'TMLhtml') . $2 .
$this->_liftOutLink($1, { tag => 'NONE', protect => 0, tmltag => 0 } )/geixo;
$text =~
s/\[\[([^]]*)\]\[([^]]*)\]\]/$this->_protectMacrosInSquab($1,$2)/ge;
$text =~ s/\[\[([^\]]*)\]\]/$this->_protectMacrosInSquab($1)/ge;
s/(?<!\!)\[\[([^]]*)\]\[([^]]*)\]\]/$this->_protectMacrosInSquab($1,$2)/ge;
$text =~ s/(?<!\!)\[\[([^\]]*)\]\]/$this->_protectMacrosInSquab($1)/ge;
$text =~ s/(<[^>]+>)/$this->_protectMacrosInHTML($1)/ge;
@@ -469,10 +469,10 @@ s/<([A-Za-z]+[^>]*?)((?:\s+\/)?)>/'<' . $this->_protectTag($1, 'TMLhtml') . $2 .
# Handle [[][]] links by letting the WYSIWYG handle them as standard links
$text =~
s/\[\[([^]]*)\]\[([^]]*)\]\]/$this->_liftOutSquab($1,$2,'TMLlink')/ge;
s/(?<!\!)\[\[([^]]*)\]\[([^]]*)\]\]/$this->_liftOutSquab($1,$2,'TMLlink')/ge;
# Handle [[]] links
$text =~ s/\[\[([^\]]*)\]\]/$this->_liftOutSquab($1,$1,'TMLlink')/ge;
$text =~ s/(?<!\!)\[\[([^\]]*)\]\]/$this->_liftOutSquab($1,$1,'TMLlink')/ge;
# protect some HTML tags, excluding noautolink and nop, handled later.
$text =~ s/(<\/?(?!(?i:$PALATABLE_HTML|NOAUTOLINK|NOP)\b)[A-Z]+(\s[^>]*)?>)/
@@ -1309,7 +1309,7 @@ EVERYWHERE
exec => ROUNDTRIP | TML2HTML | HTML2TML,
name => 'squabsWithVars2',
html => <<HERE,
<p><span class="WYSIWYG_LINK">[[wiki syntax]]</span><span class="WYSIWYG_LINK">[[%MAINWEB%.Wiki users]]</span><span style="{encoded:'n'}" class="WYSIWYG_HIDDENWHITESPACE">&nbsp;</span>escaped:<span style="{encoded:'n'}" class="WYSIWYG_HIDDENWHITESPACE">&nbsp;</span>!<span class="WYSIWYG_LINK">[[wiki syntax]]</span>
<p><span class="WYSIWYG_LINK">[[wiki syntax]]</span><span class="WYSIWYG_LINK">[[%MAINWEB%.Wiki users]]</span><span style="{encoded:'n'}" class="WYSIWYG_HIDDENWHITESPACE">&nbsp;</span>escaped:<span style="{encoded:'n'}" class="WYSIWYG_HIDDENWHITESPACE">&nbsp;</span>![[wiki syntax]]
</p>
HERE
tml => <<'THERE',
@@ -1355,6 +1355,13 @@ THERE
html => ${LINKON} . 'FleegleHorn#TrumpetHack' . ${LINKOFF},
tml => 'FleegleHorn#TrumpetHack',
},
{
exec => TML2HTML | ROUNDTRIP,
name => 'EscapedSquab',
tml => '![[Notlinked]]',
html => '<p> ![[Notlinked]]
</p>'
},
{
exec => ROUNDTRIP,
name => 'plingedVarOne',

0 comments on commit 4430aee

Please sign in to comment.