• 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.

Item7266: Plugin occasionally returns blank quote or incorrectly uses table header as a quote

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Extension RandomQuotePlugin Enhancement New   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

This was reported in RandomQuotePluginDev:

I think I've found some small bugs in the way the plugin reads the random quotes page. It seems to be leaving a "\n" following the %STARTINCLUDE%, resulting in a empty quote. Since the size of the quotes list is off, it also allows a quote for the table header to be displayed. These are both quickly seen if you have a quotes page with 1 entry.
-- SethTaplin - 30 Jul 2003

and AurelioAHeckert provided a fix which was never incorporated into the code.

I make a little change that works:
in the line 312:
was:
    # remove everything before %STARTINCLUDE% and after %STOPINCLUDE%
    $topicText =~ s/.*?%STARTINCLUDE%//s;
now is:
    # remove everything before %STARTINCLUDE% and after %STOPINCLUDE%
    $topicText =~ s/.*?%STARTINCLUDE%\n[^\n]*\n//s;
and in the line 319:
was:
    srand(time ^ 22/7);
    my $quote = int (rand(@quotes)) + 1;
now is:
    srand(time ^ 22/7);
    my $quote = int (rand(@quotes));
Now the plugin gets only the quotes (whithout the frist table line) and do not exist the blank quote.
-- AurelioAHeckert - 04 Apr 2005

Apparently the line numbers mentioned by AurelioAHeckert have since changed. I made the changes to my own copy of RandomQuotePlugin.pm as shown below:

% diff RandomQuotePlugin.pm RandomQuotePlugin.pmDIST
106c106
<    $topicText =~ s/.*?%STARTINCLUDE%\n[^\n]*\n//s;
---
>    $topicText =~ s/.*?%STARTINCLUDE%//s;
112c112
<    my $quote = int (rand(@quotes));
---
>    my $quote = int (rand(@quotes)) + 1;

-- TWiki:Main/VickiBrown - 2013-05-23

ItemTemplate
Summary Plugin occasionally returns blank quote or incorrectly uses table header as a quote
ReportedBy TWiki:Main.VickiBrown
Codebase

SVN Range TWiki-5.1.3-trunk, Mon, 13 May 2013, build 25914
AppliesTo Extension
Component RandomQuotePlugin
Priority Enhancement
CurrentState New
WaitingFor

Checkins

TargetRelease n/a
ReleasedIn

Topic revision: r1 - 2013-05-23 - VickiBrown
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback