function bestQuoteFor(title) {

    if (/^[^\s\[\]\-+~=:'"][^\s\[\]]*$/.test(title)) {
        return title;
    }
    if (title.indexOf("]") < 0) {
        return "[[" + title + "]]";
    }
    if (title.indexOf("'") < 0) {
        return "'" + title + "'";
    }
    return '"' + title + '"';

  }
Returns title wrapped in quotes if necessary.