Details of x-foldingtext:// and x-taskpaper:// url schemes


#1

Does the documentation describe the x-foldingtext:// and x-taskpaper:// url schemes ?

I know we have:

x-foldingtext://sdk/docs

and

x-foldingtext://sdk/runtime/editor

but I seem to have forgotten the syntax for clicking to applying a nodepath query to the open document.

EDIT: Ah … I had forgotten ⌘’ Run Command > link node path


URL Scheme?
#2

(In particular I wondered whether the scheme includes, at the moment, a way of jumping to a particular line number or character offset from the start of the document - something like ?location= or ?linenum= )


#3

I started typing out a question/suggestion regarding a URL scheme for TaskPaper but Discourse scooped me by suggesting this existing thread.

May I ask, does x-taskpaper links really exist :sunglasses: and if yes, how?

It would be fantastic to be able to link to particular entries in a TaskPaper file.


#4

I’ll aim to tidy an informal tp3doc:// script for TaskPaper 3 this weekend


#5

Fantastic, looking forward, and thanks!


#6

I am a newbie here. thanks to Rob T for all his great scripts.
Not sure about this error. can get folding text selection url to work but the tp3doc:/// does not work.

the url handler registration is ok and able to open the file correctly but creating a link to a section of the text does not work :((

can you please help
thanks

Error

"ReferenceError: Can’t find variable: require
evaluateScript

property pTitle : "Copy TP3 selection as tp3doc:// url"
property pVer : "0.02"
property pAuthor : "Rob Trew"
property pDescription : "
Copies the selected text in TaskPaper as an tp3doc:// URL
linking back to the current document, filter state,
and (if still identifiable by nodepath, search string or line number), selection.

(Uses the tp3doc:// url-scheme - registered and handled by the OpenTP3DocAtLine.app applescript app bundle)

"

property pstrJS : "
function(editor, options) {
var libNodePath = require(‘ft/core/nodepath’).NodePath,
tree=editor.tree(),
rngSeln = editor.selectedRange(),
oFirstNode = rngSeln.startNode,
dctStartOffset = rngSeln.startLineCh(),
dctEndOffset = rngSeln.endLineCh(),
strNodePath = editor.nodePath().toString(),
strSelnPath = libNodePath.calculateMinNodePath(oFirstNode),
strDocPath=options.docpath,
strURL=’’, strText,
strEncoded,
lngLine = dctStartOffset.line,
lngStartOffset=dctStartOffset.ch,
lngEndOffset=-1,
lnPosn;

if (dctEndOffset.line === lngLine) {
	lngEndOffset = dctEndOffset.ch;
}
strURL='tp3doc://' + strDocPath;
if (strNodePath !== '///*') {
	strURL += ('?nodepath=' + strNodePath);
}
if (strSelnPath.indexOf('@id') < 0) {
	strURL += ('?selnpath=' + strSelnPath);
} 

strText = oFirstNode.text();
if (strText.length > 2) {
	strURL += ('?find=' + strText);
}
if (lngLine) {
	strURL += ('?line=' + lngLine.toString());
}
if (lngStartOffset) {
	if (lngEndOffset) {
		if (lngStartOffset !== lngEndOffset) {
			strURL += ('?startoffset=' + lngStartOffset.toString());
			strURL += ('?endoffset=' + lngEndOffset.toString());
		}
	}
}
return encodeURI(strURL);

}
"

on run
set varResult to missing value
tell application "TaskPaper"
set lstDocs to documents
if lstDocs ≠ {} then
set oDoc to item 1 of lstDocs
tell oDoc
set strPath to POSIX path of ((file of it) as alias)
set strURL to (evaluate script pstrJS with options {docpath:strPath})
set the clipboard to strURL
display notification "tp3doc:// link copied …"
end tell
end if
end tell
return strURL
end run


#7

That version is for a much earlier iteration of TaskPaper development. I’m planning to write a new version for the current TaskPaper 3.

Thanks for the reminder.


#8

ok great thanks. appreciate these great tools.


#9

Any update to this? thanks


#10

Won’t be this week, but I’m hoping to look at it at the weekend.


#11

Great thanks.


#12

trying my luck here :slight_smile:


#13

Thanks – life, or rather its converse, has intervened a couple of times in these weeks. I’ll try again this weekend.


#14

completely understand. thanks!


#15

Any update to have this. it would be great to have a menu for item, copy as hyperlink.
thanks


#16

Yes — very much +1 here.

Specifically I’m looking to “Copy as Link” on a node and be able to post that into a different document.


#17

Any luck in getting this done?


#18

using more and more of TP3 (about to abandon Omnifocus). can we get this working please? thanks
nara


#19

Any chance of getting this working ever?