mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-08-07 11:28:54 +00:00
Reorganise tiddlers
Some of the titles were not consistent
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
title: $:/state/tab--251342953
|
||||
text: $:/plugins/tiddlywiki/internals/InspectResultsTab
|
||||
@@ -2,8 +2,8 @@ created: 20131127215321439
|
||||
modified: 20140912135951542
|
||||
title: $:/DefaultTiddlers
|
||||
|
||||
[[$:/plugins/internals/config]]
|
||||
[[$:/plugins/tiddlywiki/internals/config]]
|
||||
[[$:/AdvancedSearch]]
|
||||
[[inspect Operator]]
|
||||
[[inspect-filter Macro]]
|
||||
[[inspect-filter Macro (Examples)]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples]]
|
||||
|
||||
@@ -3,8 +3,8 @@ modified: 20140912135951542
|
||||
title: $:/DefaultTiddlers
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
[[$:/plugins/internals/config]]
|
||||
[[$:/plugins/tiddlywiki/internals/config]]
|
||||
[[$:/AdvancedSearch]]
|
||||
[[inspect Operator]]
|
||||
[[inspect-filter Macro]]
|
||||
[[inspect-filter Macro (Examples)]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro]]
|
||||
[[$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples]]
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
title: $:/plugins/internals/cascades/viewtemplatebody
|
||||
tags: $:/tags/ViewTemplateBodyFilter
|
||||
list-before:
|
||||
|
||||
[tag[$:/tags/FilterInspectionOutput]type[application/json]then[$:/plugins/internals/templates/viewtemplatebody]]
|
||||
@@ -1,4 +1,4 @@
|
||||
title: $:/plugins/internals/config
|
||||
title: $:/plugins/tiddlywiki/internals/config
|
||||
tags: $:/tags/ControlPanel
|
||||
caption: Internals
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
title: $:/plugins/tiddlywiki/internals/InspectResultsTab
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/InspectResultsTab
|
||||
tags: $:/tags/AdvancedSearch/FilterResults
|
||||
caption: Inspect
|
||||
list-after: $:/core/ui/AdvancedSearch/Filter/FilterResults/Results
|
||||
+2
-4
@@ -1,7 +1,5 @@
|
||||
caption: inspect-filter
|
||||
created: 20250401094200994
|
||||
modified: 20250401094200994
|
||||
title: inspect-filter Macro
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/InspectFilterMacro
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The <<.def inspect-filter>> [[macro|Macros]] displays a schematic representation of the filter evaluation process, including the input, output and intermediate results of evaluating the specified filter. It is based on the [[inspect operator|inspect Operator]].
|
||||
@@ -17,4 +15,4 @@ By default the tabs are arranged horizontally above the content. To get vertical
|
||||
;orientation
|
||||
: Optionally, the orientation of the schematic representation, defaulting to `horizontal`. Set to `vertical` to display the tabs vertically. This is useful for narrow windows or when the content is too wide to fit in a horizontal tab layout
|
||||
|
||||
<<.macro-examples "inspect-filter">>
|
||||
[[Examples|$:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples]]
|
||||
+7
-9
@@ -1,16 +1,14 @@
|
||||
caption: inspect
|
||||
created: 20250401094200994
|
||||
modified: 20250401094200994
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: a JSON object containing the input, output and intermediate results of evaluating the specified filter
|
||||
op-parameter: the filter to be inspected
|
||||
op-parameter-name: F
|
||||
op-purpose: inspect the evaluation of a filter to aid debugging
|
||||
tags: [[Filter Operators]]
|
||||
title: inspect Operator
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/inspectoperator
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<.from-version "5.3.7">> The <<.op inspect>> operator evaluates a filter with the specified input titles and returns a JSON object containing the input, output and intermediate results of evaluating the specified filter.
|
||||
The ''inspect'' operator evaluates a filter with the specified input titles and returns a JSON object containing the input, output and intermediate results of evaluating the specified filter.
|
||||
|
||||
|Operator Purpose |Inspect the evaluation of a filter to aid debugging |
|
||||
|Operator Input |A selection of titles |
|
||||
|Operator Output |A JSON object containing the input, output and intermediate results of evaluating the specified filter |
|
||||
|Operator Parameter |The filter to be inspected |
|
||||
|
||||
The JSON object contains the following properties:
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
created: 20250401094200994
|
||||
modified: 20250401094200994
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/docs/inspectfiltermacro/examples
|
||||
tags: [[Macro Examples]]
|
||||
title: inspect-filter Macro (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
|
||||
<$macrocall $name=".example" n="1" eg="""
|
||||
<$transclude $variable="inspect-filter" filter="[tags[]prefix[$:/]] :sort[length[]add[1]] +[first[2]tagging[]]" inputFilter="[all[tiddlers]]"/>
|
||||
"""/>
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
title: $:/plugins/tiddlywiki/internals/inspect-filter
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/inspectfiltermacro
|
||||
tags: $:/tags/Macro
|
||||
|
||||
\whitespace trim
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/internals/filters/inspect.js
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/modules/inspect.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
+38
-6
@@ -1,5 +1,5 @@
|
||||
/*\
|
||||
title: $:/plugins/tiddlywiki/internals/startup.js
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/modules/startup.js
|
||||
type: application/javascript
|
||||
module-type: startup
|
||||
|
||||
@@ -15,12 +15,17 @@ exports.before = ["startup"];
|
||||
exports.synchronous = true;
|
||||
|
||||
exports.startup = function() {
|
||||
// Publish public methods
|
||||
$tw.plugins = $tw.plugins || {};
|
||||
$tw.plugins.internals = {
|
||||
getWrappers: getWrappers
|
||||
};
|
||||
// We accumulate the output of the filter inspection into an array. We can't directly write to the wiki since we might be in the middle
|
||||
// of the refresh cycle, when writes to the wiki are not allowed
|
||||
var accumulator = [];
|
||||
// Add our hook for each filter evaluation
|
||||
$tw.hooks.addHook("th-filter-evaluation",function(filterString,wrappers) {
|
||||
// Get the list of tiddlers to be inspected
|
||||
var inspectedFilters = [];
|
||||
$tw.wiki.eachTiddlerPlusShadows(function(tiddler,title) {
|
||||
if(tiddler.fields.tags && tiddler.fields.tags.indexOf("$:/tags/InspectableFilter") !== -1 && !tiddler.fields["draft.of"] && tiddler.fields.text) {
|
||||
@@ -35,12 +40,14 @@ exports.startup = function() {
|
||||
if(wrappers.prefix || wrappers.operation || wrappers.operator) {
|
||||
return wrappers;
|
||||
}
|
||||
// Flush the accumulator, making each filter inspection output record into a separate tiddler
|
||||
var flushAccumulator = function() {
|
||||
if(accumulator.length) {
|
||||
$tw.utils.each(accumulator,function(jsonInspectionOutput) {
|
||||
// Get the output as a string
|
||||
var stringInspectionOutput = JSON.stringify(jsonInspectionOutput),
|
||||
logPrefix = `$:/temp/filter-inspection/${ + $tw.utils.stringifyDate(new Date())}: `,
|
||||
var stringInspectionOutput = JSON.stringify(jsonInspectionOutput);
|
||||
// Compute the log prefix and its length
|
||||
var logPrefix = `$:/temp/filter-inspection/${ + $tw.utils.stringifyDate(new Date())}: `,
|
||||
logPrefixLength = logPrefix.length;
|
||||
// Check if the the output is the same as the last log with the same filter
|
||||
var logTitles = [];
|
||||
@@ -86,45 +93,62 @@ exports.startup = function() {
|
||||
});
|
||||
};
|
||||
|
||||
/*
|
||||
Return the wrappers for evaluating a given filter
|
||||
fnDone is a function that will be called with the output of the filter evaluation as the single argument
|
||||
inputFilter is the filter to be evaluated
|
||||
*/
|
||||
function getWrappers(fnDone,inputFilter) {
|
||||
// Skeleton output record
|
||||
var output = {
|
||||
inputFilter: inputFilter,
|
||||
input: [],
|
||||
runs: []
|
||||
},
|
||||
currentRun,currentOperation;
|
||||
};
|
||||
// Keep track of where the current run and the current operation are being written
|
||||
var currentRun,currentOperation;
|
||||
// Compile the filter with wrapper functions to log the details
|
||||
return {
|
||||
start: function(source) {
|
||||
// Save the input
|
||||
// Save the input so that we have it in the output record
|
||||
source(function(tiddler,title) {
|
||||
output.input.push(title);
|
||||
});
|
||||
},
|
||||
prefix: function(filterRunPrefixFunction,operationFunction,innerOptions) {
|
||||
// Function to be called at the start of each filter run
|
||||
return function(results,innerSource,innerWidget) {
|
||||
// Save the details of this filte run
|
||||
var details ={
|
||||
input: results.toArray(),
|
||||
prefixName: innerOptions.prefixName,
|
||||
suffixes: innerOptions.suffixes,
|
||||
operations: []
|
||||
};
|
||||
// Save the current run so that we can add operations to it
|
||||
currentRun = details.operations;
|
||||
// Get the filter run prefix function
|
||||
var innerResults = filterRunPrefixFunction.call(null,operationFunction,innerOptions);
|
||||
// Invoke the filter run
|
||||
innerResults(results,innerSource,innerWidget);
|
||||
// Save the results of the filter run
|
||||
details.output = results.toArray();
|
||||
output.runs.push(details);
|
||||
};
|
||||
},
|
||||
operation: function(operationFunction,operation) {
|
||||
// Record the operation
|
||||
var details = {
|
||||
operators: []
|
||||
}
|
||||
// Keep track of where the current operation should be being written
|
||||
currentOperation = details.operators;
|
||||
currentRun.push(details);
|
||||
// Invoke the operation
|
||||
operationFunction();
|
||||
},
|
||||
operator: function(operatorFunction,innerSource,innerOperator,innerOptions) {
|
||||
// Record the operator
|
||||
var details = {
|
||||
operatorName: innerOperator.operatorName,
|
||||
operands: innerOperator.operands,
|
||||
@@ -135,11 +159,15 @@ function getWrappers(fnDone,inputFilter) {
|
||||
regexp: innerOperator.regexp,
|
||||
input: []
|
||||
};
|
||||
// Copy the input
|
||||
innerSource(function(tiddler,title) {
|
||||
details.input.push(title);
|
||||
});
|
||||
// Save this operation
|
||||
currentOperation.push(details);
|
||||
// Invoke the operator
|
||||
var innerResults = operatorFunction.apply(null,Array.prototype.slice.call(arguments,1));
|
||||
// Make sure the results are an array so that we can store them
|
||||
if(!$tw.utils.isArray(innerResults)) {
|
||||
var resultArray = [];
|
||||
innerResults(function(tiddler,title) {
|
||||
@@ -147,12 +175,16 @@ function getWrappers(fnDone,inputFilter) {
|
||||
});
|
||||
innerResults = resultArray;
|
||||
}
|
||||
// Store the results in the output
|
||||
details.output = innerResults;
|
||||
// Return the results
|
||||
return innerResults;
|
||||
},
|
||||
done: function(results) {
|
||||
// Save the results of the filter evaluation
|
||||
output.output = results;
|
||||
// console.log(`Inspected ${JSON.stringify(output,null,4)}`);
|
||||
// Invoke the done function
|
||||
if(fnDone) {
|
||||
fnDone(output);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
title: $:/plugins/tiddlywiki/internals/styles
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/styles
|
||||
tags: $:/tags/Stylesheet
|
||||
|
||||
\rules only filteredtranscludeinline transcludeinline macrodef macrocallinline macrocallblock
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
title: InspectFilter/Simple
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/tests/wikitext/Simple
|
||||
description: Test filter inspection
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
title: $:/plugins/internals/templates/viewtemplatebody
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/viewtemplatebody
|
||||
|
||||
<$transclude $variable="inspect-filter-output" jsonOutput={{!!text}} />
|
||||
@@ -0,0 +1,5 @@
|
||||
title: $:/plugins/tiddlywiki/internals/filterinspection/cascades/viewtemplatebody
|
||||
tags: $:/tags/ViewTemplateBodyFilter
|
||||
list-before:
|
||||
|
||||
[tag[$:/tags/FilterInspectionOutput]type[application/json]then[$:/plugins/tiddlywiki/internals/filterinspection/viewtemplatebody]]
|
||||
@@ -0,0 +1,2 @@
|
||||
title: $:/state/tab--251342953
|
||||
text: $:/plugins/tiddlywiki/internals/filterinspection/InspectResultsTab
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
title: $:/plugins/internals/testfilter
|
||||
title: $:/plugins/tiddlywiki/internals/testfilter
|
||||
tags: $:/tags/InspectableFilter
|
||||
type: text/plain
|
||||
|
||||
Reference in New Issue
Block a user