Thanks to my weird way of using the new Reminders integration, the Preference box for stripping extra tags when archiving done tasks doesn’t work for me. I have a Javascript code that I use to add tags for @done @due(time i completed the task) so when I import the task into reminders, it’s marked with the time I completed the task.
What line of code would I add to strip the item of all tags except for @done and @due ? (Alternately, would it be possible to have a preference option to strip tags when importing to Reminders?)
The code I’m using
function TaskPaperContextScript(editor, options) {
function setAttribute(editor, items, name, value) {
var outline = editor.outline;
var selection = editor.selection;
outline.groupUndoAndChanges(function() {
items.forEach(function (each) {
each.setAttribute(name, value);
});
});
editor.moveSelectionToItems(selection);
}
function toggleAttribute(editor, items, name, value) {
items.forEach(function (each) {
if (each.hasAttribute(name)) {
value = null; // If any item has the attribute, then remove it from all.
}
});
setAttribute(editor, items, name, value);
}
toggleAttribute(editor, editor.selection.selectedItems, 'data-due', DateTime.format('this minute'));
toggleAttribute(editor, editor.selection.selectedItems, 'data-done','');
}
Application("TaskPaper").documents[0].evaluate({
script: TaskPaperContextScript.toString()
});
Thanks!