scope dm_gazelle_addRuleWithComment. static new ThreadLocal #msg; static new ThreadLocal #renderWithoutComments; static new ThreadLocal #noInfoBox; // returns (ruleID, isNew) static Pair dm_gazelle_addRuleWithComment(S text, S comment) { Pair p = cast quickImport(dm_call(dm_gazelle_rulesModule(), 'addRuleWithComment, text, comment)); S rendered = newLinesToSpaces_trim(text); if (nempty(comment) && !isTrue(renderWithoutComments)) rendered += " [comments: " + joinLinesWithComma(comment) + "]"; S _msg = setTLAndReturn(msg, p.b ? "Rule " + p.a + " added: " + rendered : "Rule already there: " + p.a + " - " + rendered); if (!boolPar(noInfoBox)) infoBox(_msg); ret p; } static Pair dm_gazelle_addRuleWithComment(S when, S then, S comment) { ret dm_gazelle_addRuleWithComment(when + "\n=> " + then, comment); } end scope