Does getPluginPreferencesValue occasionally leave extraneous whitespace on the end of a preference setting?
In
EmbedTopicPlugin.txt (Beta4)
000011B0 53 65 74 20 48 44 43 4F 4C 4F 52 20 3D 20 23 30 Set HDCOLOR = #0
000011C0 30 30 30 30 30 0A 20 20 0A 2D 2D 2D 2B 2B 20 50 00000. .---++ P
^ ^
five zeros line break
^ end of subsequent line
Note there is no extra whitepace after the 0A at the end of the setting, but there are two spaces on a line by itself on the subsequent line.
I imagine this is a minor bug in the preferences parser.
(17:22:06) MartinCleaver: http://testwiki.mrjc.com/twiki/bin/view/TWiki/EmbedTopicPluginDemo
(17:22:12) MartinCleaver: the CSS is showing
(17:22:37) MartinCleaver: I don't know where to start
(17:22:37) ***ArthurClemens clicks
(17:22:43) MartinCleaver: thanks
(17:23:12) ArthurClemens: you mean in the topic text?
(17:23:21) MartinCleaver: Y
(17:23:34) MartinCleaver: e.g. <a style='color:#000000 ;font-size:9px;text-decoration:none;' href='/twiki/bin/view/Sandbox/WaterDef'>Sandbox.WaterDef
(17:31:21) ArthurClemens: <a style='color:#000000
(17:31:21) ArthurClemens: ;font-size:9px;text-decoration:none;' href='/twiki/bin/view/TWiki/H2ODef'>H2ODef</a></td></tr><tr><td><table border=0 cellpadding=2><td>
(17:31:21) ArthurClemens: <p />
(17:31:31) ArthurClemens: your < are escaped somehow
(17:38:15) MartinCleaver: heh. I deleted the CSS
(17:38:46) MartinCleaver: the line said: <a style='color:$hdcolor;font-size:9px;text-decoration:none;' href= ...
(17:38:49) MartinCleaver: It now says:
(17:39:23) MartinCleaver: <a href=...
(17:40:36) MartinCleaver: ah! maybe! a line break at the end of color:#00000
(17:40:48) MartinCleaver: and before ;font-size?
(17:41:01) ArthurClemens: in the html it shows as a linebreak
17:41
(17:42:26) MartinCleaver: This was it!
(17:42:41) MartinCleaver: He calls $hdcolor = TWiki::Func::getPluginPreferencesValue( "HDCOLOR" ) || "#DDDDDD";
(17:43:08) MartinCleaver: and getPluginPreferencesValue must now be returning the spaces and line break at the end of the line
(17:43:24) MartinCleaver: this resulted in it breaking the value for hdcolor
(17:43:47) MartinCleaver: so its a problem with the core, not with the plugin
(17:44:43) MartinCleaver: ok, thanks Arthur. Much appreciated
(17:45:05) ArthurClemens: welcome
There was indeed a bug in the parser, it was being a bit greedy and sucking in the following line which started with spaces, but not a multiple of three as per spec.
For a full spec of the whitespace handling see
sub test_whitespace
in
test/unit/PrefsTests.pm
and TWiki.TWikiVariables in the codebase.
SVN 7346
CC