diff --git a/boot/boot.js b/boot/boot.js index 9687d5fb4..8d2d877c1 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -397,12 +397,20 @@ $tw.utils.registerFileType = function(type,encoding,extension,options) { $tw.config.contentTypeInfo[type] = {encoding: encoding, extension: extension, flags: options.flags || [], deserializerType: options.deserializerType || type}; }; +/* +Given an extension, always access the $tw.config.fileExtensionInfo +using a lowercase extension only. +*/ +$tw.utils.getFileExtensionInfo = function(ext) { + return ext ? $tw.config.fileExtensionInfo[ext.toLowerCase()] : null; +} + /* Given an extension, get the correct encoding for that file. defaults to utf8 */ $tw.utils.getTypeEncoding = function(ext) { - var extensionInfo = $tw.config.fileExtensionInfo[ext], + var extensionInfo = $tw.util.getFileExtensionInfo(ext), type = extensionInfo ? extensionInfo.type : null, typeInfo = type ? $tw.config.contentTypeInfo[type] : null; return typeInfo ? typeInfo.encoding : "utf8"; @@ -1137,9 +1145,9 @@ $tw.Wiki.prototype.deserializeTiddlers = function(type,text,srcFields) { srcFields = srcFields || Object.create(null); var deserializer = $tw.Wiki.tiddlerDeserializerModules[type], fields = Object.create(null); - if(!deserializer && $tw.config.fileExtensionInfo[type]) { + if(!deserializer && $tw.utils.getFileExtensionInfo(type)) { // If we didn't find the serializer, try converting it from an extension to a content type - type = $tw.config.fileExtensionInfo[type].type; + type = $tw.utils.getFileExtensionInfo(type).type; deserializer = $tw.Wiki.tiddlerDeserializerModules[type]; } if(!deserializer && $tw.config.contentTypeInfo[type]) { @@ -1386,7 +1394,7 @@ Load the tiddlers contained in a particular file (and optionally extract fields */ $tw.loadTiddlersFromFile = function(filepath,fields) { var ext = path.extname(filepath), - extensionInfo = $tw.config.fileExtensionInfo[ext], + extensionInfo = $tw.utils.getFileExtensionInfo(ext), type = extensionInfo ? extensionInfo.type : null, typeInfo = type ? $tw.config.contentTypeInfo[type] : null, data = fs.readFileSync(filepath,typeInfo ? typeInfo.encoding : "utf8"), diff --git a/core/language/en-GB/ControlPanel.multids b/core/language/en-GB/ControlPanel.multids index 8fbaf59cc..6c8d989fa 100644 --- a/core/language/en-GB/ControlPanel.multids +++ b/core/language/en-GB/ControlPanel.multids @@ -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://.tiddlyspot.com/store.cgi` and can be changed to use a custom server address// +Saving/TiddlySpot/Hint: //The server URL defaults to `http://.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 diff --git a/core/modules/macros/resolvepath.js b/core/modules/macros/resolvepath.js new file mode 100644 index 000000000..d84d87563 --- /dev/null +++ b/core/modules/macros/resolvepath.js @@ -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); +}; + +})(); diff --git a/core/modules/widgets/widget.js b/core/modules/widgets/widget.js index 2c09641b0..9db3ceba8 100755 --- a/core/modules/widgets/widget.js +++ b/core/modules/widgets/widget.js @@ -476,15 +476,25 @@ Widget.prototype.removeChildDomNodes = function() { }; /* -Invoke any action widgets that are immediate children of this widget +Invoke any action widgets that are descendants of this widget. */ Widget.prototype.invokeActions = function(event) { + return this.invokeActionCall(this, event); +}; + +/* +Recursively search through descendants, invoking all actions encountered. +*/ +Widget.prototype.invokeActionCall = function(here, event) { var handled = false; - for(var t=0; t <$set name="userName" value={{$:/UploadName}}> ->><$macrocall $name="backupURL" $type="text/plain" $output="text/plain"/> +<$reveal type="match" state="$:/UploadURL" text=""> +<> + +<$reveal type="nomatch" state="$:/UploadURL" text=""> +<$macrocall $name=resolvePath source={{$:/UploadBackupDir}} root={{$:/UploadURL}}>> + \end @@ -28,5 +33,4 @@ http://$(userName)$.tiddlyspot.com/backup/ |<> |<$edit-text tiddler="$:/UploadDir" default="." tag="input"/> | |<> |<$edit-text tiddler="$:/UploadBackupDir" default="." tag="input"/> | -<> - +<> \ No newline at end of file diff --git a/editions/fr-FR/tiddlers/TableOfContents.tid b/editions/fr-FR/tiddlers/TableOfContents.tid index 097024ec0..1b622d802 100644 --- a/editions/fr-FR/tiddlers/TableOfContents.tid +++ b/editions/fr-FR/tiddlers/TableOfContents.tid @@ -1,6 +1,6 @@ caption: {{$:/language/SideBar/Contents/Caption}} created: 20140809114010378 -list: HelloThere [[Working with TiddlyWiki]] Learning [[Customise TiddlyWiki]] Features Languages Editions Plugins [[TiddlyWiki Configurations]] Reference Community About +list: HelloThere [[Working with TiddlyWiki]] Learning [[Customise TiddlyWiki]] Features Languages Editions Plugins Reference Community About list-after: $:/core/ui/SideBar/Open modified: 20141203120652586 tags: $:/tags/SideBar diff --git a/editions/fr-FR/tiddlers/TiddlyWiki Configurations.tid b/editions/fr-FR/tiddlers/TiddlyWiki Configurations.tid deleted file mode 100644 index 494211404..000000000 --- a/editions/fr-FR/tiddlers/TiddlyWiki Configurations.tid +++ /dev/null @@ -1,7 +0,0 @@ -created: 20140904101900000 -modified: 20141115215018256 -tags: TableOfContents -title: TiddlyWiki Configurations -fr-title: Configurations de TiddlyWiki -type: text/vnd.tiddlywiki - diff --git a/editions/fr-FR/tiddlers/TiddlyWiki on Node.js.tid b/editions/fr-FR/tiddlers/TiddlyWiki on Node.js.tid index 0502c5b63..37bc2fafc 100644 --- a/editions/fr-FR/tiddlers/TiddlyWiki on Node.js.tid +++ b/editions/fr-FR/tiddlers/TiddlyWiki on Node.js.tid @@ -1,7 +1,7 @@ created: 20131129094353704 fr-title: TiddlyWiki sur Node.js modified: 20141203153032034 -tags: [[TiddlyWiki Configurations]] +tags: [[Editions]] title: TiddlyWiki on Node.js type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/TableOfContents.tid b/editions/tw5.com/tiddlers/TableOfContents.tid index 8d0f5360c..db0a2f22f 100644 --- a/editions/tw5.com/tiddlers/TableOfContents.tid +++ b/editions/tw5.com/tiddlers/TableOfContents.tid @@ -1,6 +1,6 @@ caption: {{$:/language/SideBar/Contents/Caption}} created: 20140809114010378 -list: [[HelloThere]] [[Working with TiddlyWiki]] [[Learning]] [[Customise TiddlyWiki]] [[Features]] [[Languages]] [[Editions]] [[Plugins]] [[TiddlyWiki Configurations]] [[Reference]] [[Community]] [[About]] +list: [[HelloThere]] [[Working with TiddlyWiki]] [[Learning]] [[Customise TiddlyWiki]] [[Features]] [[Languages]] [[Editions]] [[Plugins]] [[Reference]] [[Community]] [[About]] list-after: $:/core/ui/SideBar/Open modified: 20140912145302498 tags: $:/tags/SideBar diff --git a/editions/tw5.com/tiddlers/TiddlyWiki Configurations.tid b/editions/tw5.com/tiddlers/TiddlyWiki Configurations.tid deleted file mode 100644 index 89de2b63b..000000000 --- a/editions/tw5.com/tiddlers/TiddlyWiki Configurations.tid +++ /dev/null @@ -1,7 +0,0 @@ -created: 20140904101900000 -modified: 20140916131606392 -tags: TableOfContents -title: TiddlyWiki Configurations -type: text/vnd.tiddlywiki - -<> diff --git a/editions/tw5.com/tiddlers/concepts/AbsoluteOperators.tid b/editions/tw5.com/tiddlers/concepts/AbsoluteOperators.tid deleted file mode 100644 index b6736293b..000000000 --- a/editions/tw5.com/tiddlers/concepts/AbsoluteOperators.tid +++ /dev/null @@ -1,13 +0,0 @@ -created: 20150117204109000 -modified: 20150124185709000 -tags: Concepts -title: Absolute Operators -type: text/vnd.tiddlywiki - -The output of a [[filter|Filters]] step depends on its [[operator|Filter Operators]]: - -* Most operators perform <<.def relative>> to their input. They examine each input title in turn and filter out any that don't match. Such steps narrow down the output of a run. - -* <<.def Absolute>> operators ignore their input and generate an independent output instead. - -A good example of an absolute operator is <<.olink title>>. The output of `[title[A]title[B]]` is just <<.tid B>>. But the <<.olink field>> operator is relative, so `[title[A]field:title[B]` outputs nothing at all. diff --git a/editions/tw5.com/tiddlers/concepts/SelectionConstructors.tid b/editions/tw5.com/tiddlers/concepts/SelectionConstructors.tid new file mode 100644 index 000000000..ad8199734 --- /dev/null +++ b/editions/tw5.com/tiddlers/concepts/SelectionConstructors.tid @@ -0,0 +1,13 @@ +created: 20150117204109000 +modified: 20150129133830000 +tags: Concepts +title: Selection Constructors +type: text/vnd.tiddlywiki + +The output of a [[filter|Filters]] step depends on its [[operator|Filter Operators]]: + +* Most operators derive their output from their input. For example, many of them output a subset of their input, and thus truly live up to the name of <<.word filters>>, narrowing down the overall output of the containing [[run|Filter Run]]. These operators are called <<.def "selection modifiers">>. + +* A few operators ignore their input and generate an independent output instead. These are called <<.def "selection constructors">>: they construct an entirely new [[selection|Title Selection]]. + +A good example of a constructor is <<.olink title>>. The output of `[title[A]title[B]]` is just <<.tid B>>. But the <<.olink field>> operator is a modifier, so `[title[A]field:title[B]` outputs nothing at all. diff --git a/editions/tw5.com/tiddlers/definitions/TiddlyDesktop.tid b/editions/tw5.com/tiddlers/definitions/TiddlyDesktop.tid index a0bebca23..f5f9bd7f4 100644 --- a/editions/tw5.com/tiddlers/definitions/TiddlyDesktop.tid +++ b/editions/tw5.com/tiddlers/definitions/TiddlyDesktop.tid @@ -1,6 +1,6 @@ created: 20140126125259638 modified: 20140916131440645 -tags: Definitions Features Saving +tags: Definitions Features Saving Editions title: TiddlyDesktop type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/filters/FilterOperators.tid b/editions/tw5.com/tiddlers/filters/FilterOperators.tid index 80b3755ab..8ad03c34c 100644 --- a/editions/tw5.com/tiddlers/filters/FilterOperators.tid +++ b/editions/tw5.com/tiddlers/filters/FilterOperators.tid @@ -1,5 +1,5 @@ created: 20140410103123179 -modified: 20150124200331000 +modified: 20150129133657000 tags: Concepts Filters title: Filter Operators type: text/vnd.tiddlywiki @@ -39,4 +39,4 @@ The following table lists all the core operators. The commonest ones are checkma A typical step is written as `[operator[parameter]]`, although not all of the operators need a [[parameter|Filter Parameter]]. -Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few are [[absolute|Absolute Operators]]. For the exact rules, see [[Filter Syntax]]. +Most steps process the [[selection of titles|Title Selection]] that are supplied as their input, but a few [[construct an entirely new selection|Selection Constructors]] instead. For the exact rules, see [[Filter Syntax]]. diff --git a/editions/tw5.com/tiddlers/filters/all.tid b/editions/tw5.com/tiddlers/filters/all.tid index 39e250be7..69c0913a5 100644 --- a/editions/tw5.com/tiddlers/filters/all.tid +++ b/editions/tw5.com/tiddlers/filters/all.tid @@ -1,6 +1,6 @@ created: 20140410103123179 -modified: 20150124200847000 -tags: [[Filter Operators]] [[Common Operators]] [[Absolute Operators]] +modified: 20150129133636000 +tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] title: all Operator type: text/vnd.tiddlywiki caption: all diff --git a/editions/tw5.com/tiddlers/filters/commands.tid b/editions/tw5.com/tiddlers/filters/commands.tid index de6b2abe0..854fe89d7 100644 --- a/editions/tw5.com/tiddlers/filters/commands.tid +++ b/editions/tw5.com/tiddlers/filters/commands.tid @@ -1,6 +1,6 @@ created: 20140410103123179 -modified: 20150124155303000 -tags: [[Filter Operators]] [[Special Operators]] [[Absolute Operators]] +modified: 20150129133643000 +tags: [[Filter Operators]] [[Special Operators]] [[Selection Constructors]] title: commands Operator type: text/vnd.tiddlywiki caption: commands diff --git a/editions/tw5.com/tiddlers/filters/editions.tid b/editions/tw5.com/tiddlers/filters/editions.tid index f7ce355e6..4c2ee9e4d 100644 --- a/editions/tw5.com/tiddlers/filters/editions.tid +++ b/editions/tw5.com/tiddlers/filters/editions.tid @@ -1,6 +1,6 @@ created: 20150111145738451 -modified: 20150124150912000 -tags: [[Filter Operators]] [[Special Operators]] [[Absolute Operators]] +modified: 20150129133647000 +tags: [[Filter Operators]] [[Special Operators]] [[Selection Constructors]] title: editions Operator type: text/vnd.tiddlywiki caption: editions diff --git a/editions/tw5.com/tiddlers/filters/list.tid b/editions/tw5.com/tiddlers/filters/list.tid index fcdb7581e..49f791021 100644 --- a/editions/tw5.com/tiddlers/filters/list.tid +++ b/editions/tw5.com/tiddlers/filters/list.tid @@ -1,6 +1,6 @@ created: 20140410103123179 -modified: 20150124203324000 -tags: [[Filter Operators]] [[Field Operators]] [[Absolute Operators]] [[Negatable Operators]] +modified: 20150129133705000 +tags: [[Filter Operators]] [[Field Operators]] [[Selection Constructors]] [[Negatable Operators]] title: list Operator type: text/vnd.tiddlywiki caption: list diff --git a/editions/tw5.com/tiddlers/filters/moduletypes.tid b/editions/tw5.com/tiddlers/filters/moduletypes.tid index d47d1580d..e931d37ec 100644 --- a/editions/tw5.com/tiddlers/filters/moduletypes.tid +++ b/editions/tw5.com/tiddlers/filters/moduletypes.tid @@ -1,6 +1,6 @@ created: 20140410103123179 -modified: 20150124170640000 -tags: [[Filter Operators]] [[Special Operators]] [[Absolute Operators]] +modified: 20150129133709000 +tags: [[Filter Operators]] [[Special Operators]] [[Selection Constructors]] title: moduletypes Operator type: text/vnd.tiddlywiki caption: moduletypes diff --git a/editions/tw5.com/tiddlers/filters/syntax/FilterRun.tid b/editions/tw5.com/tiddlers/filters/syntax/FilterRun.tid index ecc5e381b..640891906 100644 --- a/editions/tw5.com/tiddlers/filters/syntax/FilterRun.tid +++ b/editions/tw5.com/tiddlers/filters/syntax/FilterRun.tid @@ -1,5 +1,5 @@ created: 20150124182117000 -modified: 20150124190233000 +modified: 20150129133716000 tags: [[Filter Syntax]] title: Filter Run type: text/vnd.tiddlywiki @@ -19,7 +19,7 @@ A <<.def run>> consists of [[steps|Filter Step]], and it outputs a [[selection|T The steps are processed from left to right. The input to the first step is same as the input to the run. For each subsequent step, the input is the output of the previous step. -{{Absolute Operators}} +{{Selection Constructors}} The lower three options in the diagram match syntax like `HelloThere`, `"HelloThere"`, `'HelloThere'` and `"Filter Operators"`. They are short for `[title[...]]`. diff --git a/editions/tw5.com/tiddlers/filters/title.tid b/editions/tw5.com/tiddlers/filters/title.tid index 5dda38e29..53966239f 100644 --- a/editions/tw5.com/tiddlers/filters/title.tid +++ b/editions/tw5.com/tiddlers/filters/title.tid @@ -1,6 +1,6 @@ created: 20140410103123179 -modified: 20150124192051000 -tags: [[Filter Operators]] [[Common Operators]] [[Absolute Operators]] [[Negatable Operators]] +modified: 20150129133732000 +tags: [[Filter Operators]] [[Common Operators]] [[Selection Constructors]] [[Negatable Operators]] title: title Operator type: text/vnd.tiddlywiki caption: title @@ -17,6 +17,6 @@ negationOutput="the input, but with tiddler <<.place t>> filtered out if it exis `[title[An Example]]` can be shortened to `[[An Example]]`, because <<.op title>> is the default filter operator. -<<.op title>> is an [[absolute operator|Absolute Operators]] (except in the form `!title`), but <<.olink2 "field:title" field>> is relative. +<<.op title>> is a [[constructor|Selection Constructors]] (except in the form `!title`), but <<.olink2 "field:title" field>> is a [[modifier|Selection Constructors]]. <<.operator-examples "title">> diff --git a/editions/tw5.com/tiddlers/gettingstarted/GettingStarted.tid b/editions/tw5.com/tiddlers/gettingstarted/GettingStarted.tid index 1d95d35cb..70ef3b03f 100644 --- a/editions/tw5.com/tiddlers/gettingstarted/GettingStarted.tid +++ b/editions/tw5.com/tiddlers/gettingstarted/GettingStarted.tid @@ -1,5 +1,5 @@ created: 20131129090249275 -modified: 20140916140523223 +modified: 20150128172523223 tags: [[Working with TiddlyWiki]] title: GettingStarted type: text/vnd.tiddlywiki @@ -13,6 +13,10 @@ Instructions for getting started using TiddlyWiki on the different platforms and <$macrocall $name="tabs" state="$:/state/tabs/platform" tabsList="[prefix[GettingStarted - ]]" default=<> class="tc-vertical"/> +Troubleshooting: + +* Don't attempt to use the browser ''File''/''Save'' menu option to save changes (it doesn't work) + See also: * [[Encryption]] explains how to use TiddlyWiki's built-in encryption to protect your content with a password diff --git a/editions/tw5.com/tiddlers/macros/ResolvePath.tid b/editions/tw5.com/tiddlers/macros/ResolvePath.tid new file mode 100644 index 000000000..be0a2951f --- /dev/null +++ b/editions/tw5.com/tiddlers/macros/ResolvePath.tid @@ -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: + +``` +<> +``` + +<> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/nodejs/TiddlyWiki on Node.js.tid b/editions/tw5.com/tiddlers/nodejs/TiddlyWiki on Node.js.tid index b85073d72..d39526e21 100644 --- a/editions/tw5.com/tiddlers/nodejs/TiddlyWiki on Node.js.tid +++ b/editions/tw5.com/tiddlers/nodejs/TiddlyWiki on Node.js.tid @@ -1,6 +1,6 @@ created: 20131129094353704 modified: 20140916131624754 -tags: [[TiddlyWiki Configurations]] +tags: [[Editions]] title: TiddlyWiki on Node.js type: text/vnd.tiddlywiki diff --git a/editions/tw5.com/tiddlers/widgets/ActionWidgets.tid b/editions/tw5.com/tiddlers/widgets/ActionWidgets.tid index f1f9de2ca..5a6301b14 100644 --- a/editions/tw5.com/tiddlers/widgets/ActionWidgets.tid +++ b/editions/tw5.com/tiddlers/widgets/ActionWidgets.tid @@ -1,12 +1,12 @@ created: 20141008134425548 -modified: 20141008144957192 +modified: 20150128163157192 tags: Widgets title: ActionWidgets type: text/vnd.tiddlywiki Action widgets are a special type of widget that perform an action such as sending a message, navigating to a tiddler, or changing the value of a tiddler. They are used in association with other widgets that trigger those actions (for example, the ButtonWidget). -Action widgets are invisible. They must be the immediate children of their parent triggering widget. The actions are performed in sequence. For example, here is a button that triggers two actions of sending different messages: +Action widgets are invisible. They need not be immediate children of their triggering widget, but they must be descendents of it. The actions are performed in sequence. For example, here is a button that triggers two actions of sending different messages: ``` <$button> @@ -16,8 +16,6 @@ Click me! ``` -Take care not to accidentally introduce an extra line break after the opening tag of the button widget. Doing so will trigger the WikiText parser to wrap the action widgets in a paragraph element. This means that the action widgets will not be triggered as they are no longer immediate children of the triggering widget. - The following action widgets are provided: <> diff --git a/plugins/tiddlywiki/classictools/modules/recipe.js b/plugins/tiddlywiki/classictools/modules/recipe.js index 836356ca0..5b3a0b019 100644 --- a/plugins/tiddlywiki/classictools/modules/recipe.js +++ b/plugins/tiddlywiki/classictools/modules/recipe.js @@ -38,7 +38,7 @@ exports["text/vnd.tiddlywiki2-recipe"] = function(text,fields) { }, loadTiddlersFromFile = function(sourcePath,prefix) { var ext = path.extname(sourcePath), - extensionInfo = $tw.config.fileExtensionInfo[ext], + extensionInfo = $tw.utils.getFileExtensionInfo(ext), typeInfo = extensionInfo ? $tw.config.contentTypeInfo[extensionInfo.type] : null, data = fs.readFileSync(sourcePath,typeInfo ? typeInfo.encoding : "utf8"), fields = {title: sourcePath},