ca8d3560aa51bc5d7a508359ebdb6fbedbc48b05 chmalee Fri Sep 22 13:19:15 2023 -0700 Put special check for br tags in item titles behind hg.conf control now that we have new mouseover code. Eventually the else statement can be removed entirely, refs Jonathan email diff --git src/hg/hgTracks/imageV2.c src/hg/hgTracks/imageV2.c index d885cd2..7745a9c 100644 --- src/hg/hgTracks/imageV2.c +++ src/hg/hgTracks/imageV2.c @@ -1802,36 +1802,43 @@ else if (item->linkVar != NULL) { if (skipToSpaces(item->linkVar)) hPrintf(" HREF=%s",item->linkVar); else if (startsWith("/cgi-bin/hgGene", item->linkVar)) // redmine #4151 hPrintf(" HREF='..%s'",item->linkVar); // FIXME: Chin should get rid else // of this special case! hPrintf(" HREF='%s'",item->linkVar); hPrintf(" class='area'"); } else warn("map item has no url!"); if (item->title != NULL && strlen(item->title) > 0) { + char *encodedString = attributeEncode(item->title); + if (cfgOptionBooleanDefault("showMouseovers", FALSE)) + { + hPrintf(" TITLE='%s'", encodedString); + } + else + { // for TITLEs, which we use for mouseOvers, since they can't have HTML in // them, we substitute a unicode new line for <br> after we've encoded it. // This is stop-gap until we start doing mouseOvers entirely in Javascript - char *encodedString = attributeEncode(item->title); hPrintf(" TITLE='%s'", replaceChars(encodedString,"<br>", "
")); } + } if (item->id != NULL) hPrintf(" id='%s'", item->id); hPrintf(">" ); } hPrintf("</MAP>\n"); return TRUE; } static void imageDraw(struct imgBox *imgBox,struct imgTrack *imgTrack,struct imgSlice *slice, char *name,int offsetX,int offsetY,boolean useMap) // writes an image as HTML { if (slice->parentImg && slice->parentImg->file != NULL) { hPrintf(" <IMG id='img_%s' src='%s' style='left:-%dpx; top: -%dpx;'",