1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-09-01 10:28:03 +00:00
This commit is contained in:
saqimtiaz
2020-11-03 10:17:09 +01:00
6 changed files with 65 additions and 14 deletions

View File

@@ -150,6 +150,11 @@ function openStartupTiddlers(options) {
// Save the story list
$tw.wiki.addTiddler({title: DEFAULT_STORY_TITLE, text: "", list: storyList},$tw.wiki.getModificationFields());
// Update history
var story = new $tw.Story({
wiki: $tw.wiki,
storyTitle: DEFAULT_STORY_TITLE,
historyTitle: DEFAULT_HISTORY_TITLE
});
if(!options.disableHistory) {
// If a target tiddler was specified add it to the history stack
if(target && target !== "") {
@@ -157,9 +162,9 @@ function openStartupTiddlers(options) {
if(target.indexOf("[[") === 0 && target.substr(-2) === "]]") {
target = target.substr(2,target.length - 4);
}
$tw.wiki.addToHistory(target);
story.addToHistory(target);
} else if(storyList.length > 0) {
$tw.wiki.addToHistory(storyList[0]);
story.addToHistory(storyList[0]);
}
}
}

View File

@@ -62,6 +62,11 @@ NavigatorWidget.prototype.execute = function() {
this.historyTitle = this.getAttribute("history");
this.setVariable("tv-story-list",this.storyTitle);
this.setVariable("tv-history-list",this.historyTitle);
this.story = new $tw.Story({
wiki: this.wiki,
storyTitle: this.storyTitle,
historyTitle: this.historyTitle
});
// Construct the child widgets
this.makeChildWidgets();
};
@@ -123,7 +128,7 @@ NavigatorWidget.prototype.replaceFirstTitleInStory = function(storyList,oldTitle
NavigatorWidget.prototype.addToStory = function(title,fromTitle) {
if(this.storyTitle) {
this.wiki.addToStory(title,fromTitle,this.storyTitle,{
this.story.addToStory(title,fromTitle,this.storyTitle,{
openLinkFromInsideRiver: this.getAttribute("openLinkFromInsideRiver","top"),
openLinkFromOutsideRiver: this.getAttribute("openLinkFromOutsideRiver","top")
});
@@ -136,7 +141,7 @@ title: a title string or an array of title strings
fromPageRect: page coordinates of the origin of the navigation
*/
NavigatorWidget.prototype.addToHistory = function(title,fromPageRect) {
this.wiki.addToHistory(title,fromPageRect,this.historyTitle);
this.story.addToHistory(title,fromPageRect,this.historyTitle);
};
/*

View File

@@ -1426,7 +1426,8 @@ historyTitle: title of history tiddler (defaults to $:/HistoryList)
*/
exports.addToHistory = function(title,fromPageRect,historyTitle) {
var story = new $tw.Story({wiki: this, historyTitle: historyTitle});
story.addToHistory(title,fromPageRect);
story.addToHistory(title,fromPageRect);
console.log("$tw.wiki.addToHistory() is deprecated since V5.1.23! Use the this.story.addToHistory() from the story-object!")
};
/*
@@ -1438,7 +1439,8 @@ options: see story.js
*/
exports.addToStory = function(title,fromTitle,storyTitle,options) {
var story = new $tw.Story({wiki: this, storyTitle: storyTitle});
story.addToStory(title,fromTitle,options);
story.addToStory(title,fromTitle,options);
console.log("$tw.wiki.addToStory() is deprecated since V5.1.23! Use the this.story.addToStory() from the story-object!")
};
/*

View File

@@ -0,0 +1,29 @@
caption: enlist-input
created: 20201102215459192
modified: 20201102221854719
op-input: a [[selection of titles|Title Selection]]
op-output: the titles stored as a [[title list|Title List]] in each input title
op-purpose: select titles by interpreting each input title as a [[title list|Title List]]
tags: [[Filter Operators]] [[String Operators]] [[Selection Constructors]]
title: enlist-input Operator
type: text/vnd.tiddlywiki
<<.from-version "5.1.23">>
<<.tip " Compare with [[enlist|enlist Operator]] operator that interprets its operand as a title list">>
```
<$vars days={{{ [[Days of the Week]get[list]] }}}>
{{{ [enlist<days>] }}}
</$vars>
```
is equivalent to:
```
{{{ [[Days of the Week]get[list]enlist-input[]] }}}
```
<<.operator-examples "enlist-input">>

View File

@@ -0,0 +1,8 @@
created: 20201102220519567
modified: 20201102221137200
tags: [[enlist-input Operator]] [[Operator Examples]]
title: enlist-input Operator (Examples)
type: text/vnd.tiddlywiki
<<.operator-example 1 "[[Days of the Week]get[list]enlist-input[]]">>
<<.operator-example 2 "'HelloThere GettingStarted [[Customise TiddlyWiki]]' +[enlist-input[]]">>

View File

@@ -1,5 +1,5 @@
created: 20150124182421000
modified: 20201027185638636
modified: 20201102224444831
tags: [[Filter Syntax]]
title: Filter Expression
type: text/vnd.tiddlywiki
@@ -17,12 +17,13 @@ A <<.def "filter expression">> is the outermost level of the [[filter syntax|Fil
If a run has:
* no prefix, its output titles are [[dominantly appended|Dominant Append]] to the filter's output
* <<.from-version "5.1.20">> the prefix `=`, output titles are appended to the filter's output without de-duplication
* the prefix `=`, output titles are appended to the filter's output without de-duplication. <<.from-version "5.1.20">>
* the prefix `-`, output titles are <<.em removed>> from the filter's output (if such tiddlers exist)
* the prefix `+`, it receives the filter output so far as its input; its output then <<.em "replaces">> all filter output so far and forms the input for the next run
* <<.from-version "5.1.18">> the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored
* <<.from-version "5.1.23">> named prefixes for filter runs are available.
* <<.from-version "5.1.23">> named prefix `:filter`, it receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list.
* the prefix `~`, if the filter output so far is an empty list then the output titles of the run are [[dominantly appended|Dominant Append]] to the filter's output. If the filter output so far is not an empty list then the run is ignored. <<.from-version "5.1.18">>
* named prefixes for filter runs are available. <<.from-version "5.1.23">>
* named prefix `:filter`, it receives the filter output so far as its input. The next run is evaluated for each title of the input, removing every input title for which the output is an empty list. <<.from-version "5.1.23">>
* named prefix `:intersection` replaces all filter output so far with titles that are present in the output of this run, as well as the output from previous runs. Forms the input for the next run. <<.from-version "5.1.23">>
<<.tip "Compare named filter run prefix `:filter` with [[filter Operator]] which applies a subfilter to every input title, removing the titles that return an empty result from the subfilter">>
@@ -31,15 +32,16 @@ In technical / logical terms:
|!Run |!Equivalent named prefix |!Interpretation |!Output |
|`run` |`:or[run]` |de-duplicated union of sets |... OR run |
|`=run` |`:all[run]` |union of sets without de-duplication |... OR run |
|`+run` |`:and[run]` |intersection of sets |... AND run |
|`+run` |`:and[run]` |accumulation of filter steps |... AND run |
|`-run` |`:except[run]` |difference of sets |... AND NOT run |
|`~run` |`:else[run]` |else |... ELSE run |
||`:intersection`|intersection of sets||
The input of a run is normally a list of all the non-[[shadow|ShadowTiddlers]] tiddler titles in the wiki (in no particular order). But the `+` prefix can change this:
|Prefix|Input|h
|`-`, `~`, `=` or none| <$link to="all Operator">`[all[]]`</$link> tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]|
|`+`|the filter output of all previous runs so far|
|`-`, `~`, `=`, `:intersection` or none| <$link to="all Operator">`[all[]]`</$link> tiddler titles, unless otherwise determined by the first [[filter operator|Filter Operators]]|
|`+`, `:filter`|the filter output of all previous runs so far|
Precisely because of varying inputs, be aware that both prefixes `-` and `+` do not behave inverse to one another!