• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

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: &lt;a style='color:#000000
(17:31:21) ArthurClemens:   ;font-size:9px;text-decoration:none;' href='/twiki/bin/view/TWiki/H2ODef'&gt;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: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


Summary getPluginPreferencesValue
ReportedBy MartinCleaver
AppliesTo Engine
Priority Urgent
CurrentState Closed

Checkins 7342 7346
Edit | Attach | Watch | Print version | History: r3 < r2 < r1 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r3 - 2005-11-07 - CrawfordCurrie
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback