When I embed multiple Sparklines in a single body of content, I only get one image back for all Sparklines. Investigating it some, a pair of braces is missing:
sparkline.module:88
$repl = theme('image', $img);
This is then used on line 90 with the $mtch variable in a str_replace(). Adding braces fixes this problem.
sparkline.module:88
$repl[] = theme('image', $img);
Hope this helps! Looks cool, though. I appreciate this module!
Comments
Comment #1
fractile81 commentedThe line numbers in my bug report should all read 87, not 88. Sorry for the mistake.
Comment #2
fractile81 commentedAdditionally, there's a problem with the RegEx that will keep multiple Sparklines from displaying.
Line 79 reads:
$pattern = "/\[sparkline (.*)\]/";It needs to read:
$pattern = "/\[sparkline ([^\]]*)\]/";For those who would like an explanation: The
.*in the original RegEx matches all characters, with the\]stopping at the last possible ] in the content, skipping any ] that are not last. This causes text and other Sparklines on the same line to disappear as they are all being included as part of the first Sparkline. The replacement[^\]]*says to match every character EXCEPT a ], allowing the last\]to effectively close the tag when the first ] is encountered after the tag is opened.Comment #3
Chris Johnson commentedThanks for the report, and especially thank you for the suggested fixes! I'm sorry I didn't get around to fixing this sooner.
I just applied changes to CVS to put these fixes in.
Comment #4
(not verified) commented