// returns list(pair(id, rule)) static L mL_rules_addGlobalIDsIfAuthed(S listName) { L l = splitAtEmptyLines(mL_raw(listName)); L withIDs = combineWithGlobalIDs(l); bool change = false; for (PairS p : withIDs) if (empty(p.a)) { p.a = aGlobalID(); change = true; } if (change && isMechAuthed()) { S newText = joinWithEmptyLines(map(withIDs, func(PairS p) -> S { prependGlobalIDInNewLineAndIndent(p.a, p.b) })); editMechList(listName, newText); } ret withIDs; }