taskpaper-parser
taskpaper-parser is simple TaskPaper file format parser.
Installation
npm install taskpaper-parser
Examples
File parsing
This will parse taskpaper file, and log parsed output as JSON.
var fs = ;var Parser = Parser; var taskPaperFile = __dirname + "/todo.taskpaper"; fs;
ToDo creation
This will create taskpaper project, and serialize it into a string.
var TaskPaperParser = ; var Root = TaskPaperParserRoot;var Project = TaskPaperParserProject;var Task = TaskPaperParserTask;var Tag = TaskPaperParserTag;var Comment = TaskPaperParserComment; // root holds everything in the filevar root = ; // create some projectsvar projectMain = "main thing to do";var projectSub = "other things"; // create some tasksvar task1 = "task 1";var task2 = "task 2"; // and a tagvar important = "priority" 1; // add tag to tasktask1; // comment on one of the taskvar commentFor2 = "don't forget this!"; // add comment to tasktask2; // add tasks to projects;projectMain;projectSub; // add projectSub as suproject of projectMainprojectMain; // add everything to rootroot; // how will this look like a taskpaper file?console;
API
Root
Root()
holds all the data about taskpaper file; methods:
addChild(child)
- used for build tree structure, root can hold projects, tasks and commentsserialize()
- serializes whole tree into proper string
Project
Project(name)
represents TaskPaper project; methods:
addChild(child)
- used for build tree structure, project can hold subprojects, tasks, and commentsserialize()
- serializes project tree into proper string
Task
Task(name, tags)
represents TaskPaper task (tags are optional); methods:
addChild(child)
- used for building tree structure, task can hold comments as childrenaddTag(tag)
- adds tag to taskserialize()
- serializes task tree (including tags and comments) into proper string
Tag
Tag(name, value)
represents TaskPaper task tag (value is optional); methods:
serialize()
- serializes tag into proper string
Comment
Comment(name)
represents TaskPaper comment; methods:
serialize()
- serializes comment into proper string
License
MIT