Skip to content

Commit

Permalink
Item8454: TML2HTML's WYSIWYG_PROTECTED span's contain a spurious br e…
Browse files Browse the repository at this point in the history
…lement caused by undocumented use of an optional \n in the %-splitting Crawford, Paul and anyone else, please have a look and see if you can work out/remember why..

git-svn-id: http://svn.foswiki.org/trunk@6203 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Feb 2, 2010
1 parent f565054 commit 1fd2e56
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
10 changes: 9 additions & 1 deletion WysiwygPlugin/lib/Foswiki/Plugins/WysiwygPlugin/TML2HTML.pm
Expand Up @@ -188,7 +188,15 @@ sub _processTags {

return '' unless defined($text);

my @queue = split( /(\n?%)/s, $text );
#SMELL: why put a \n into the split? (at least document it..)
# my @queue = split( /(\n?%)/s, $text );
#SVEN: I've removed the extra \n capture, and am seeing what the tests tell me..
# doing so removes an (so far) unexplaind <br /> that was put into the WYSIWYG_PROTECTED bloc..
# eg. <span class="WYSIWYG_PROTECTED"><br />%TABLESEP%</span>
#SMELL: having removed the \n from the split, the code below now _should_ be rewritten to remove the
# other processing of the \n. For now (Feb2010), I've left it as is, so that we can revert to the old
# code if/when someone figures out why it was in the split in the first place.
my @queue = split( /(%)/s, $text );
my @stack;
my $stackTop = '';

Expand Down
Expand Up @@ -651,8 +651,8 @@ HERE
<table cellspacing="1" cellpadding="0" border="1">
<tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr>
</table>
<span class="WYSIWYG_PROTECTED"><br />%TABLESEP%</span>
<span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
<span class="WYSIWYG_PROTECTED">%TABLESEP%</span>
<span class="WYSIWYG_PROTECTED">%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
THERE
},
{
Expand All @@ -668,7 +668,7 @@ HERE
<table cellspacing="1" cellpadding="0" border="1">
<tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr>
</table>
<span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
<span class="WYSIWYG_PROTECTED">%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
THERE
},
{
Expand Down
30 changes: 26 additions & 4 deletions WysiwygPlugin/test/unit/WysiwygPlugin/TranslatorTests.pm
Expand Up @@ -666,7 +666,7 @@ HERE
exec => $TML2HTML | $ROUNDTRIP,
name => 'variousWikiWords',
html =>
"<p>${linkon}WebPreferences${linkoff}</p><p>$protecton<br />%MAINWEB%$protectoff.WikiUsers</p><p>${linkon}CompleteAndUtterNothing${linkoff}</p><p>${linkon}LinkBox$linkoff${linkon}LinkBoxs${linkoff}${linkon}LinkBoxies${linkoff}${linkon}LinkBoxess${linkoff}${linkon}LinkBoxesses${linkoff}${linkon}LinkBoxes${linkoff}</p>",
"<p>${linkon}WebPreferences${linkoff}</p><p>$protecton%MAINWEB%$protectoff.WikiUsers</p><p>${linkon}CompleteAndUtterNothing${linkoff}</p><p>${linkon}LinkBox$linkoff${linkon}LinkBoxs${linkoff}${linkon}LinkBoxies${linkoff}${linkon}LinkBoxess${linkoff}${linkon}LinkBoxesses${linkoff}${linkon}LinkBoxes${linkoff}</p>",
tml => <<'YYY',
WebPreferences
Expand Down Expand Up @@ -1980,8 +1980,8 @@ HERE
<table cellspacing="1" cellpadding="0" border="1">
<tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr>
</table>
<span class="WYSIWYG_PROTECTED"><br />%TABLESEP%</span>
<span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
<span class="WYSIWYG_PROTECTED">%TABLESEP%</span>
<span class="WYSIWYG_PROTECTED">%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
THERE
},
{
Expand All @@ -1995,7 +1995,7 @@ HERE
<table cellspacing="1" cellpadding="0" border="1">
<tr><td><span class="WYSIWYG_LINK">[[LegacyTopic1]]</span></td><td><span class="WYSIWYG_LINK">Main.SomeGuy</span></td></tr>
</table>
<span class="WYSIWYG_PROTECTED"><br />%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
<span class="WYSIWYG_PROTECTED">%SEARCH{"legacy" nonoise="on" format="| [[\$topic]] | [[\$wikiname]] |"}%</span>
THERE
},
{
Expand Down Expand Up @@ -2233,6 +2233,28 @@ ZAT
exec => $ROUNDTRIP | $CANNOTWYSIWYG,
tml => '<!-- <sticky></sticky> -->',
},
{
name => "ItemSVEN",
exec => $TML2HTML | $ROUNDTRIP,
tml => <<'HERE',
---
%SEARCH{search="Sven"}%
HERE
finaltml => <<'HERE',
---
%SEARCH{search="Sven"}%
HERE
html => <<'HERE',
<p>
<hr class="TMLhr" />
</p>
<p>
<span class="WYSIWYG_PROTECTED">%SEARCH{search=&#34;Sven&#34;}%</span>
</p>
HERE
},
];

sub gen_compare_tests {
Expand Down

0 comments on commit 1fd2e56

Please sign in to comment.