Last active
December 20, 2015 15:09
-
-
Save bsoist/6152427 to your computer and use it in GitHub Desktop.
One of my verbs for converting to TaskPaper format. See http://4a.bsoi.st/ for more information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
One of my verbs for use converting | |
OPML to TaskPaper | |
See http://4a.bsoi.st/ for more information | |
*/ | |
taskThis: function(filename) { | |
var bsoist_ext = '.todo'; | |
if (! filename ) { | |
filename = file.getCurrentFilePath().split('.')[0] + bsoist_ext; | |
} | |
var taskdata = ""; | |
var bsoist_prefix = ""; | |
var bsoist_suffix = ":\r\n"; | |
op.visitSubs( | |
function(headline,levelnum) { | |
taskdata += bsoist_prefix + headline.getLineText() + bsoist_suffix; | |
}, | |
function(levelnum) { | |
bsoist_prefix = "- "; | |
bsoist_suffix = "\r\n"; | |
}, | |
function(levelnum) { | |
bsoist_prefix = ""; | |
bsoist_suffix = ":\r\n"; | |
} | |
); | |
file.writeWholeFile(filename,taskdata); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment