TaskPaper for iOS

Nothing in particular.

I switched to iCloud, as I wanted to minimize how many utilities I run on my Mac, and I had a few conflicted copy issues with Dropbox.

just use the Editorial app, it’s insanely good and 100% covers my TaskPaper needs. It’s a godsend.

I am looking into moving away from dropbox so 1writer seems very interesting.
Is there syntax highlighting for task paper?
I it ok for you to share your setup. (I’m unfortunately not very good at scripting…)

There is no TaskPaper syntax highlighting in 1Writer.

I’m ahoy to share any of the scripts that I have written. If you see an interesting one in the screenshot above, tell me the name and I will post the code here.

That is very kind of you.
If it’s not too much trouble can you please post:
List @Today, +Task, Prepend dashes, Select current line and Move Up?

@Today:

var content,
    lines,
    headings,
    lengths,
    ranges,
    linesLength,
    i;

content = editor.getText();
lines = content.split('\n');
linesLength = lines.length;
lengths = 0;
headings = Array();
ranges = Array();

for(i = 0; i < linesLength; i++) {
    if(lines[i].match(/@today+\s?.*/)) {
        headings.push(lines[i]);
        ranges.push(lengths);
    }
    lengths += lines[i].length + 1; // +1 because the line breaks count;
}

if (headings.length > 0) {
    ui.list('Jump to Section', headings, false, function(a,b) {
        if (b === undefined) {
            ui.hudError("Ok");
        } else {
            editor.setSelectedRange(ranges[b])
        }
    });
} else {
    ui.hudError("There's nothing tagged");
}

+Task:

editor.replaceTextInRange(0, 0, '\n');
editor.replaceTextInRange(0, 0, '\t- ');

Prepend dashes:

const text = editor.getSelectedText();
var lines = text.split("\n");
lines = lines.map(function(l) { 
    return '	- '+l;
});
editor.replaceSelection(lines.join("\n"));

Thank you Jim. very kind.
Now I’ll see if this works for me. :slight_smile:

1 Like

Select current line:

// based on shirose_jp scripts

var line_range = editor.getSelectedLineRange();

var eol = line_range[0] + line_range[1];
if ( editor.getTextInRange( eol - 1, 1 ) === '\n' ) {
  eol = eol - 1;
}

editor.setSelectedRange( line_range[0], eol - line_range[0] );

Move Up:

range = editor.getSelectedLineRange();
line = editor.getTextInRange(range[0], range[1]);

if (range[0] > 0) {
	editor.replaceTextInRange(range[0] - 1, range[1], "");
	range = editor.getSelectedLineRange();
	editor.replaceTextInRange(range[0], 0, line + "\n");
	editor.setSelectedRange(range[0], range[0]);
}