mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-24 17:10:29 +00:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
a3d51ef7c3
16
boot/boot.js
16
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"),
|
||||
|
@ -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
|
||||
|
29
core/modules/macros/resolvepath.js
Normal file
29
core/modules/macros/resolvepath.js
Normal file
@ -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);
|
||||
};
|
||||
|
||||
})();
|
@ -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<this.children.length; t++) {
|
||||
var child = this.children[t];
|
||||
for(var t=0; t<here.children.length; t++) {
|
||||
var child = here.children[t];
|
||||
if(child.invokeAction && child.invokeAction(this,event)) {
|
||||
handled = true;
|
||||
}
|
||||
if(this.invokeActionCall(child, event)) {
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
return handled;
|
||||
};
|
||||
|
@ -761,8 +761,8 @@ exports.old_parseText = function(type,text,options) {
|
||||
options = options || {};
|
||||
// Select a parser
|
||||
var Parser = $tw.Wiki.parsers[type];
|
||||
if(!Parser && $tw.config.fileExtensionInfo[type]) {
|
||||
Parser = $tw.Wiki.parsers[$tw.config.fileExtensionInfo[type].type];
|
||||
if(!Parser && $tw.utils.getFileExtensionInfo(type)) {
|
||||
Parser = $tw.Wiki.parsers[$tw.utils.getFileExtensionInfo(type).type];
|
||||
}
|
||||
if(!Parser) {
|
||||
Parser = $tw.Wiki.parsers[options.defaultType || "text/vnd.tiddlywiki"];
|
||||
@ -1104,7 +1104,7 @@ exports.readFile = function(file,callback) {
|
||||
if(type === "" || !type) {
|
||||
var dotPos = file.name.lastIndexOf(".");
|
||||
if(dotPos !== -1) {
|
||||
var fileExtensionInfo = $tw.config.fileExtensionInfo[file.name.substr(dotPos)];
|
||||
var fileExtensionInfo = $tw.utils.getFileExtensionInfo(file.name.substr(dotPos));
|
||||
if(fileExtensionInfo) {
|
||||
type = fileExtensionInfo.type;
|
||||
}
|
||||
|
@ -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>>
|
@ -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
|
||||
|
@ -1,7 +0,0 @@
|
||||
created: 20140904101900000
|
||||
modified: 20141115215018256
|
||||
tags: TableOfContents
|
||||
title: TiddlyWiki Configurations
|
||||
fr-title: Configurations de TiddlyWiki
|
||||
type: text/vnd.tiddlywiki
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
@ -1,7 +0,0 @@
|
||||
created: 20140904101900000
|
||||
modified: 20140916131606392
|
||||
tags: TableOfContents
|
||||
title: TiddlyWiki Configurations
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<list-links "[tag[TiddlyWiki Configurations]]">>
|
@ -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.
|
13
editions/tw5.com/tiddlers/concepts/SelectionConstructors.tid
Normal file
13
editions/tw5.com/tiddlers/concepts/SelectionConstructors.tid
Normal file
@ -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.
|
@ -1,6 +1,6 @@
|
||||
created: 20140126125259638
|
||||
modified: 20140916131440645
|
||||
tags: Definitions Features Saving
|
||||
tags: Definitions Features Saving Editions
|
||||
title: TiddlyDesktop
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -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]].
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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[...]]`.
|
||||
|
||||
|
@ -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">>
|
||||
|
@ -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=<<default-platform>> class="tc-vertical"/>
|
||||
</$set>
|
||||
|
||||
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
|
||||
|
23
editions/tw5.com/tiddlers/macros/ResolvePath.tid
Normal file
23
editions/tw5.com/tiddlers/macros/ResolvePath.tid
Normal file
@ -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">>
|
@ -1,6 +1,6 @@
|
||||
created: 20131129094353704
|
||||
modified: 20140916131624754
|
||||
tags: [[TiddlyWiki Configurations]]
|
||||
tags: [[Editions]]
|
||||
title: TiddlyWiki on Node.js
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
@ -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!
|
||||
</$button>
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
<<list-links "[tag[ActionWidgets]]">>
|
||||
|
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user