-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1392 from tobibeer/1387-fix-tiddlyspot-backup-url
Add resolvepath macro
- Loading branch information
Showing
4 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*\ | ||
title: $:/core/modules/macros/resolvepath.js | ||
type: application/javascript | ||
module-type: macro | ||
Resolves a relative path for an absolute rootpath. | ||
\*/ | ||
(function(){ | ||
|
||
/*jslint node: true, browser: true */ | ||
/*global $tw: false */ | ||
"use strict"; | ||
|
||
exports.name = "resolvepath"; | ||
|
||
exports.params = [ | ||
{name: "source"}, | ||
{name: "root"} | ||
]; | ||
|
||
/* | ||
Run the macro | ||
*/ | ||
exports.run = function(source, root) { | ||
return $tw.utils.resolvePath(source, root); | ||
}; | ||
|
||
})(); |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
created: 20150203152000000 | ||
modified: 20150203152000000 | ||
title: ResolvePath | ||
type: text/vnd.tiddlywiki | ||
caption: resolvepath | ||
|
||
The ''resolvepath'' macro constructs a url for a relative source path with respect to an absolute root path, trailing filenames being cut-off. | ||
|
||
! Parameters | ||
|
||
|!Position |!Name |!Description |!Default | | ||
|1st |source |the relative path to be appended| | | ||
|2nd |root |the absolute path to be appended to | | | ||
|
||
! Examples | ||
|
||
A trivial example to show how the macro works: | ||
|
||
``` | ||
<<resolvepath "./backup" "http://mysite.com/store.php">> | ||
``` | ||
|
||
<<resolvepath "./backup" "http://mysite.com/store.php">> |