mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-06-01 02:02:24 +00:00
Merge pull request #1392 from tobibeer/1387-fix-tiddlyspot-backup-url
Add resolvepath macro
This commit is contained in:
@@ -56,7 +56,7 @@ Saving/TiddlySpot/Backups: Backups
|
||||
Saving/TiddlySpot/Description: These settings are only used when saving to http://tiddlyspot.com or a compatible remote server
|
||||
Saving/TiddlySpot/Filename: Upload Filename
|
||||
Saving/TiddlySpot/Heading: ~TiddlySpot
|
||||
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address//
|
||||
Saving/TiddlySpot/Hint: //The server URL defaults to `http://<wikiname>.tiddlyspot.com/store.cgi` and can be changed to use a custom server address, e.g. `http://me.com/store.php`.//
|
||||
Saving/TiddlySpot/Password: Password
|
||||
Saving/TiddlySpot/ServerURL: Server URL
|
||||
Saving/TiddlySpot/UploadDir: Upload Directory
|
||||
|
||||
@@ -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);
|
||||
};
|
||||
|
||||
})();
|
||||
@@ -9,7 +9,12 @@ http://$(userName)$.tiddlyspot.com/backup/
|
||||
\define backupLink()
|
||||
<$reveal type="nomatch" state="$:/UploadName" text="">
|
||||
<$set name="userName" value={{$:/UploadName}}>
|
||||
<a href=<<backupURL>>><$macrocall $name="backupURL" $type="text/plain" $output="text/plain"/></a>
|
||||
<$reveal type="match" state="$:/UploadURL" text="">
|
||||
<<backupURL>>
|
||||
</$reveal>
|
||||
<$reveal type="nomatch" state="$:/UploadURL" text="">
|
||||
<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>>
|
||||
</$reveal>
|
||||
</$set>
|
||||
</$reveal>
|
||||
\end
|
||||
@@ -28,5 +33,4 @@ http://$(userName)$.tiddlyspot.com/backup/
|
||||
|<<lingo TiddlySpot/UploadDir>> |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> |
|
||||
|<<lingo TiddlySpot/BackupDir>> |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> |
|
||||
|
||||
<<lingo TiddlySpot/Hint>>
|
||||
|
||||
<<lingo TiddlySpot/Hint>>
|
||||
Reference in New Issue
Block a user