mirror of
https://github.com/Jermolene/TiddlyWiki5.git
synced 2025-12-06 02:30:46 -08:00
Merge branch 'master' into filter-inspection
This commit is contained in:
commit
0a0838e753
24 changed files with 3 additions and 90 deletions
|
|
@ -2000,7 +2000,7 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
var value = tiddler[name];
|
||||
switch(fieldInfo.source) {
|
||||
case "subdirectories":
|
||||
value = path.relative(rootPath, filename).split(path.sep).slice(0, -1);
|
||||
value = $tw.utils.stringifyList(path.relative(rootPath, filename).split(path.sep).slice(0, -1));
|
||||
break;
|
||||
case "filepath":
|
||||
value = path.relative(rootPath, filename).split(path.sep).join('/');
|
||||
|
|
@ -2021,10 +2021,10 @@ $tw.loadTiddlersFromSpecification = function(filepath,excludeRegExp) {
|
|||
value = path.extname(filename);
|
||||
break;
|
||||
case "created":
|
||||
value = new Date(fs.statSync(pathname).birthtime);
|
||||
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).birthtime));
|
||||
break;
|
||||
case "modified":
|
||||
value = new Date(fs.statSync(pathname).mtime);
|
||||
value = $tw.utils.stringifyDate(new Date(fs.statSync(pathname).mtime));
|
||||
break;
|
||||
}
|
||||
if(fieldInfo.prefix) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: filteroperator
|
|||
Filter operator for returning all the backtranscludes from a tiddler
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
|
|
@ -19,5 +18,3 @@ exports.backtranscludes = function(source,operator,options) {
|
|||
});
|
||||
return results.makeTiddlerIterator(options.wiki);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: filteroperator
|
|||
Filter operator for returning all the transcludes from a tiddler
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
|
|
@ -19,5 +18,3 @@ exports.transcludes = function(source,operator,options) {
|
|||
});
|
||||
return results.makeTiddlerIterator(options.wiki);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ This is a <%if [{something}] %>Elephant<%elseif [{else}] %>Pelican<%else%>Crocod
|
|||
```
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
exports.name = "conditional";
|
||||
|
|
@ -113,5 +112,3 @@ exports.parseIfClause = function(filterCondition) {
|
|||
// Return the parse tree node
|
||||
return [listWidget];
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ module-type: utils
|
|||
Custom errors for TiddlyWiki.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
function TranscludeRecursionError() {
|
||||
Error.apply(this,arguments);
|
||||
this.signatures = Object.create(null);
|
||||
|
|
@ -19,5 +17,3 @@ TranscludeRecursionError.MAX_WIDGET_TREE_DEPTH = 1000;
|
|||
TranscludeRecursionError.prototype = Object.create(Error);
|
||||
|
||||
exports.TranscludeRecursionError = TranscludeRecursionError;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: utils
|
|||
Utilities for working with the TiddlyWiki repository file structure
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
|
|
@ -45,5 +44,3 @@ exports.getAllPlugins = function(options) {
|
|||
$tw.utils.each($tw.getLibraryItemSearchPaths($tw.config.languagesPath,options.ignoreEnvironmentVariables ? undefined : $tw.config.languagesEnvVar),collectPlugins);
|
||||
return tiddlers;
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: widget
|
|||
Widget to dynamically represent one or more tiddlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
|
@ -187,5 +186,3 @@ function hasPayloadChanged(a,b) {
|
|||
}
|
||||
|
||||
exports.data = DataWidget;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: widget
|
|||
Widget to display a test case
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
|
@ -160,5 +159,3 @@ TestCaseWidget.prototype.refresh = function(changedTiddlers) {
|
|||
};
|
||||
|
||||
exports["testcase"] = TestCaseWidget;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -34,13 +34,11 @@ Suppose we want to make a filter operator that returns every other tiddler from
|
|||
We make a new tiddler, set its `type` and `module-type` appropriately, and begin writing the code:
|
||||
|
||||
```
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
exports.everyother = function(source, operator, options) {
|
||||
// TODO
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
For the example filter syntax, our function will be called with
|
||||
|
|
@ -54,7 +52,6 @@ As is usually the case, we don't care about `operator.operator` here (since that
|
|||
We could implement the operator by iterating over the input tiddlers and explicitly building a result array of titles:
|
||||
|
||||
```
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
exports.everyother = function(source, operator, options) {
|
||||
|
|
@ -66,7 +63,6 @@ exports.everyother = function(source, operator, options) {
|
|||
});
|
||||
return result;
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
That is, we supply a callback to `source` that negates `include` each time through (in order to grab every other result) and pushes the `title` of every other tiddler onto the result.
|
||||
|
|
@ -74,7 +70,6 @@ That is, we supply a callback to `source` that negates `include` each time throu
|
|||
Alternatively, we can return our own iterator, by returning a function that accepts a similar callback and only calls it on every other tiddler:
|
||||
|
||||
```
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
exports.everyother = function(source, operator, options) {
|
||||
|
|
@ -86,7 +81,6 @@ exports.everyother = function(source, operator, options) {
|
|||
});
|
||||
};
|
||||
}
|
||||
})();
|
||||
```
|
||||
|
||||
Either way, we could interpret the `!` flag on the filter, if present, to mean that we want the //other// half of the tiddlers, by using it to set the initial value of `include`: `var include = operator.prefix !== "!";`
|
||||
|
|
|
|||
|
|
@ -40,10 +40,7 @@ module-type: startup
|
|||
YOUR DISCRCRIPTION COMES HERE!
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false, exports: true */
|
||||
"use strict";
|
||||
|
||||
// Export name and synchronous status
|
||||
|
|
@ -63,6 +60,4 @@ exports.startup = function() {
|
|||
});
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
```
|
||||
|
|
@ -11,10 +11,7 @@ The wikitext parser subclassing mechanism makes it possible for custom parsers t
|
|||
Here is an example of a subclass of the checkbox widget that adds logging to the event handler:
|
||||
|
||||
```js
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
var WikiParser = require("$:/core/modules/parsers/wikiparser/wikiparser.js")["text/vnd.tiddlywiki"],
|
||||
|
|
@ -38,5 +35,4 @@ var MyCustomWikiParser = function(type,text,options) {
|
|||
|
||||
exports["text/vnd.my-custom-type"] = MyCustomWikiParser;
|
||||
|
||||
})();
|
||||
```
|
||||
|
|
|
|||
|
|
@ -26,10 +26,7 @@ module-type: widget-subclass
|
|||
Widget base class
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports.baseClass = "checkbox"; // Extend the <$checkbox> widget
|
||||
|
|
@ -50,5 +47,4 @@ exports.prototype.handleChangeEvent = function(event) {
|
|||
console.log("Checkbox status:",this.inputDomNode.checked);
|
||||
};
|
||||
|
||||
})();
|
||||
```
|
||||
|
|
|
|||
|
|
@ -6,12 +6,6 @@ tags: [[$:/tags/test-spec]]
|
|||
Tests <$action-deletefield />.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/* jslint node: true, browser: true */
|
||||
/* eslint-env node, browser, jasmine */
|
||||
/* eslint no-mixed-spaces-and-tabs: ["error", "smart-tabs"]*/
|
||||
/* global $tw, require */
|
||||
"use strict";
|
||||
|
||||
describe("<$action-deletefield /> tests", function() {
|
||||
|
|
@ -172,5 +166,3 @@ it("should correctly delete fields", function() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
|
|||
Tests the fakedom that Tiddlywiki occasionally uses.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
describe("fakedom tests", function() {
|
||||
|
|
@ -20,5 +19,3 @@ describe("fakedom tests", function() {
|
|||
expect($tw.fakeDocument.createTextNode("text").TEXT_NODE).toBe(3);
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
|
|||
Tests for integrity of the core plugins, languages, themes and editions
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
if($tw.node) {
|
||||
|
|
@ -47,6 +46,3 @@ if($tw.node) {
|
|||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -3,10 +3,7 @@ title: test-widget-event.js
|
|||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
describe("Widget Event Listeners", function() {
|
||||
|
|
@ -220,5 +217,3 @@ describe("Widget Event Listeners", function() {
|
|||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ tags: [[$:/tags/test-spec]]
|
|||
Tests the wikitext rendering pipeline end-to-end. We also need tests that individually test parsers, rendertreenodes etc., but this gets us started.
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
describe("Widget module", function() {
|
||||
|
|
@ -89,4 +88,3 @@ describe("Widget module", function() {
|
|||
|
||||
});
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: global
|
|||
Confetti manager
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var confetti = require("$:/plugins/tiddlywiki/confetti/confetti.js");
|
||||
|
|
@ -49,5 +48,3 @@ ConfettiManager.prototype.reset = function () {
|
|||
};
|
||||
|
||||
exports.ConfettiManager = ConfettiManager;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: widget
|
|||
Confetti widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
|
@ -60,5 +59,3 @@ ConfettiWidget.prototype.refresh = function(changedTiddlers) {
|
|||
};
|
||||
|
||||
exports.confetti = ConfettiWidget;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: startup
|
|||
Setup the root widget event handlers
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
// Export name and synchronous status
|
||||
|
|
@ -56,5 +55,3 @@ exports.startup = function() {
|
|||
$tw.confettiManager.reset();
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: library
|
|||
Manages the element spotlight effect
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
function ElementSpotlight() {
|
||||
|
|
@ -129,5 +128,3 @@ ElementSpotlight.prototype.shineSpotlight = function(selectors) {
|
|||
};
|
||||
|
||||
exports.ElementSpotlight = ElementSpotlight;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
const { ElementSpotlight } = require("./element-spotlight");
|
||||
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/dynannotate/startup.js
|
||||
type: application/javascript
|
||||
|
|
@ -8,8 +6,6 @@ module-type: startup
|
|||
Startup the dyannotate background daemon to track the selection
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
"use strict";
|
||||
|
||||
// Export name and synchronous status
|
||||
|
|
@ -56,5 +52,3 @@ exports.startup = function() {
|
|||
$tw.dynannotate.elementSpotlight.shineSpotlight(selectors);
|
||||
});
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,9 +6,6 @@ module-type: widget
|
|||
Anchor widget to represent an innerwiki graphical anchor. Clone of the data widget
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
exports.anchor = require("$:/core/modules/widgets/data.js").data;
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ module-type: widget
|
|||
barcodereader widget for reading barcodes
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
"use strict";
|
||||
|
||||
var Widget = require("$:/core/modules/widgets/widget.js").widget;
|
||||
|
|
@ -83,5 +82,3 @@ BarCodeReaderWidget.prototype.refresh = function(changedTiddlers) {
|
|||
};
|
||||
|
||||
exports.barcodereader = BarCodeReaderWidget;
|
||||
|
||||
})();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue