I’m using doing by Bret Terpstra and anyone using it will know the tags can get messy (if you use autotagging etc), Some tags get placed at the start of the string and sometimes when adding tags with a taskpaper client the tags get added in the middle. So here’s my first contribution, a way to move all tags to the end of the body string. If anyone has a better suggestion I would love to hear about it.
function TaskPaperContextScript(editor, options) {
function doAttribute(editor, item, name) {
var outline = editor.outline;
var selection = editor.selection;
var myvalue = item.getAttribute(name);
outline.groupUndoAndChanges(function () {
item.removeAttribute(name);
item.setAttribute(name, myvalue);
});
editor.moveSelectionToItems(selection);
}
function toggleAttribute(editor, items) {
items.forEach(function (itm) {
itm.attributeNames.forEach(function (myattrib) {
doAttribute(editor, itm, myattrib);
});
});
}
toggleAttribute(editor, editor.selection.selectedItems);
}
Application("TaskPaper").documents[0].evaluate({
script: TaskPaperContextScript.toString()
});