Dr Fragen in the operating room

Update to untitledPost callback

·

I’ve updated the untitledPost callback to accommodate if the first sentence ends in either a question mark or an exclamation point. It seems the string.firstSentence macro only looks for the first period followed by a space. Anyway the change is fairly easy to add sentence ending marks. It won’t really take into consideration if the first 2 sentences are the same and aren’t periods, but how often does that happen?!
Anyway here it is. Make sure to save it to user.radio.callbacks.postItem.untitledPost.

on untitledPost (adrpost) {
  if not defined (adrpost^.title) {
    adrpost^.title = string(string.firstSentence (adrpost^.text));
    local (endMarks = {"!", "?"});
    for i = 1 to sizeOf (endMarks) {
      if adrpost^.title contains endMarks[i] {
        adrpost^.title = string.popSuffix (adrpost^.title, endMarks[i]) + endMarks[i]}};
    adrpost^.title = searchEngine.stripMarkup (adrpost^.title)}}

Thanks to Brian St. Pierre for a final tweak.