mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-01-24 20:04:40 +00:00
Compare commits
17 Commits
v5.2.3
...
revised-js
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
418aab50a5 | ||
|
|
f82d15e55f | ||
|
|
7652aa5fed | ||
|
|
d62a16ee46 | ||
|
|
0b1fc8e574 | ||
|
|
127f660c91 | ||
|
|
668f443fc2 | ||
|
|
f0423c20b9 | ||
|
|
953b89fd6b | ||
|
|
f87ab06414 | ||
|
|
2ff5bd5a0f | ||
|
|
d7b9e6fb02 | ||
|
|
8420f8430f | ||
|
|
a572979cc4 | ||
|
|
90d6a0f1a6 | ||
|
|
406dbd0883 | ||
|
|
3fd2cfc339 |
@@ -18,6 +18,8 @@ CopyToClipboard/Caption: copy to clipboard
|
||||
CopyToClipboard/Hint: Copy this text to the clipboard
|
||||
Delete/Caption: delete
|
||||
Delete/Hint: Delete this tiddler
|
||||
DeleteTiddlers/Caption: delete tiddlers
|
||||
DeleteTiddlers/Hint: Delete tiddlers
|
||||
Edit/Caption: edit
|
||||
Edit/Hint: Edit this tiddler
|
||||
Encryption/Caption: encryption
|
||||
|
||||
@@ -9,9 +9,10 @@ Before you start storing important information in ~TiddlyWiki it is vital to mak
|
||||
|
||||
<div class="tc-control-panel">
|
||||
|
||||
|<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
|tc-table-no-border tc-first-col-min-width tc-first-link-nowrap|k
|
||||
| <$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link>|<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
| <$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link>|<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|^ <$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link><br><<lingo DefaultTiddlers/TopHint>>|<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
</div>
|
||||
|
||||
See the [[control panel|$:/ControlPanel]] for more options.
|
||||
|
||||
@@ -8,6 +8,7 @@ CloseAll/Button: close all
|
||||
ColourPicker/Recent: Recent:
|
||||
ConfirmCancelTiddler: Do you wish to discard changes to the tiddler "<$text text=<<title>>/>"?
|
||||
ConfirmDeleteTiddler: Do you wish to delete the tiddler "<$text text=<<title>>/>"?
|
||||
ConfirmDeleteTiddlers: Are you sure you wish to delete <<resultCount>> tiddler(s)?
|
||||
ConfirmOverwriteTiddler: Do you wish to overwrite the tiddler "<$text text=<<title>>/>"?
|
||||
ConfirmEditShadowTiddler: You are about to edit a ShadowTiddler. Any changes will override the default system making future upgrades non-trivial. Are you sure you want to edit "<$text text=<<title>>/>"?
|
||||
ConfirmAction: Do you wish to proceed?
|
||||
|
||||
@@ -115,7 +115,7 @@ function editTextWidgetFactory(toolbarEngine,nonToolbarEngine) {
|
||||
// Otherwise, we need to construct a default value for the editor
|
||||
switch(this.editField) {
|
||||
case "text":
|
||||
value = "Type the text for the tiddler '" + this.editTitle + "'";
|
||||
value = "";
|
||||
type = "text/vnd.tiddlywiki";
|
||||
break;
|
||||
case "title":
|
||||
|
||||
35
core/modules/filters/format/json.js
Normal file
35
core/modules/filters/format/json.js
Normal file
@@ -0,0 +1,35 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/format/json.js
|
||||
type: application/javascript
|
||||
module-type: formatfilteroperator
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
/*
|
||||
Export our filter function
|
||||
*/
|
||||
exports.json = function(source,operand,options) {
|
||||
var results = [],
|
||||
spaces = null;
|
||||
if(operand) {
|
||||
spaces = /^\d+$/.test(operand) ? parseInt(operand,10) : operand;
|
||||
}
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title);
|
||||
try {
|
||||
data = JSON.parse(title);
|
||||
} catch(e) {
|
||||
data = undefined;
|
||||
}
|
||||
if(data !== undefined) {
|
||||
results.push(JSON.stringify(data,null,spaces));
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
})();
|
||||
153
core/modules/filters/json-ops.js
Normal file
153
core/modules/filters/json-ops.js
Normal file
@@ -0,0 +1,153 @@
|
||||
/*\
|
||||
title: $:/core/modules/filters/json-ops.js
|
||||
type: application/javascript
|
||||
module-type: filteroperator
|
||||
|
||||
Filter operators for JSON operations
|
||||
|
||||
\*/
|
||||
(function(){
|
||||
|
||||
/*jslint node: true, browser: true */
|
||||
/*global $tw: false */
|
||||
"use strict";
|
||||
|
||||
exports["jsonget"] = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title,title);
|
||||
if(data) {
|
||||
var item = getDataItemValueAsString(data,operator.operands);
|
||||
if(item !== undefined) {
|
||||
results.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
exports["jsonindexes"] = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title,title);
|
||||
if(data) {
|
||||
var item = getDataItemKeysAsStrings(data,operator.operands);
|
||||
if(item !== undefined) {
|
||||
results.push.apply(results,item);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
exports["jsontype"] = function(source,operator,options) {
|
||||
var results = [];
|
||||
source(function(tiddler,title) {
|
||||
var data = $tw.utils.parseJSONSafe(title,title);
|
||||
if(data) {
|
||||
var item = getDataItemType(data,operator.operands);
|
||||
if(item !== undefined) {
|
||||
results.push(item);
|
||||
}
|
||||
}
|
||||
});
|
||||
return results;
|
||||
};
|
||||
|
||||
/*
|
||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the values at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||
*/
|
||||
function getDataItemValueAsString(data,indexes) {
|
||||
// Get the item
|
||||
var item = getDataItem(data,indexes);
|
||||
// Return the item as a string
|
||||
return convertDataItemValueToString(item);
|
||||
}
|
||||
|
||||
/*
|
||||
Given a JSON data structure and an array of index strings, return an array of the string representation of the keys of the item at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||
*/
|
||||
function getDataItemKeysAsStrings(data,indexes) {
|
||||
// Get the item
|
||||
var item = getDataItem(data,indexes);
|
||||
// Return the item keys as a string
|
||||
return convertDataItemKeysToStrings(item);
|
||||
}
|
||||
|
||||
/*
|
||||
Return an array of the string representation of the values of a data item, or "undefined" if the item is undefined
|
||||
*/
|
||||
function convertDataItemValueToString(item) {
|
||||
// Return the item as a string
|
||||
if(item === undefined) {
|
||||
return item;
|
||||
}
|
||||
if(typeof item === "object") {
|
||||
return JSON.stringify(item);
|
||||
}
|
||||
return item.toString();
|
||||
}
|
||||
|
||||
/*
|
||||
Return an array of the string representation of the keys of a data item, or "undefined" if the item is undefined
|
||||
*/
|
||||
function convertDataItemKeysToStrings(item) {
|
||||
// Return the item as a string
|
||||
if(item === undefined) {
|
||||
return item;
|
||||
} else if(typeof item === "object") {
|
||||
if(item === null) {
|
||||
return [];
|
||||
}
|
||||
var results = [];
|
||||
if($tw.utils.isArray(item)) {
|
||||
for(var i=0; i<item.length; i++) {
|
||||
results.push(i.toString());
|
||||
}
|
||||
return results;
|
||||
} else {
|
||||
$tw.utils.each(Object.keys(item).sort(),function(key) {
|
||||
results.push(key);
|
||||
});
|
||||
return results;
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function getDataItemType(data,indexes) {
|
||||
// Get the item
|
||||
var item = getDataItem(data,indexes);
|
||||
// Return the item type
|
||||
if(item === undefined) {
|
||||
return item;
|
||||
} else if(item === null) {
|
||||
return "null";
|
||||
} else if($tw.utils.isArray(item)) {
|
||||
return "array";
|
||||
} else if(typeof item === "object") {
|
||||
return "object";
|
||||
} else {
|
||||
return typeof item;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Given a JSON data structure and an array of index strings, return the value at the end of the index chain, or "undefined" if any of the index strings are invalid
|
||||
*/
|
||||
function getDataItem(data,indexes) {
|
||||
if(indexes.length === 0 || (indexes.length === 1 && indexes[0] === "")) {
|
||||
return data;
|
||||
}
|
||||
// Get the item
|
||||
var item = data;
|
||||
for(var i=0; i<indexes.length; i++) {
|
||||
if(item !== undefined) {
|
||||
item = item[indexes[i]];
|
||||
}
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
@@ -36,7 +36,7 @@ Compute the internal state of the widget
|
||||
*/
|
||||
DeleteFieldWidget.prototype.execute = function() {
|
||||
this.actionTiddler = this.getAttribute("$tiddler",this.getVariable("currentTiddler"));
|
||||
this.actionField = this.getAttribute("$field");
|
||||
this.actionField = this.getAttribute("$field",null);
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -59,7 +59,7 @@ DeleteFieldWidget.prototype.invokeAction = function(triggeringWidget,event) {
|
||||
tiddler = this.wiki.getTiddler(self.actionTiddler),
|
||||
removeFields = {},
|
||||
hasChanged = false;
|
||||
if(this.actionField && tiddler) {
|
||||
if((this.actionField !== null) && tiddler) {
|
||||
removeFields[this.actionField] = undefined;
|
||||
if(this.actionField in tiddler.fields) {
|
||||
hasChanged = true;
|
||||
|
||||
@@ -3,7 +3,7 @@ tags: $:/tags/AdvancedSearch/FilterButton
|
||||
|
||||
\whitespace trim
|
||||
<$reveal state="$:/temp/advancedsearch" type="nomatch" text="">
|
||||
<$button popup=<<qualify "$:/state/filterDeleteDropdown">> class="tc-btn-invisible">
|
||||
<$button tooltip={{$:/language/Buttons/DeleteTiddlers/Hint}} popup=<<qualify "$:/state/filterDeleteDropdown">> class="tc-btn-invisible">
|
||||
{{$:/core/images/delete-button}}
|
||||
</$button>
|
||||
</$reveal>
|
||||
@@ -13,13 +13,13 @@ tags: $:/tags/AdvancedSearch/FilterButton
|
||||
<div class="tc-block-dropdown tc-edit-type-dropdown">
|
||||
<div class="tc-dropdown-item-plain">
|
||||
<$set name="resultCount" value="""<$count filter={{$:/temp/advancedsearch}}/>""">
|
||||
Are you sure you wish to delete <<resultCount>> tiddler(s)?
|
||||
{{$:/language/ConfirmDeleteTiddlers}}
|
||||
</$set>
|
||||
</div>
|
||||
<div class="tc-dropdown-item-plain">
|
||||
<$button class="tc-btn">
|
||||
<$action-deletetiddler $filter={{$:/temp/advancedsearch}}/>
|
||||
Delete these tiddlers
|
||||
{{$:/language/Buttons/DeleteTiddlers/Hint}}
|
||||
</$button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/library/v5.2.3/index.html
|
||||
url: https://tiddlywiki.com/library/v5.2.4/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}}
|
||||
|
||||
{{$:/language/OfficialPluginLibrary/Hint}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
title: $:/config/OfficialPluginLibrary
|
||||
tags: $:/tags/PluginLibrary
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.2.3/index.html
|
||||
url: https://tiddlywiki.com/prerelease/library/v5.2.4/index.html
|
||||
caption: {{$:/language/OfficialPluginLibrary}} (Prerelease)
|
||||
|
||||
The prerelease version of the official ~TiddlyWiki plugin library at tiddlywiki.com. Plugins, themes and language packs are maintained by the core team.
|
||||
|
||||
95
editions/test/tiddlers/tests/test-json-filters.js
Normal file
95
editions/test/tiddlers/tests/test-json-filters.js
Normal file
@@ -0,0 +1,95 @@
|
||||
/*\
|
||||
title: test-json-filters.js
|
||||
type: application/javascript
|
||||
tags: [[$:/tags/test-spec]]
|
||||
|
||||
Tests the JSON filters and the format:json operator
|
||||
|
||||
\*/
|
||||
(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("json filter tests", function() {
|
||||
|
||||
var wiki = new $tw.Wiki();
|
||||
var tiddlers = [{
|
||||
title: "First",
|
||||
text: '{"a":"one","b":"","c":1.618,"d": {"e": "four","f": ["five","six",true,false,null]}}',
|
||||
type: "application/json"
|
||||
},{
|
||||
title: "Second",
|
||||
text: '["une","deux","trois"]',
|
||||
type: "application/json"
|
||||
},{
|
||||
title: "Third",
|
||||
text: "This is not JSON",
|
||||
type: "text/vnd.tiddlywiki"
|
||||
}];
|
||||
wiki.addTiddlers(tiddlers);
|
||||
|
||||
it("should support the getindex operator", function() {
|
||||
expect(wiki.filterTiddlers("[{First}getindex[b]]")).toEqual([]);
|
||||
});
|
||||
|
||||
it("should support the jsonget operator", function() {
|
||||
expect(wiki.filterTiddlers("[{Third}jsonget[]]")).toEqual(["This is not JSON"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[]]")).toEqual(['{"a":"one","b":"","c":1.618,"d":{"e":"four","f":["five","six",true,false,null]}}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[a]]")).toEqual(["one"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[b]]")).toEqual([""]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[missing-property]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d]]")).toEqual(['{"e":"four","f":["five","six",true,false,null]}']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d]jsonget[f]]")).toEqual(['["five","six",true,false,null]']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[e]]")).toEqual(["four"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f]]")).toEqual(['["five","six",true,false,null]']);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[0]]")).toEqual(["five"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[1]]")).toEqual(["six"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[2]]")).toEqual(["true"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[3]]")).toEqual(["false"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonget[d],[f],[4]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
it("should support the jsonindexes operator", function() {
|
||||
expect(wiki.filterTiddlers("[{Second}jsonindexes[]]")).toEqual(["0","1","2"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[]]")).toEqual(["a","b","c","d"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[a]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[b]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d]]")).toEqual(["e","f"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[e]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f]]")).toEqual(["0","1","2","3","4"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[0]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[1]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[2]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[3]]")).toEqual([]);
|
||||
expect(wiki.filterTiddlers("[{First}jsonindexes[d],[f],[4]]")).toEqual([]);
|
||||
});
|
||||
|
||||
it("should support the jsontype operator", function() {
|
||||
expect(wiki.filterTiddlers("[{Third}jsontype[]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[]]")).toEqual(["object"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[a]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[b]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[c]]")).toEqual(["number"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d]]")).toEqual(["object"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[e]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f]]")).toEqual(["array"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[0]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[1]]")).toEqual(["string"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[2]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[3]]")).toEqual(["boolean"]);
|
||||
expect(wiki.filterTiddlers("[{First}jsontype[d],[f],[4]]")).toEqual(["null"]);
|
||||
});
|
||||
|
||||
it("should support the format:json operator", function() {
|
||||
expect(wiki.filterTiddlers("[{First}format:json[]]")).toEqual(["{\"a\":\"one\",\"b\":\"\",\"c\":1.618,\"d\":{\"e\":\"four\",\"f\":[\"five\",\"six\",true,false,null]}}"]);
|
||||
expect(wiki.filterTiddlers("[{First}format:json[4]]")).toEqual(["{\n \"a\": \"one\",\n \"b\": \"\",\n \"c\": 1.618,\n \"d\": {\n \"e\": \"four\",\n \"f\": [\n \"five\",\n \"six\",\n true,\n false,\n null\n ]\n }\n}"]);
|
||||
expect(wiki.filterTiddlers("[{First}format:json[ ]]")).toEqual(["{\n \"a\": \"one\",\n \"b\": \"\",\n \"c\": 1.618,\n \"d\": {\n \"e\": \"four\",\n \"f\": [\n \"five\",\n \"six\",\n true,\n false,\n null\n ]\n }\n}"]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
||||
@@ -1,5 +1,5 @@
|
||||
created: 20201020102735123
|
||||
modified: 20210524044020645
|
||||
modified: 20220611104737314
|
||||
tags: [[Operator Examples]] [[format Operator]]
|
||||
title: format Operator (Examples)
|
||||
type: text/vnd.tiddlywiki
|
||||
@@ -18,9 +18,12 @@ Modified date shown as a relative date:
|
||||
A tiddler title with spaces formatted as a title list:
|
||||
<<.operator-example 4 """[[Hello There]format:titlelist[]]""">>
|
||||
|
||||
All tiddler titles tagged with <<tag TableOfContents>> formatted as a title list :
|
||||
All tiddler titles tagged with <<tag TableOfContents>> formatted as a title list:
|
||||
<<.operator-example 5 """[tag[TableOfContents]format:titlelist[]]""">>
|
||||
|
||||
A JSON string formatted as JSON – note how the JSON string is normalised to remove the duplicated properties:
|
||||
<<.operator-example 6 """[[{"one":"first","one":"another","two":"second"}]format:json[]]""">>
|
||||
|
||||
<<.tip "To create a string to save a [[title list|Title List]] into a list field, use `format:titlelist[]` with the [[join operator|join Operator]]">>
|
||||
<<.operator-example 6 """[tag[TableOfContents]format:titlelist[]join[ ]]""">>
|
||||
For example, to save titles tagged `TableOfContents` to the titles field of the tiddler [[format titlelist test]]:
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
caption: format
|
||||
created: 20201020100834443
|
||||
modified: 20220523075550449
|
||||
modified: 20220611104737314
|
||||
op-input: a [[selection of titles|Title Selection]]
|
||||
op-output: input strings formatted according to the specified suffix <<.place B>>
|
||||
op-parameter: optional format string for the formats
|
||||
@@ -17,9 +17,10 @@ type: text/vnd.tiddlywiki
|
||||
The suffix <<.place B>> is one of the following supported string formats:
|
||||
|
||||
|!Format |!Description |
|
||||
|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional operator parameter. (Defaults to "YYYY MM DD 0hh:0mm") |
|
||||
|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters are ignored. |
|
||||
|^`titlelist` |<<.from-version "5.2.0">>The input string wrapped in double square brackets if it contains a space. Appropriate for use in a [[title list|Title List]]. |
|
||||
|^`date` |The input string is interpreted as a UTC date and displayed according to the DateFormat specified in the optional operator operand. (Defaults to "YYYY MM DD 0hh:0mm") |
|
||||
|^`json` |<<.from-version "5.2.4">> The input string is interpreted as JSON and displayed with standard formatting. The optional operator operand specifies the number of spaces to use for indenting, or a string to use for indenting. Nothing is returned if the input string is not valid JSON |
|
||||
|^`relativedate` |The input string is interpreted as a UTC date and displayed as the interval from the present instant. Any operator parameters are ignored |
|
||||
|^`titlelist` |<<.from-version "5.2.0">> The input string wrapped in double square brackets if it contains a space. Appropriate for use in a [[title list|Title List]]. |
|
||||
|
||||
<<.warning """The [[Title List]] format cannot reliably represent items that contain certain specific character sequences such as `]] `. Thus it should not be used where there is a possibility of such sequences occurring.""">>
|
||||
|
||||
|
||||
86
editions/tw5.com/tiddlers/filters/jsonget.tid
Normal file
86
editions/tw5.com/tiddlers/filters/jsonget.tid
Normal file
@@ -0,0 +1,86 @@
|
||||
created: 20220611104737314
|
||||
modified: 20220611104737314
|
||||
tags: [[Filter Operators]] [[JSON Operators]]
|
||||
title: jsonget Operator
|
||||
caption: jsonget
|
||||
op-purpose: retrieve the value of a property from JSON strings
|
||||
op-input: a selection of JSON strings
|
||||
op-parameter: one or more indexes of the property to retrieve
|
||||
op-output: the values of each of the retrieved properties
|
||||
|
||||
<<.from-version "5.2.4">> See [[JSON in TiddlyWiki]] for background.
|
||||
|
||||
The <<.op jsonget>> operator is used to retrieve values from JSON data. See also the following related operators:
|
||||
|
||||
* <<.olink jsontype>> to retrieve the type of a JSON value
|
||||
* <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array
|
||||
|
||||
Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`.
|
||||
|
||||
```
|
||||
{
|
||||
"a": "one",
|
||||
"b": "",
|
||||
"c": "three",
|
||||
"d": {
|
||||
"e": "four",
|
||||
"f": [
|
||||
"five",
|
||||
"six",
|
||||
true,
|
||||
false,
|
||||
null
|
||||
],
|
||||
"g": {
|
||||
"x": "max",
|
||||
"y": "may",
|
||||
"z": "maize"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsonget>> operator uses multiple operands to specify the indexes of the property to retrieve:
|
||||
|
||||
```
|
||||
[<jsondata>jsonget[a]] --> "one"
|
||||
[<jsondata>jsonget[d],[e]] --> "four"
|
||||
[<jsondata>jsonget[d],[f],[0]] --> "five"
|
||||
```
|
||||
|
||||
Indexes can be dynamically composed from variables and transclusions:
|
||||
|
||||
```
|
||||
[<jsondata>jsonget<variable>,{!!field},[0]]
|
||||
```
|
||||
|
||||
Boolean values and null are returned as normal strings. The <<.olink jsontype>> operator can be used to retrieve a string identifying the original type. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype[a]] --> "string"
|
||||
[<jsondata>jsontype[d]] --> "object"
|
||||
[<jsondata>jsontype[d],[f]] --> "array"
|
||||
[<jsondata>jsontype[d],[f],[2]] --> "boolean"
|
||||
```
|
||||
|
||||
Using the <<.op jsonget>> operator to retrieve an object or an array returns a JSON string of the values. For example:
|
||||
|
||||
```
|
||||
[<jsondata>jsonget[d],[f]] --> `["five","six",true,false,null]`
|
||||
[<jsondata>jsonget[d],[g]] --> `{"x": "max","y": "may","z": "maize"}`
|
||||
```
|
||||
|
||||
The <<.olink jsonindexes>> operator retrieves the corresponding indexes:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[d],[f]] --> "0", "1", "2", "3", "4"
|
||||
[<jsondata>jsonindexes[d],[g]] --> "x", "y", "z"
|
||||
```
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[]] --> "a", "b", "c", "d"
|
||||
```
|
||||
64
editions/tw5.com/tiddlers/filters/jsonindexes.tid
Normal file
64
editions/tw5.com/tiddlers/filters/jsonindexes.tid
Normal file
@@ -0,0 +1,64 @@
|
||||
created: 20220611104737314
|
||||
modified: 20220611104737314
|
||||
tags: [[Filter Operators]] [[JSON Operators]]
|
||||
title: jsonindexes Operator
|
||||
caption: jsonindexes
|
||||
op-purpose: retrieve the value of a property from JSON strings
|
||||
op-input: a selection of JSON strings
|
||||
op-parameter: one or more indexes of the property to retrieve
|
||||
op-output: the values of each of the retrieved properties
|
||||
|
||||
<<.from-version "5.2.4">> See [[JSON in TiddlyWiki]] for background.
|
||||
|
||||
The <<.op jsonindexes>> operator is used to retrieve the property names of JSON objects or the index names of JSON arrays. See also the following related operators:
|
||||
|
||||
* <<.olink jsonget>> to retrieve the values of a property in JSON data
|
||||
* <<.olink jsontype>> to retrieve the type of a JSON value
|
||||
|
||||
Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`.
|
||||
|
||||
```
|
||||
{
|
||||
"a": "one",
|
||||
"b": "",
|
||||
"c": "three",
|
||||
"d": {
|
||||
"e": "four",
|
||||
"f": [
|
||||
"five",
|
||||
"six",
|
||||
true,
|
||||
false,
|
||||
null
|
||||
],
|
||||
"g": {
|
||||
"x": "max",
|
||||
"y": "may",
|
||||
"z": "maize"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsonindexes>> operator uses multiple operands to specify the indexes of the property to retrieve:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[d],[f]] --> "0", "1", "2", "3", "4"
|
||||
[<jsondata>jsonindexes[d],[g]] --> "x", "y", "z"
|
||||
```
|
||||
|
||||
Indexes can be dynamically composed from variables and transclusions:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes<variable>,{!!field}]
|
||||
```
|
||||
|
||||
Retrieving the indexes of JSON properties that are not objects or arrays will return nothing.
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsonindexes[]] --> "a", "b", "c", "d"
|
||||
```
|
||||
73
editions/tw5.com/tiddlers/filters/jsontype.tid
Normal file
73
editions/tw5.com/tiddlers/filters/jsontype.tid
Normal file
@@ -0,0 +1,73 @@
|
||||
created: 20220611104737314
|
||||
modified: 20220611104737314
|
||||
tags: [[Filter Operators]] [[JSON Operators]]
|
||||
title: jsontype Operator
|
||||
caption: jsontype
|
||||
op-purpose: retrieve the type of a property from JSON strings
|
||||
op-input: a selection of JSON strings
|
||||
op-parameter: one or more indexes of the property whose type is to be retrieved
|
||||
op-output: the types of each of the retrieved properties
|
||||
|
||||
<<.from-version "5.2.4">> See [[JSON in TiddlyWiki]] for background.
|
||||
|
||||
The <<.op jsontype>> operator is used to retrieve the type of a property in JSON data. See also the following related operators:
|
||||
|
||||
* <<.olink jsonget>> to retrieve the values of a property in JSON data
|
||||
* <<.olink jsonindexes>> to retrieve the names of the fields of a JSON object, or the indexes of a JSON array
|
||||
|
||||
JSON supports the following data types:
|
||||
|
||||
* ''string'' - a Unicode string
|
||||
* ''number'' - a floating point number
|
||||
* ''boolean'' - Boolean value (true or false)
|
||||
* ''array'' - an array of values
|
||||
* ''object'' - an object of name/value pairs
|
||||
* ''null'' - a special type representing a missing value
|
||||
|
||||
Properties within a JSON object are identified by a sequence of indexes. In the following example, the value at `[a]` is `one`, and the value at `[d][f][0]` is `five`.
|
||||
|
||||
```
|
||||
{
|
||||
"a": "one",
|
||||
"b": "",
|
||||
"c": "three",
|
||||
"d": {
|
||||
"e": "four",
|
||||
"f": [
|
||||
"five",
|
||||
"six",
|
||||
true,
|
||||
false,
|
||||
null
|
||||
],
|
||||
"g": {
|
||||
"x": "max",
|
||||
"y": "may",
|
||||
"z": "maize"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
The following examples assume that this JSON data is contained in a variable called `jsondata`.
|
||||
|
||||
The <<.op jsontype>> operator uses multiple operands to specify the indexes of the property whose type is to be retrieved:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype[a]] --> "string"
|
||||
[<jsondata>jsontype[d]] --> "object"
|
||||
[<jsondata>jsontype[d],[f]] --> "array"
|
||||
[<jsondata>jsontype[d],[f],[2]] --> "boolean"
|
||||
```
|
||||
|
||||
Indexes can be dynamically composed from variables and transclusions:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype<variable>,{!!field},[0]]
|
||||
```
|
||||
|
||||
A subtlety is that the special case of a single blank operand is used to identify the root object. Thus:
|
||||
|
||||
```
|
||||
[<jsondata>jsontype[]] --> "object"
|
||||
```
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 106 KiB |
@@ -4,6 +4,6 @@ tags: About
|
||||
title: Releases
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
New releases of TiddlyWiki, TiddlyDesktop and TiddlyFox are announced via the [[official discussion groups|Forums]] and [[Twitter|https://twitter.com/TiddlyWiki]] (you can also subscribe to an Atom/RSS feed of [[TiddlyWiki releases from GitHub|https://github.com/jermolene/tiddlywiki5/releases.atom]])
|
||||
New releases of TiddlyWiki and TiddlyDesktop are announced via the [[official discussion groups|Forums]] and [[Twitter|https://twitter.com/TiddlyWiki]] (you can also subscribe to an Atom/RSS feed of [[TiddlyWiki releases from GitHub|https://github.com/jermolene/tiddlywiki5/releases.atom]])
|
||||
|
||||
<<tabs "[[TiddlyWiki Releases]] [[TiddlyDesktop Releases]]" "TiddlyWiki Releases" "$:/state/tab">>
|
||||
|
||||
@@ -18,6 +18,8 @@ CopyToClipboard/Caption: copier dans le presse-papier
|
||||
CopyToClipboard/Hint: Copie ce texte dans le presse-papier
|
||||
Delete/Caption: supprimer
|
||||
Delete/Hint: Supprime ce tiddler
|
||||
DeleteTiddlers/Caption: supprimer les tiddlers
|
||||
DeleteTiddlers/Hint: Supprime ces tiddlers
|
||||
Edit/Caption: éditer
|
||||
Edit/Hint: Édite ce tiddler
|
||||
Encryption/Caption: chiffrement
|
||||
|
||||
@@ -7,8 +7,9 @@ ClassicWarning/Upgrade/Caption: mettre à jour
|
||||
CloseAll/Button: tout fermer
|
||||
ColourPicker/Recent: Récent :
|
||||
ConfirmCancelTiddler: Souhaitez-vous annuler les modifications apportées au tiddler « <$text text=<<title>>/> » ?
|
||||
ConfirmDeleteTiddler: Souhaitez-vous supprimer le tiddler « <$text text=<<title>>/> » ?
|
||||
ConfirmOverwriteTiddler: Souhaitez-vous supplanter le tiddler « <$text text=<<title>>/> » ?
|
||||
ConfirmDeleteTiddler: Souhaitez-vous supprimer le tiddler « <$text text=<<title>>/> » ?
|
||||
ConfirmDeleteTiddlers: Êtes-vous sûr•e de vouloir supprimer <<resultCount>> tiddler(s) ?
|
||||
ConfirmOverwriteTiddler: Souhaitez-vous supplanter le tiddler « <$text text=<<title>>/> » ?
|
||||
ConfirmEditShadowTiddler: Vous êtes sur le point d'éditer un ShadowTiddler. Toute modification supplantera la version par défaut du système, rendant les prochaines mises à jour non-triviales. Êtes-vous sûr(e) de vouloir éditer "<$text text=<<title>>/>"?
|
||||
ConfirmAction: Souhaitez-vous poursuivre ?
|
||||
Count: total
|
||||
|
||||
@@ -107,7 +107,7 @@ Plugins/Updates/Caption: 更新
|
||||
Plugins/Updates/Hint: インストールされているプラグインの更新が可能です
|
||||
Plugins/Updates/UpdateAll/Caption: <<update-count>> プラグインの更新
|
||||
Saving/Caption: 保存
|
||||
Saving/DownloadSaver/AutoSave/Description: ダウンロードセーバーの自動保存を許可します
|
||||
Saving/DownloadSaver/AutoSave/Description: ダウンロードセーバーの自動保存を許可
|
||||
Saving/DownloadSaver/AutoSave/Hint: ダウンロードセーバーの自動保存を有効にします
|
||||
Saving/DownloadSaver/Caption: ダウンロードセーバー
|
||||
Saving/DownloadSaver/Hint: この設定は HTML5 対応ダウンロードセーバーに適用されます
|
||||
@@ -148,7 +148,7 @@ Settings/AutoSave/Disabled/Description: 自動的に保存しない
|
||||
Settings/AutoSave/Enabled/Description: 自動的に保存する
|
||||
Settings/AutoSave/Hint: 自動的に保存するかどうかを設定します
|
||||
Settings/CamelCase/Caption: Camel Case Wiki リンク
|
||||
Settings/CamelCase/Description: 自動で ~CamelCase リンクを有効にします
|
||||
Settings/CamelCase/Description: 自動で ~CamelCase リンクを有効にする
|
||||
Settings/CamelCase/Hint: ~CamelCase フレーズの自動リンクをグローバルに無効にすることができます。有効にするには再読み込みが必要です
|
||||
Settings/Caption: 設定
|
||||
Settings/DefaultMoreSidebarTab/Caption: デフォルトのサイドバー 詳しく タブ
|
||||
@@ -156,13 +156,13 @@ Settings/DefaultMoreSidebarTab/Hint: デフォルトで表示されるサイド
|
||||
Settings/DefaultSidebarTab/Caption: 標準サイドバータブ
|
||||
Settings/DefaultSidebarTab/Hint: 標準で表示されるサイドバータブを指定します
|
||||
Settings/EditorToolbar/Caption: エディターツールバー
|
||||
Settings/EditorToolbar/Description: エディターツールバーを表示します
|
||||
Settings/EditorToolbar/Description: エディターツールバーを表示
|
||||
Settings/EditorToolbar/Hint: エディターツールバーの有効・無効を切り替えます:
|
||||
Settings/Hint: TiddlyWiki の動作を設定します
|
||||
Settings/InfoPanelMode/Caption: Tiddler 情報パネルモード
|
||||
Settings/InfoPanelMode/Hint: Tiddler 情報パネルが閉じる時間:
|
||||
Settings/InfoPanelMode/Popup/Description: Tiddler 情報パネルが自動的に閉じるタイミングを制御します
|
||||
Settings/InfoPanelMode/Sticky/Description: Tiddler 情報パネルは、明示的に閉じるまで開いたままになります
|
||||
Settings/InfoPanelMode/Popup/Description: Tiddler 情報パネルが自動的に閉じるタイミングを制御する
|
||||
Settings/InfoPanelMode/Sticky/Description: Tiddler 情報パネルを明示的に閉じるまで開いたままにする
|
||||
Settings/LinkToBehaviour/Caption: Tiddler を開く動作
|
||||
Settings/LinkToBehaviour/InsideRiver/Hint: Tiddler 表示部 //内// の動作
|
||||
Settings/LinkToBehaviour/OpenAbove: 現在の Tiddler 上に開く
|
||||
@@ -171,13 +171,13 @@ Settings/LinkToBehaviour/OpenAtTop: Tiddler 表示部の上に開く
|
||||
Settings/LinkToBehaviour/OpenBelow: 現在の Tiddler 下に開く
|
||||
Settings/LinkToBehaviour/OutsideRiver/Hint: Tiddler 表示部 //外// の動作
|
||||
Settings/MissingLinks/Caption: Wiki リンク
|
||||
Settings/MissingLinks/Description: 欠落している Tiddler へのリンクを有効にします
|
||||
Settings/MissingLinks/Description: 欠落 Tiddler へのリンクを有効にする
|
||||
Settings/MissingLinks/Hint: まだ存在しない Tiddler にリンクするかどうかを選択します
|
||||
Settings/NavigationAddressBar/Caption: ナビゲーションアドレスバー
|
||||
Settings/NavigationAddressBar/Hint: ナビゲーションアドレスバーの動作:
|
||||
Settings/NavigationAddressBar/No/Description: アドレスバーを変更しない
|
||||
Settings/NavigationAddressBar/Permalink/Description: Tiddler をアドレスに含める
|
||||
Settings/NavigationAddressBar/Permaview/Description: 開く Tiddler と現在開いている Tiddler をアドレスに含めます
|
||||
Settings/NavigationAddressBar/Permaview/Description: 開く Tiddler と現在開いている Tiddler をアドレスに含める
|
||||
Settings/NavigationHistory/Caption: 操作履歴
|
||||
Settings/NavigationHistory/Hint: Tiddler を操作したときのブラウザの履歴の設定:
|
||||
Settings/NavigationHistory/No/Description: 履歴を残さない
|
||||
@@ -215,7 +215,7 @@ Theme/Prompt: 現在のテーマ:
|
||||
TiddlerColour/Caption: Tiddler の色
|
||||
TiddlerColour/Hint: このルールカスケードは、Tiddler の色(アイコンと関連するタグピルに使用される)を動的に選択するために使用されます。
|
||||
TiddlerFields/Caption: Tiddler 項目
|
||||
TiddlerFields/Hint: 以下はこの TiddlyWiki で使用されているすべての Tiddler 項目の一覧です(システム Tiddler も含みますが、隠し Tiddler は含んでいません)。
|
||||
TiddlerFields/Hint: 以下はこの TiddlyWiki で使用されているすべての Tiddler 項目の一覧です(システム Tiddler も含みますが、隠し Tiddler は含んでいません)
|
||||
TiddlerIcon/Caption: Tiddler アイコン
|
||||
TiddlerIcon/Hint: このルールカスケードは Tiddler のアイコンを動的に選択するために使用されます。
|
||||
Toolbars/Caption: ツールバー
|
||||
|
||||
@@ -18,6 +18,8 @@ CopyToClipboard/Caption: 复制到剪贴板
|
||||
CopyToClipboard/Hint: 将此文本复制到剪贴板
|
||||
Delete/Caption: 删除
|
||||
Delete/Hint: 删除此条目
|
||||
DeleteTiddlers/Caption: 删除条目
|
||||
DeleteTiddlers/Hint: 删除条目
|
||||
Edit/Caption: 编辑
|
||||
Edit/Hint: 编辑此条目
|
||||
Encryption/Caption: 加密
|
||||
|
||||
@@ -24,7 +24,7 @@ Basics/Subtitle/Prompt: 副标题
|
||||
Basics/SystemTiddlers/Prompt: 系统条目数量
|
||||
Basics/Tags/Prompt: 标签数量
|
||||
Basics/Tiddlers/Prompt: 一般条目数量
|
||||
Basics/Title/Prompt: 标题
|
||||
Basics/Title/Prompt: 此 ~TiddlyWiki 的标题
|
||||
Basics/Username/Prompt: 编辑者署名
|
||||
Basics/Version/Prompt: ~TiddlyWiki 版本
|
||||
Cascades/Caption: 级联
|
||||
|
||||
@@ -9,9 +9,10 @@ title: GettingStarted
|
||||
|
||||
<div class="tc-control-panel">
|
||||
|
||||
|<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
|tc-table-no-border tc-first-col-min-width tc-first-link-nowrap|k
|
||||
| <$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link>|<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
| <$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link>|<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|^ <$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link><br><<lingo DefaultTiddlers/TopHint>>|<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
</div>
|
||||
|
||||
请参阅[[控制台|$:/ControlPanel]]查看更多选项。
|
||||
@@ -8,6 +8,7 @@ CloseAll/Button: 全部关闭
|
||||
ColourPicker/Recent: 最近︰
|
||||
ConfirmCancelTiddler: 您确定要放弃对条目 "<$text text=<<title>>/>" 的更改?
|
||||
ConfirmDeleteTiddler: 您确定要删除条目 "<$text text=<<title>>/>"?
|
||||
ConfirmDeleteTiddlers: 您确定要删除 <<resultCount>> 个条目?
|
||||
ConfirmOverwriteTiddler: 您确定要复写条目 "<$text text=<<title>>/>"?
|
||||
ConfirmEditShadowTiddler: 您即将要编辑默认条目,任何更改将会复盖默认的系统,使未来的升级不寻常。您确定要编辑 "<$text text=<<title>>/>"?
|
||||
ConfirmAction: 是否要继续?
|
||||
|
||||
@@ -18,6 +18,8 @@ CopyToClipboard/Caption: 複製到剪貼簿
|
||||
CopyToClipboard/Hint: 將此文字複製到剪貼簿
|
||||
Delete/Caption: 刪除
|
||||
Delete/Hint: 刪除此條目
|
||||
DeleteTiddlers/Caption: 刪除條目
|
||||
DeleteTiddlers/Hint: 刪除條目
|
||||
Edit/Caption: 編輯
|
||||
Edit/Hint: 編輯此條目
|
||||
Encryption/Caption: 加密
|
||||
|
||||
@@ -24,7 +24,7 @@ Basics/Subtitle/Prompt: 副標題
|
||||
Basics/SystemTiddlers/Prompt: 系統條目數量
|
||||
Basics/Tags/Prompt: 標籤數量
|
||||
Basics/Tiddlers/Prompt: 一般條目數量
|
||||
Basics/Title/Prompt: 標題
|
||||
Basics/Title/Prompt: 此 ~TiddlyWiki 的標題
|
||||
Basics/Username/Prompt: 編輯者署名
|
||||
Basics/Version/Prompt: ~TiddlyWiki 版本
|
||||
Cascades/Caption: 級聯
|
||||
|
||||
@@ -9,9 +9,10 @@ title: GettingStarted
|
||||
|
||||
<div class="tc-control-panel">
|
||||
|
||||
|<$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link> |<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
|<$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link> |<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
|tc-table-no-border tc-first-col-min-width tc-first-link-nowrap|k
|
||||
| <$link to="$:/SiteTitle"><<lingo Title/Prompt>></$link>|<$edit-text tiddler="$:/SiteTitle" default="" tag="input"/> |
|
||||
| <$link to="$:/SiteSubtitle"><<lingo Subtitle/Prompt>></$link>|<$edit-text tiddler="$:/SiteSubtitle" default="" tag="input"/> |
|
||||
|^ <$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link><br><<lingo DefaultTiddlers/TopHint>>|<$edit tag="textarea" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|
||||
</div>
|
||||
|
||||
請參閱[[控制台|$:/ControlPanel]]查看更多選項。
|
||||
@@ -8,6 +8,7 @@ CloseAll/Button: 全部關閉
|
||||
ColourPicker/Recent: 最近︰
|
||||
ConfirmCancelTiddler: 您確定要放棄對條目 "<$text text=<<title>>/>" 的更改?
|
||||
ConfirmDeleteTiddler: 您確定要刪除條目 "<$text text=<<title>>/>"?
|
||||
ConfirmDeleteTiddlers: 您確定要刪除 <<resultCount>> 個條目?
|
||||
ConfirmOverwriteTiddler: 您確定要覆寫條目 "<$text text=<<title>>/>"?
|
||||
ConfirmEditShadowTiddler: 您即將要編輯預設條目,任何更改將會覆蓋預設的系統,使未來的升級不尋常。您確定要編輯 "<$text text=<<title>>/>"?
|
||||
ConfirmAction: 是否要繼續?
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "tiddlywiki",
|
||||
"preferGlobal": "true",
|
||||
"version": "5.2.3",
|
||||
"version": "5.2.4-prerelease",
|
||||
"author": "Jeremy Ruston <jeremy@jermolene.com>",
|
||||
"description": "a non-linear personal web notebook",
|
||||
"contributors": [
|
||||
|
||||
@@ -108,11 +108,11 @@ The selection tracker triggers an action string whenever the browser text select
|
||||
|
||||
The selection tracker works within DOM subtrees that have the following structure:
|
||||
|
||||
* The outer wrapper element has the attribute `data-selection-action-title` containing the title of the tiddler containing the action string to be invoked when the selection changes
|
||||
* The outer wrapper element has the attribute `data-selection-actions-title` containing the title of the tiddler containing the action string to be invoked when the selection changes
|
||||
* Each child element of the outer element must have a unique `id` attribute to identify it
|
||||
|
||||
```
|
||||
<div data-selection-action-title="{tiddler title}">
|
||||
<div data-selection-actions-title="{tiddler title}">
|
||||
<div id="{title}">
|
||||
Content text
|
||||
</div>
|
||||
|
||||
@@ -3,13 +3,121 @@ tags: $:/tags/EditPreview
|
||||
list-after: $:/core/ui/EditTemplate/body/preview/output
|
||||
caption: parse tree
|
||||
|
||||
\define preview(mode)
|
||||
<$wikify name="preview-text" text={{!!text}} type={{!!type}} mode="$mode$" output="parsetree">
|
||||
<pre>
|
||||
<code>
|
||||
<$text text=<<preview-text>>/>
|
||||
</code>
|
||||
</pre>
|
||||
\whitespace trim
|
||||
|
||||
\procedure preview-node-properties(node)
|
||||
<$let excludeProperties="text type tag children attributes orderedAttributes">
|
||||
<$list filter="[<node>jsonindexes[]] -[subfilter<excludeProperties>] +[limit[1]]" variable="ignore">
|
||||
<table>
|
||||
<tbody>
|
||||
<$list filter="[<node>jsonindexes[]] -[subfilter<excludeProperties>] +[sort[]]" variable="index">
|
||||
<tr>
|
||||
<td>
|
||||
<$text text=<<index>>/>
|
||||
</td>
|
||||
<td>
|
||||
<$text text={{{ [<node>jsonget<index>] }}}/>
|
||||
</td>
|
||||
</tr>
|
||||
</$list>
|
||||
</tbody>
|
||||
</table>
|
||||
</$list>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\procedure preview-node-attribute-string(attribute)
|
||||
<$text text={{{ [<attribute>jsonget[value]] }}}/>
|
||||
\end
|
||||
|
||||
\procedure preview-node-attribute-indirect(attribute)
|
||||
{{<$text text={{{ [<attribute>jsonget[textReference]] }}}/>}}
|
||||
\end
|
||||
|
||||
\procedure preview-node-attribute-macro(attribute)
|
||||
<<
|
||||
<$text text={{{ [<attribute>jsonget[value],[name]] }}}/>
|
||||
<$list filter="[<attribute>jsonindexes[value],[params]]" variable="index">
|
||||
|
||||
<$list filter="[<attribute>jsonget[value],[params],<index>,[name]]" variable="ignore">
|
||||
<$text text={{{ [<attribute>jsonget[value],[params],<index>,[name]] }}}/>
|
||||
:
|
||||
</$list>
|
||||
<$text text={{{ [<attribute>jsonget[value],[params],<index>,[value]] }}}/>
|
||||
</$list>
|
||||
>>
|
||||
\end
|
||||
|
||||
\procedure preview-node-attributes(node)
|
||||
<$list filter="[<node>jsonindexes[attributes]limit[1]]" variable="ignore">
|
||||
<table>
|
||||
<tbody>
|
||||
<$list filter="[<node>jsonindexes[attributes]sort[]]" variable="index">
|
||||
<tr>
|
||||
<td>
|
||||
<$text text=<<index>>/>
|
||||
</td>
|
||||
<td>
|
||||
<$let type={{{ [<node>jsonget[attributes],<index>,[type]] }}}>
|
||||
<$transclude $variable={{{ [<type>match[string]then[preview-node-attribute-string]] :else[<type>match[indirect]then[preview-node-attribute-indirect]] :else[<type>match[macro]then[preview-node-attribute-macro]] }}} attribute={{{ [<node>jsonget[attributes],<index>] }}}/>
|
||||
</$let>
|
||||
</td>
|
||||
</tr>
|
||||
</$list>
|
||||
</tbody>
|
||||
</table>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\procedure preview-node-children(node)
|
||||
<div style="padding:4px 4px 0 4px;">
|
||||
<$transclude $variable="preview-node-properties" node=<<node>>/>
|
||||
<$transclude $variable="preview-node-attributes" node=<<node>>/>
|
||||
<$transclude $variable="preview-node-list" nodeList={{{ [<node>jsonget[children]] }}}/>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\procedure preview-node-title-widget(node)
|
||||
<div style="border:2px solid red;margin:4px;">
|
||||
<div style="background:red;color:white;padding:4px;">
|
||||
<$<$text text={{{ [<node>jsonget[type]] }}}/>>
|
||||
</div>
|
||||
<$transclude $variable="preview-node-children" node=<<node>>/>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\procedure preview-node-title-element(node)
|
||||
<div style="border:2px solid purple;margin:4px;">
|
||||
<div style="background:purple;color:white;padding:4px;">
|
||||
<<$text text={{{ [<node>jsonget[tag]] }}}/>>
|
||||
</div>
|
||||
<$transclude $variable="preview-node-children" node=<<node>>/>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\procedure preview-node-title-text(node)
|
||||
<div style="border:2px solid green;margin:4px;">
|
||||
<div style="background:green;color:white;padding:4px;">
|
||||
<span style="color:#ff0;font-weight:bold;">"</span><span style="white-space:pre-wrap;"><$text text={{{ [<node>jsonget[text]] }}}/></span><span style="color:#ff0;font-weight:bold;">"</span>
|
||||
</div>
|
||||
</div>
|
||||
\end
|
||||
|
||||
\procedure preview-node(node)
|
||||
<$let type={{{ [<node>jsonget[type]] }}}>
|
||||
<$transclude $variable={{{ [<type>match[element]then[preview-node-title-element]] :else[<type>match[text]then[preview-node-title-text]] :else[[preview-node-title-widget]] }}} node=<<node>>/>
|
||||
</$let>
|
||||
\end
|
||||
|
||||
\procedure preview-node-list(nodeList)
|
||||
<$list filter="[<nodeList>jsonindexes[]]" variable="index">
|
||||
<$transclude $variable="preview-node" node={{{ [<nodeList>jsonget<index>] }}}/>
|
||||
</$list>
|
||||
\end
|
||||
|
||||
\procedure preview(mode)
|
||||
<$wikify name="preview-json" text={{!!text}} type={{!!type}} mode=<<mode>> output="parsetree">
|
||||
<$transclude $variable="preview-node-list" nodeList=<<preview-json>>/>
|
||||
</$wikify>
|
||||
\end
|
||||
|
||||
|
||||
@@ -10,6 +10,10 @@ tags: $:/tags/Macro
|
||||
<$list filter="""$(editFieldsFilter)$""" variable="editorField">
|
||||
<$edit-text tag="$(editorTagName)$" field=<<editorField>> type="text" class="tc-edit-texteditor" minHeight="10px"/>
|
||||
</$list>
|
||||
<$reveal state="$:/state/showEnglishText" type=match text="show" tag="p">
|
||||
Default text:
|
||||
<pre><code><$view tiddler="$:/core" subtiddler=<<currentTiddler>> field=<<editorField>>/></code></pre>
|
||||
</$reveal>
|
||||
</td>
|
||||
<td width="20px">
|
||||
<div class="tc-drop-down-wrapper">
|
||||
@@ -60,6 +64,8 @@ Delete translation
|
||||
|
||||
//<$count filter=<<translatableTiddlerTitles>>/> translatable tiddlers in this group//
|
||||
|
||||
<$checkbox tiddler="$:/state/showEnglishText" field="text" checked="show" unchecked="hide" default="hide"> Show the default text below editor field</$checkbox>
|
||||
|
||||
<$radio tiddler="$:/plugins/tiddlywiki/translators/editorTag" value="textarea"> Multi-line editors</$radio><br>
|
||||
<$radio tiddler="$:/plugins/tiddlywiki/translators/editorTag" value="input"> Single-line editors</$radio>
|
||||
|
||||
|
||||
@@ -12,4 +12,9 @@ tags: $:/tags/Stylesheet
|
||||
|
||||
.tc-translators-string-table .tc-drop-down {
|
||||
min-width: 500px;
|
||||
}
|
||||
|
||||
.tc-tiddler-frame textarea.tc-edit-texteditor,
|
||||
.tc-tiddler-frame input.tc-edit-texteditor {
|
||||
background-color: #feffef;
|
||||
}
|
||||
@@ -76,16 +76,17 @@ $else$
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
||||
input[type="search"] {
|
||||
outline-offset: initial;
|
||||
}
|
||||
|
||||
/*
|
||||
** Button default styles. Makes them look consistent for all browsers
|
||||
*/
|
||||
html button {
|
||||
line-height: 1.2;
|
||||
color: <<colour button-foreground>>;
|
||||
fill: <<colour button-foreground>>;
|
||||
background: <<colour button-background>>;
|
||||
border-color: <<colour button-border>>;
|
||||
border: 1px solid <<colour button-border>>;
|
||||
border-radius: 3px;
|
||||
padding: 2px 5px;
|
||||
}
|
||||
|
||||
button:disabled svg {
|
||||
@@ -221,8 +222,19 @@ dl dt {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
button, textarea, input, select {
|
||||
outline-color: <<colour primary>>;
|
||||
/*
|
||||
** Definition for text input elements so they look consistent for all browsers
|
||||
*/
|
||||
|
||||
textarea, input, select {
|
||||
border: 2px solid <<colour tiddler-editor-border>>;
|
||||
background-color: <<colour tiddler-editor-background>>;
|
||||
}
|
||||
|
||||
/* Input elements accessibility -- overwrite the reset */
|
||||
:focus-visible {
|
||||
outline: 2px solid <<colour primary>>;
|
||||
outline-offset: -2px; /* same as in reset.css [type='search'] but for more elements */
|
||||
}
|
||||
|
||||
textarea,
|
||||
@@ -231,7 +243,6 @@ input[type=search],
|
||||
input[type=""],
|
||||
input:not([type]) {
|
||||
color: <<colour foreground>>;
|
||||
background: <<colour background>>;
|
||||
}
|
||||
|
||||
input[type="checkbox"] {
|
||||
@@ -293,6 +304,10 @@ pre > code {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
/*
|
||||
Table defaults
|
||||
*/
|
||||
|
||||
table {
|
||||
border: 1px solid <<colour table-border>>;
|
||||
width: auto;
|
||||
@@ -320,10 +335,40 @@ table tfoot tr td {
|
||||
background-color: <<colour table-footer-background>>;
|
||||
}
|
||||
|
||||
/*
|
||||
Table utility classes
|
||||
*/
|
||||
|
||||
/* Remove borders from table as used in eg: GettingStarted*/
|
||||
.tc-table-no-border,
|
||||
.tc-table-no-border th,
|
||||
.tc-table-no-border td {
|
||||
border: initial;
|
||||
}
|
||||
|
||||
/* First column in table width will fit to text.*/
|
||||
/* This rule makes most sense with tc-first-link-nowrap*/
|
||||
.tc-first-col-min-width td:nth-child(1) {
|
||||
width: 1%;
|
||||
}
|
||||
|
||||
/* First link A element will not wrap */
|
||||
.tc-first-link-nowrap:first-of-type a {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*
|
||||
CSV parser plugin
|
||||
*/
|
||||
|
||||
.tc-csv-table {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/*
|
||||
Tiddler frame in story river
|
||||
*/
|
||||
|
||||
.tc-tiddler-frame img,
|
||||
.tc-tiddler-frame svg,
|
||||
.tc-tiddler-frame canvas,
|
||||
@@ -352,6 +397,7 @@ a.tc-tiddlylink {
|
||||
font-weight: 500;
|
||||
color: <<colour tiddler-link-foreground>>;
|
||||
-webkit-user-select: inherit; /* Otherwise the draggable attribute makes links impossible to select */
|
||||
-webkit-touch-callout: none; /* Prevents long presses from bringing up a link preview */
|
||||
}
|
||||
|
||||
.tc-sidebar-lists a.tc-tiddlylink {
|
||||
@@ -1140,6 +1186,7 @@ button.tc-btn-invisible.tc-remove-tag-button {
|
||||
|
||||
.tc-tiddler-frame .tc-tiddler-controls {
|
||||
float: right;
|
||||
padding: 3px; /* make space for outline */
|
||||
}
|
||||
|
||||
.tc-tiddler-controls .tc-drop-down {
|
||||
|
||||
Reference in New Issue
Block a user