As discussed in a thread on [tw] this morning, here's a tiny bit of code
to automatically convert Windows file paths (e.g. "C:\MyFile.txt") as
well as network paths (e.g. "\\MyServer\MyFile.txt") to "Web-compatible"
paths in PrettyLinks:
In config.formatters, there's a section "name: 'prettyLink'".
Below the following lines ...
// Pretty bracketted link
var link = lookaheadMatch[3];
... I've added (in the actual source code, as I'm not sure how to
hijack/overwrite this):
// check for Windows file path (e.g. "C:\")
if(link.search(/^\w:\\/) != -1)
link = "file:///" + link;
// check for network path (e.g. "\\MyServer")
if(link.search(/^\\\\/) != -1)
link = "file:///" + link;
(N.B.: The regular expressions used here are not heavily tested, so this
*might* be incomplete or even buggy.)
Could this be considered for inclusion in the core?
While I don't need this myself, I guess many people do use local file
paths in their TiddlyWikis.
--F.
Please note that the regular expressions used here are not heavily
tested, so this *might* be incomplete or even buggy.
-- F.