hey guys,
I've been working on some stuff in SemantciResultsFormat, in the Exhibit code,
And I think  I found a bug when creating a template for a lens for the map view.


I made a template like this:

{{{label}}}

Consists of: {{{Consists of}}}<br>
Made By: {{{Made by}}}<br>
[[image:{{{Has image url}}}]]
again: {{{label}}}

and when I load the map page, the map doesn't render.

There's a javascript error:

"test is null"
on SRF_Exhibit.js, line 93.

This is happening, because of this code, in SRF_Exhibit.php, around line 292

            if (preg_match_all("/[{][{][{][1-9A-z\:\|\/\=\-[:space:]]*[}][}][}]/u",$lenswikitext,$matches)) {
                foreach($matches as $match){
                    foreach($match as $value){
                        $strippedvalue = trim($value,"{}");
                        $lenswikitext = str_replace($value,'<div class="inlines" id="lenscontent'.$lenscounter.'">'.$this->encodePropertyName(strtolower(str_replace("\n","",$strippedvalue))).'</div>',$lenswikitext);
                        $lenscounter++;
                    }
                }
            }



problem here, is if you have the same {{{variable}}} appearing twice.
The regex finds it twice, and loops over it twice
the replacement will only happen once, on the first pass,
but the lenscounter gets incremented twice.

So when the javascript code uses the lenscounter var to iterate over the divs, there are some ids for which there's no corresponding div.

When this happens the code fails, and you get no map.

also, multiple divs get created with the same id, which probably also isn't good.

I had a simple fix for this: just testing if the var 'test' is null before trying to do anything with it. But maybe that's not the best fix.

Just letting you know. Let me know if you have any questions, or want my fix.

thanks!