1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-01-24 16:06:58 +00:00

Merge branch 'master' into parameterised-transclusions

This commit is contained in:
jeremy@jermolene.com 2022-11-22 16:29:45 +00:00
commit 45958db074
29 changed files with 853 additions and 113 deletions

View File

@ -9,6 +9,7 @@ node ./tiddlywiki.js \
--verbose \
--version \
--rendertiddler $:/core/save/all test.html text/plain \
--test \
|| exit 1
echo To run the tests in a browser, open "editions/test/output/test.html"

View File

@ -13,6 +13,11 @@ The CSV text parser processes CSV files into a table wrapped in a scrollable wid
"use strict";
var CsvParser = function(type,text,options) {
// Special handler for tab-delimited files
if (type === 'text/tab-delimited-values' && !options.separator) {
options.separator = "\t";
}
// Table framework
this.tree = [{
"type": "scrollable", "children": [{
@ -24,32 +29,35 @@ var CsvParser = function(type,text,options) {
}]
}];
// Split the text into lines
var lines = text.split(/\r?\n/mg),
var lines = $tw.utils.parseCsvString(text, options),
tag = "th";
var maxColumns = 0;
$tw.utils.each(lines, function(columns) {
maxColumns = Math.max(columns.length, maxColumns);
});
for(var line=0; line<lines.length; line++) {
var lineText = lines[line];
if(lineText) {
var row = {
"type": "element", "tag": "tr", "children": []
};
var columns = lineText.split(",");
for(var column=0; column<columns.length; column++) {
row.children.push({
"type": "element", "tag": tag, "children": [{
"type": "text",
"text": columns[column]
}]
});
}
tag = "td";
this.tree[0].children[0].children[0].children.push(row);
var columns = lines[line];
var row = {
"type": "element", "tag": "tr", "children": []
};
for(var column=0; column<maxColumns; column++) {
row.children.push({
"type": "element", "tag": tag, "children": [{
"type": "text",
"text": columns[column] || ''
}]
});
}
tag = "td";
this.tree[0].children[0].children[0].children.push(row);
}
this.source = text;
this.type = type;
};
exports["text/csv"] = CsvParser;
exports["text/tab-delimited-values"] = CsvParser;
})();

View File

@ -121,7 +121,11 @@ exports.startup = function() {
});
// Set up the syncer object if we've got a syncadaptor
if($tw.syncadaptor) {
$tw.syncer = new $tw.Syncer({wiki: $tw.wiki, syncadaptor: $tw.syncadaptor});
$tw.syncer = new $tw.Syncer({
wiki: $tw.wiki,
syncadaptor: $tw.syncadaptor,
logging: $tw.wiki.getTiddlerText('$:/config/SyncLogging', "yes") === "yes"
});
}
// Setup the saver handler
$tw.saverHandler = new $tw.SaverHandler({

View File

@ -12,35 +12,113 @@ A barebones CSV parser
/*global $tw: false */
"use strict";
var QUOTE = '"';
var getCellInfo = function(text, start, length, SEPARATOR) {
var isCellQuoted = text.charAt(start) === QUOTE;
var cellStart = isCellQuoted ? start + 1 : start;
if (text.charAt(i) === SEPARATOR) {
return [cellStart, cellStart, false];
}
for (var i = cellStart; i < length; i++) {
var cellCharacter = text.charAt(i);
var isEOL = cellCharacter === "\n" || cellCharacter === "\r";
if (isEOL && !isCellQuoted) {
return [cellStart, i, false];
} else if (cellCharacter === SEPARATOR && !isCellQuoted) {
return [cellStart, i, false];
} else if (cellCharacter === QUOTE && isCellQuoted) {
var nextCharacter = i + 1 < length ? text.charAt(i + 1) : '';
if (nextCharacter !== QUOTE) {
return [cellStart, i, true];
} else {
i++;
}
}
}
return [cellStart, i, isCellQuoted];
}
exports.parseCsvString = function(text, options) {
if (!text) {
return [];
}
options = options || {};
var SEPARATOR = options.separator || ",",
length = text.length,
rows = [],
nextRow = [];
for (var i = 0; i < length; i++) {
var cellInfo = getCellInfo(text, i, length, SEPARATOR);
var cellText = text.substring(cellInfo[0], cellInfo[1]);
if (cellInfo[2]) {
cellText = cellText.replace(/""/g, '"');
cellInfo[1]++;
}
nextRow.push(cellText);
i = cellInfo[1];
var character = text.charAt(i);
var nextCharacter = i + 1 < length ? text.charAt(i + 1) : '';
if (character === "\r" || character === "\n") {
// Edge case for empty rows
if (nextRow.length === 1 && nextRow[0] === '') {
nextRow.length = 0;
}
rows.push(nextRow);
nextRow = [];
if (character === "\r") {
var nextCharacter = i + 1 < length ? text.charAt(i + 1) : '';
if (nextCharacter === "\n") {
i++;
}
}
}
}
// Special case if last cell in last row is an empty cell
if (text.charAt(length - 1) === SEPARATOR) {
nextRow.push("");
}
rows.push(nextRow);
return rows;
}
/*
Parse a CSV string with a header row and return an array of hashmaps.
*/
exports.parseCsvStringWithHeader = function(text,options) {
options = options || {};
var separator = options.separator || ",",
rows = text.split(/\r?\n/mg).map(function(row) {
return $tw.utils.trim(row);
}).filter(function(row) {
return row !== "";
});
if(rows.length < 1) {
return "Missing header row";
}
var headings = rows[0].split(separator),
results = [];
for(var row=1; row<rows.length; row++) {
var columns = rows[row].split(separator),
columnResult = Object.create(null);
if(columns.length !== headings.length) {
return "Malformed CSV row '" + rows[row] + "'";
var csv = $tw.utils.parseCsvString(text, options);
var headers = csv[0];
csv = csv.slice(1);
for (var i = 0; i < csv.length; i++) {
var row = csv[i];
var rowObject = Object.create(null);
for(var columnIndex=0; columnIndex<headers.length; columnIndex++) {
var columnName = headers[columnIndex];
if (columnName) {
rowObject[columnName] = $tw.utils.trim(row[columnIndex] || "");
}
}
for(var column=0; column<columns.length; column++) {
var columnName = headings[column];
columnResult[columnName] = $tw.utils.trim(columns[column] || "");
}
results.push(columnResult);
csv[i] = rowObject;
}
return results;
return csv;
}
})();

View File

@ -354,6 +354,9 @@ exports.formatDateString = function(date,template) {
var result = "",
t = template,
matches = [
[/^TIMESTAMP/, function() {
return date.getTime();
}],
[/^0hh12/, function() {
return $tw.utils.pad($tw.utils.getHours12(date));
}],

View File

@ -20,15 +20,16 @@ caption: {{$:/language/ControlPanel/Basics/Caption}}
\end
\whitespace trim
|tc-max-width tc-edit-max-width|k
|<<lingo Version/Prompt>> |''<<version>>'' |
|<$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="$:/status/UserName"><<lingo Username/Prompt>></$link> |<$edit-text tiddler="$:/status/UserName" default="" tag="input"/> |
|<$link to="$:/config/AnimationDuration"><<lingo AnimDuration/Prompt>></$link> |<$edit-text tiddler="$:/config/AnimationDuration" default="" tag="input"/> |
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit tag="textarea" tiddler="$:/DefaultTiddlers" class="tc-edit-texteditor"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|<$link to="$:/DefaultTiddlers"><<lingo DefaultTiddlers/Prompt>></$link> |<<lingo DefaultTiddlers/TopHint>><br> <$edit class="tc-edit-texteditor" tiddler="$:/DefaultTiddlers"/><br>//<<lingo DefaultTiddlers/BottomHint>>// |
|<$link to="$:/language/DefaultNewTiddlerTitle"><<lingo NewTiddler/Title/Prompt>></$link> |<$edit-text tiddler="$:/language/DefaultNewTiddlerTitle" default="" tag="input"/> |
|<$link to="$:/config/NewJournal/Title"><<lingo NewJournal/Title/Prompt>></$link> |<$edit-text tiddler="$:/config/NewJournal/Title" default="" tag="input"/> |
|<$link to="$:/config/NewJournal/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" tag="textarea" class="tc-edit-texteditor" default=""/> |
|<$link to="$:/config/NewJournal/Text"><<lingo NewJournal/Text/Prompt>></$link> |<$edit tiddler="$:/config/NewJournal/Text" class="tc-edit-texteditor" default=""/> |
|<$link to="$:/config/NewTiddler/Tags"><<lingo NewTiddler/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewTiddler/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|<$link to="$:/config/NewJournal/Tags"><<lingo NewJournal/Tags/Prompt>></$link> |<$vars currentTiddler="$:/config/NewJournal/Tags" tagField="text">{{||$:/core/ui/EditTemplate/tags}}<$list filter="[<currentTiddler>tags[]] +[limit[1]]" variable="ignore"><$button tooltip={{$:/language/ControlPanel/Basics/RemoveTags/Hint}}><<lingo RemoveTags>><$action-listops $tiddler=<<currentTiddler>> $field="text" $subfilter={{{ [<currentTiddler>get[tags]] }}}/><$action-setfield $tiddler=<<currentTiddler>> tags=""/></$button></$list></$vars> |
|<$link to="$:/config/AutoFocus"><<lingo AutoFocus/Prompt>></$link> |{{$:/snippets/minifocusswitcher}} |

View File

@ -1,6 +1,6 @@
caption: 5.2.4
created: 20221101094408196
modified: 20221101094408196
created: 20221116172656216
modified: 20221116172656216
tags: ReleaseNotes
title: Release 5.2.4
type: text/vnd.tiddlywiki
@ -9,13 +9,14 @@ type: text/vnd.tiddlywiki
! Plugin Improvements
*
* New [[Twitter Archivist|./editions/twitter-archivist]] plugin to imports the tweets and associated media from a Twitter Archive as individual tiddlers
! Translation improvement
Improvements to the following translations:
* Chinese
* French
* Polish
* Spanish
* Japanese
@ -37,6 +38,7 @@ Improvements to the translation features of TiddlyWiki:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/36896c3db8c9678c0385a561996248a6f00a45ff">> opening a tiddler in a new window to use the [[View Template Body Cascade]]
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/6970">> detection of infinite recursion errors in widgets and filters
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/6877">> default styles for [[styled runs|Styles and Classes in WikiText]]
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/6881">> upgrade wizard to make the version number more prominent
! Widget Improvements
@ -55,7 +57,10 @@ Improvements to the translation features of TiddlyWiki:
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/166a1565843878083fb1eba47c73b8e67b78400d">> safe mode to prevent globally disabling parser rules
* <<.link-badge-removed "https://github.com/Jermolene/TiddlyWiki5/commit/1df4c29d73073788ba3859668112e8bb46171a6c">> restriction of the LetWidget being unable to create variables whose names begin with a dollar sign
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/6735">> keyboard shortcut handling to allow to global shortcuts to override all other shortcuts
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/commit/965bd090a905f5756e79124b698c894f7f72ad5b">> [[list-links Macro]] to allow the rendered field to be overriden
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/6913">> [[Table-of-Contents Macros]] to allow the default icons to be overridden
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6939">> ''data-tags-*'' and ''data-tiddler-title'' attributes to the edit preview area
* <<.link-badge-extended "https://github.com/Jermolene/TiddlyWiki5/pull/5947">> [[timeline Macro]] to override the link template
! Bug Fixes
@ -71,6 +76,9 @@ Improvements to the translation features of TiddlyWiki:
! Node.js Improvements
* <<.link-badge-improved "https://github.com/Jermolene/TiddlyWiki5/pull/6947">> console logging to avoid spaces and `<empty string>` message
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/pull/7014">> problem with lazy loading deleting tiddler bodies under certian circumstances
* <<.link-badge-fixed "https://github.com/Jermolene/TiddlyWiki5/commit/344110e2890caf711ab8f3c4f4deaa7d86771231">> handling of ".mp4" file extension so that it defaults to video not audio
* <<.link-badge-added "https://github.com/Jermolene/TiddlyWiki5/pull/6588">> test server to the plugin library edition
! Performance Improvements
@ -83,6 +91,7 @@ Improvements to the translation features of TiddlyWiki:
[[@Jermolene|https://github.com/Jermolene]] would like to thank the contributors to this release who have generously given their time to help improve TiddlyWiki:
<<.contributors """
AnthonyMuscio
bestony
btheado
BramChen

View File

@ -0,0 +1,282 @@
title: csv-cases
type: text/plain
description: A file containing a JSON with test CSVs as string as well as expected results
[
{
"name": "Empty string",
"options": {},
"csv": "",
"json": [],
"jsonWithHeaders": []
},
{
"name": "Null value",
"options": {},
"csv": null,
"json": [],
"jsonWithHeaders": []
},
{
"name": "Simple CSV with no tricks",
"options": {},
"csv": "cell-11,cell-12,cell-13\r\ncell-21,cell-22,cell-23\r\ncell-31,cell-32,cell-33",
"json": [
["cell-11", "cell-12", "cell-13"],
["cell-21", "cell-22", "cell-23"],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "cell-21", "cell-12": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Custom separator",
"options": {"separator": "\t"},
"csv": ",cell-11,\t,cell-12,\t,cell-13,\r\n,cell-21,\t,cell-22,\t,cell-23,\r\n,cell-31,\t,cell-32,\t,cell-33,",
"json": [
[",cell-11,", ",cell-12,", ",cell-13,"],
[",cell-21,", ",cell-22,", ",cell-23,"],
[",cell-31,", ",cell-32,", ",cell-33,"]
],
"jsonWithHeaders": [
{",cell-11,": ",cell-21,", ",cell-12,": ",cell-22,", ",cell-13,": ",cell-23,"},
{",cell-11,": ",cell-31,", ",cell-12,": ",cell-32,", ",cell-13,": ",cell-33,"}
]
},
{
"name": "Support empty rows",
"options": {},
"csv": "cell-11,cell-12,cell-13\r\n\r\ncell-31,cell-32,cell-33",
"json": [
["cell-11", "cell-12", "cell-13"],
[],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "", "cell-12": "", "cell-13": ""},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Support empty cells",
"options": {},
"csv": "cell-11,cell-12,cell-13\r\n,,\r\ncell-31,cell-32,cell-33",
"json": [
["cell-11", "cell-12", "cell-13"],
["", "", ""],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "", "cell-12": "", "cell-13": ""},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Support LF line endings",
"options": {},
"csv": "cell-11,cell-12,cell-13\ncell-21,cell-22,cell-23\ncell-31,cell-32,cell-33",
"json": [
["cell-11", "cell-12", "cell-13"],
["cell-21", "cell-22", "cell-23"],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "cell-21", "cell-12": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Mixed line endings",
"options": {},
"csv": "cell-11,cell-12,cell-13\ncell-21,cell-22,cell-23\r\ncell-31,cell-32,cell-33",
"json": [
["cell-11", "cell-12", "cell-13"],
["cell-21", "cell-22", "cell-23"],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "cell-21", "cell-12": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Quoted cells",
"options": {},
"csv": "cell-11,\"cell-12\",cell-13\r\n\"cell-21\",cell-22,cell-23\r\ncell-31,cell-32,\"cell-33\"",
"json": [
["cell-11", "cell-12", "cell-13"],
["cell-21", "cell-22", "cell-23"],
["cell-31", "cell-32", "cell-33"]
],
"jsonWithHeaders": [
{"cell-11": "cell-21", "cell-12": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", "cell-12": "cell-32", "cell-13": "cell-33"}
]
},
{
"name": "Escaped quotes in cells",
"options": {},
"csv": "cell-11,\"\"\"cell-12\"\"\",cell-13\r\n\"cell\"\"\"\"-21\",cell-22,cell-23\r\ncell-31,cell-32,\"\"\"\"\"cell\"\"\"\"-33\"\"\"\"\"",
"json": [
["cell-11", "\"cell-12\"", "cell-13"],
["cell\"\"-21", "cell-22", "cell-23"],
["cell-31", "cell-32", "\"\"cell\"\"-33\"\""]
],
"jsonWithHeaders": [
{"cell-11": "cell\"\"-21", "\"cell-12\"": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", "\"cell-12\"": "cell-32", "cell-13": "\"\"cell\"\"-33\"\""}
]
},
{
"name": "Separator in quoted cells",
"options": {},
"csv": "cell-11,\",c,e,l,l,-,1,2,\",cell-13\r\n\",c,e,l,l,-,2,1,\",cell-22,cell-23\r\ncell-31,cell-32,\",c,e,l,l,-,3,3,\"",
"json": [
["cell-11", ",c,e,l,l,-,1,2,", "cell-13"],
[",c,e,l,l,-,2,1,", "cell-22", "cell-23"],
["cell-31", "cell-32", ",c,e,l,l,-,3,3,"]
],
"jsonWithHeaders": [
{"cell-11": ",c,e,l,l,-,2,1,", ",c,e,l,l,-,1,2,": "cell-22", "cell-13": "cell-23"},
{"cell-11": "cell-31", ",c,e,l,l,-,1,2,": "cell-32", "cell-13": ",c,e,l,l,-,3,3,"}
]
},
{
"name": "UTF-8 characters",
"options": {},
"csv": "ᑖcell-11™,°cell-12ą,ćcell-13ś\r\nżcell-21ę,łcell-22ó,Ócell-23↑\r\nŹcell-31Ż,Ącell-32Ń,Ęcell-33ę",
"json": [
["ᑖcell-11™", "°cell-12ą", "ćcell-13ś"],
["żcell-21ę", "łcell-22ó", "Ócell-23↑"],
["Źcell-31Ż", "Ącell-32Ń", "Ęcell-33ę"]
],
"jsonWithHeaders": [
{"ᑖcell-11™": "żcell-21ę", "°cell-12ą": "łcell-22ó", "ćcell-13ś": "Ócell-23↑"},
{"ᑖcell-11™": "Źcell-31Ż", "°cell-12ą": "Ącell-32Ń", "ćcell-13ś": "Ęcell-33ę"}
]
},
{
"name": "All in one",
"options": {},
"csv": "\"\"\",\r\n,\"\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"\"\",ҡ͟¼lj·˨Քƣйʊ͕Έӕ,😣👁🔵⛔️🌹\r\n\"\"\",\r\n,\"\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"\"\",ҡ͟¼lj·˨Քƣйʊ͕Έӕ,😣👁🔵⛔️🌹\n\"\"\",\r\n,\"\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"\"\",ҡ͟¼lj·˨Քƣйʊ͕Έӕ,😣👁🔵⛔️🌹",
"json": [
["\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"],
["\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"],
["\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"]
],
"jsonWithHeaders": [
{"\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"": "\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ": "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹": "😣👁🔵⛔️🌹"},
{"\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"": "\",\r\n,\",\r\nĄŚĆżóŁ\n\n\n\r\n,\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ": "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹": "😣👁🔵⛔️🌹"}
]
},
{
"name": "All in one - custom separator",
"options": {"separator": "\t"},
"csv": "\"\"\"\t\r\n\t\"\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"\"\"\tҡ͟¼lj·˨Քƣйʊ͕Έӕ\t😣👁🔵⛔🌹\r\n\"\"\"\t\r\n\t\"\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"\"\"\tҡ͟¼lj·˨Քƣйʊ͕Έӕ\t😣👁🔵⛔🌹\n\"\"\"\t\r\n\t\"\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"\"\"\tҡ͟¼lj·˨Քƣйʊ͕Έӕ\t😣👁🔵⛔🌹",
"json": [
["\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"],
["\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"],
["\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹"]
],
"jsonWithHeaders": [
{"\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"": "\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ": "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹": "😣👁🔵⛔️🌹"},
{"\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"": "\"\t\r\n\t\"\t\r\nĄŚĆżóŁ\n\n\n\r\n\t\"", "ҡ͟¼lj·˨Քƣйʊ͕Έӕ": "ҡ͟¼lj·˨Քƣйʊ͕Έӕ", "😣👁🔵⛔️🌹": "😣👁🔵⛔️🌹"}
]
},
{
"name": "Edge case - only empty rows",
"options": {},
"csv": "\r\n\r\n",
"json": [
[],
[],
[]
],
"jsonWithHeaders": [
{},
{}
]
},
{
"name": "Edge case - only empty cells",
"options": {},
"csv": ",,\r\n,,\r\n,,",
"json": [
["", "", ""],
["", "", ""],
["", "", ""]
],
"jsonWithHeaders": [
{},
{}
]
},
{
"name": "Edge case - Newline -> Comma -> Text",
"options": {},
"csv": "A,B\r\n,C",
"json": [
["A", "B"],
["", "C"]
],
"jsonWithHeaders": [
{"A": "", "B": "C"}
]
},
{
"name": "Edge case - single comma",
"options": {},
"csv": ",",
"json": [
["", ""]
],
"jsonWithHeaders": []
},
{
"@comment": "The behavior here is undefined - the only thing that matters is it should not throw an exception, the result is free to make no sense.",
"name": "Edge case - quote separator",
"options": {"separator": "\""},
"csv": "cell-11,\"cell-12\",cell-13\r\n\"cell-21\",cell-22,cell-23\r\ncell-31,cell-32,\"cell-33\"",
"json": [
["cell-11,", "cell-12", ",cell-13"],
["cell-21", "cell-22,cell-23"],
["cell-31,cell-32,", "cell-33", ""]
],
"jsonWithHeaders": [
{"cell-11,": "cell-21", "cell-12": "cell-22,cell-23", ",cell-13": ""},
{"cell-11,": "cell-31,cell-32,", "cell-12": "cell-33", ",cell-13": ""}
]
},
{
"@comment": "The behavior here is undefined - the only thing that matters is it should not throw an exception, the result is free to make no sense.",
"name": "Edge case - carriage return separator",
"options": {"separator": "\r"},
"csv": "cell-11,\"cell-12\",cell-13\r\n\"cell-21\",cell-22,cell-23\r\ncell-31,cell-32,\"cell-33\"",
"json": [
["cell-11,\"cell-12\",cell-13"],
["cell-21", "cell-22,cell-23"],
["cell-31,cell-32,\"cell-33\""]
],
"jsonWithHeaders": [
{"cell-11,\"cell-12\",cell-13": "cell-21" },
{"cell-11,\"cell-12\",cell-13": "cell-31,cell-32,\"cell-33\""}
]
},
{
"@comment": "The behavior here is undefined - the only thing that matters is it should not throw an exception, the result is free to make no sense.",
"name": "Edge case - newline separator",
"options": {"separator": "\n"},
"csv": "cell-11,\"cell-12\",cell-13\r\n\"cell-21\",cell-22,cell-23\r\ncell-31,cell-32,\"cell-33\"",
"json": [
["cell-11,\"cell-12\",cell-13"],
["cell-21", "cell-22,cell-23"],
["cell-31,cell-32,\"cell-33\""]
],
"jsonWithHeaders": [
{"cell-11,\"cell-12\",cell-13": "cell-21" },
{"cell-11,\"cell-12\",cell-13": "cell-31,cell-32,\"cell-33\""}
]
}
]

View File

@ -0,0 +1,33 @@
/*\
title: modules/utils/test-csv.js
type: application/javascript
tags: [[$:/tags/test-spec]]
Tests the backlinks mechanism.
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
describe('CSV Parsing', function() {
var tid = $tw.wiki.getTiddler('csv-cases');
var testCases = JSON.parse(tid.fields.text);
$tw.utils.each(testCases, function(testCase) {
if (testCase.skip) {
return;
}
it("Test case: " + testCase.name, function() {
var parsedCsv = $tw.utils.parseCsvString(testCase.csv, testCase.options);
expect(parsedCsv).withContext("The generated CSV should match the expected one").toEqual(testCase.json);
var parsedCsvWithHeaders = $tw.utils.parseCsvStringWithHeader(testCase.csv, testCase.options);
expect(parsedCsvWithHeaders).withContext("The generated CSV with headers should match the expected one").toEqual(testCase.jsonWithHeaders);
});
})
});
})();

View File

@ -78,6 +78,7 @@ describe("Utility tests", function() {
expect(fds(d,"ddd hh mm ssss")).toBe("Sun 17 41 2828");
expect(fds(d,"MM0DD")).toBe("1109");
expect(fds(d,"MM0\\D\\D")).toBe("110DD");
expect(fds(d,"TIMESTAMP")).toBe(d.getTime().toString());
const day = d.getUTCDate();
const dayStr = ("" + day).padStart(2, '0');
const hours = d.getUTCHours();

View File

@ -9,6 +9,7 @@
],
"build": {
"index": [
"--rendertiddler","$:/core/save/all","test.html","text/plain"]
"--rendertiddler","$:/core/save/all","test.html","text/plain",
"--test"]
}
}

View File

@ -0,0 +1,81 @@
created: 20220817153236691
modified: 20221010074314452
tags: [[Tables in WikiText]]
title: Tables in WikiText CSS Utility Classes
type: text/vnd.tiddlywiki
~WikiText tables can be styled by applying CSS classes. For basic information on wiktext tables and how to style them, see [[Tables in WikiText]].
{{Table Classes, Captions, Headers and Footers}}
As seen above, the resulting table is left aligned and grows to fit the content. This is the browser default layout behaviour for tables. To get another behaviour, various CSS classes can be added into the "`k` row".
! Utility Classes
{{Utility Classes}}
! Examples
The following examples apply the style classes to tables but the "General Utility Classes" can as well be used on DIVs or other [[HTML block elements|HTML Block Elements]]
!! Centred Table
To center a table horizontally, use `tc-center`:
<<wikitext-example-without-html src:"""|tc-center|k
|This is a caption |c
|Cell1 |Cell2 |
|Cell3 |Cell4 |
|Header|Header|h
|Footer|Footer|f
""">>
!! Centred Table, 80% Width
To add empty left and right margins to a table that is otherwise full-tiddler-width, you can use `tc-max-width-80`
<<wikitext-example-without-html src:"""|tc-center tc-max-width-80|k
|This is a caption |c
|Cell1 |<<.lorem>> |
|<<.lorem>> |Cell4 |
|Header|Header|h
""">>
!! Table with Maximum Width
To expand a table to full tiddler width, use `tc-max-width`
<<wikitext-example-without-html src:"""|tc-max-width|k
|Header|Header|h
|Cell1 |Cell2 |
|Cell3 |Cell4 |
""">>
!! Table with First Column Minimum Width
The following example shows a simple "form" where the first columns width is adjusted to its content by means of `tc-first-col-min-width`
<<wikitext-example-without-html src:"""|tc-max-width tc-first-col-min-width|k
|Header|Header|h
|Cell1 |<$edit-text tiddler="$:/temp/test-table-input" tag="input" field="test"/> |
|Cell3 |<$edit-text tiddler="$:/temp/test-table-input" field="text"/> |
""">>
!! Table with Maximum Width ~TextWidgets
Here, the previous "form" is styled further to give the [[TextWidget]]s full width by adding the class `tc-edit-max-width`
<<wikitext-example-without-html src:"""|tc-max-width tc-first-col-min-width tc-edit-max-width|k
|Header|Header|h
|Cell1 |<$edit-text tiddler="$:/temp/test-table-input" tag="input" field="test"/> |
|Cell3 |<$edit-text tiddler="$:/temp/test-table-input" field="text"/> |
""">>
!! Table with No Borders
The following is a table with maximum width. It contains [[TextWidget]]s with maximum width. The first column is set to be minimum width. Further, all links in the first column are set to __not__ line break (wrap) regardless of window resize.
<<wikitext-example-without-html src:"""|tc-max-width tc-first-col-min-width tc-edit-max-width tc-table-no-border tc-first-link-nowrap|k
| Cell1|<$edit-text tiddler="$:/temp/test-table-input" tag="input" field="test"/> |
|^ [[Link to a tiddler]]<br>some more text|<$edit-text tiddler="$:/temp/test-table-input" field="text"/> |
""">>

View File

@ -0,0 +1,9 @@
created: 20220818091959523
modified: 20220818092101307
tags: Definitions
title: HTML Block Elements
type: text/vnd.tiddlywiki
<<<
HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. Since this is a presentational characteristic it is nowadays specified by CSS in the Flow Layout. A Block-level element occupies the entire horizontal space of its parent element (container), and vertical space equal to the height of its contents, thereby creating a "block".
<<< https://developer.mozilla.org/en-US/docs/Web/HTML/Block-level_elements

View File

@ -16,7 +16,7 @@ This is a version of the TaskManagementExample enhanced with the ability to drag
//(Listed in reverse order of completion)//
<$list filter="[!has[draft.of]tag[task]tag[done]sort[created]]">
<$list filter="[!has[draft.of]tag[task]tag[done]sort[modified]]">
<div>
<$checkbox tag="done"> ~~<$link/>~~</$checkbox>
</div>

View File

@ -1,5 +1,5 @@
created: 20140418142957325
modified: 20210912115121622
modified: 20221121131150032
tags: Features
title: DateFormat
type: text/vnd.tiddlywiki
@ -46,6 +46,7 @@ The date string is processed with the following substitutions:
|`am` or `pm` |Lower case AM/PM indicator |
|`AM` or `PM` |Upper case AM/PM indicator |
|`TZD` |Timezone offset |
|`TIMESTAMP` |<<.from-version "5.2.4">> Number of milliseconds since the [[ECMAScript epoch|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date#the_ecmascript_epoch_and_timestamps]], 1 January 1970. |
|`\x` |Used to escape a character that would otherwise have special meaning |
|`[UTC]`|Time-shift the represented date to UTC. Must be at very start of format string|
@ -59,3 +60,26 @@ The `{era:BCE||CE}` notation can specify different strings for years that are ne
|`DDth MMM YYYY` |16th February 2011 |
|`DDth MMM \M\M\M YYYY` |16th February MMM 2011 |
|`DDth mmm YYYY 0hh:0mm:0ss` |16th Feb 2011 11:38:42 |
!! Using `TIMESTAMP` to calculate time difference
You can calculate the difference between two dates by doing the following:
# Convert both dates to timestamps
# Subtract the later date from the earlier one -- if you don't know which one is earlier use the <<.olink "abs">> operator to get an absolute value after subtraction
# Divide the resulting number by the number of milliseconds in your chosen interval
Here is an example of calculating the number of days that passed between creation and last modification of current tiddler:
* Fields `modified` and `created` contain their respective datetimes in the format `YYYYMMDDHHMMSSmmm` so convert them to timestamps
* `86400000` is the number of milliseconds in a day (1000 * 60 * 60 * 24)
<$macrocall $name=".example" n="0" eg="""<$let
timestamp-modified={{{ [{!!modified}format:date[TIMESTAMP]] }}}
timestamp-created={{{ [{!!created}format:date[TIMESTAMP]] }}}
difference-days={{{ [<timestamp-modified>subtract<timestamp-created>divide[86400000]floor[]] }}}>
* ''Modified date:'' <$text text={{{ [{!!modified}format:date[YYYY-0MM-0DD]] }}}/>
* ''Created date:'' <$text text={{{ [{!!created}format:date[YYYY-0MM-0DD]] }}}/>
* ''Difference in days:'' <<difference-days>> days
</$let>"""/>

View File

@ -0,0 +1,13 @@
created: 20190903192324700
modified: 20190903192324700
tags: [[Hidden Settings]]
title: Hidden Setting: Sync Logging
type: text/vnd.tiddlywiki
Specifies whether [[Syncadaptor|https://tiddlywiki.com/dev/#Syncadaptor]] should log information to the browser's developer console or not.
Defaults to `yes`. Set to `no` to disable logging.
Changing needs restart to take effect.
$:/config/SyncLogging

View File

@ -4,7 +4,7 @@ created: 20131219100608529
delivery: DIY
description: Flexible hosting on your own machine or in the cloud
method: sync
modified: 20221151230831173
modified: 20221115230831173
tags: Saving [[TiddlyWiki on Node.js]] Windows Mac Linux
title: Installing TiddlyWiki on Node.js
type: text/vnd.tiddlywiki

View File

@ -0,0 +1,20 @@
created: 20220819100636227
modified: 20220819101309072
tags: [[Tables in WikiText]]
title: Table Classes, Captions, Headers and Footers
type: text/vnd.tiddlywiki
Table CSS classes, captions, headers and footers can be specified as special pseudo-rows. The following example:
* `|myclass anotherClass|k` assigns the CSS classes "myclass" and "anotherClass" to the table
* `|This is a caption |c` gives the table the caption "This is a caption"
* `|Header|Header|h` adds a header row of cells with the text "Header"
* `|Footer|Footer|f` adds a footer row of cells with the text "Footer"
<<wikitext-example-without-html src:"""|myclass anotherClass|k
|This is a caption |c
|Cell1 |Cell2 |
|Cell3 |Cell3 |
|Header|Header|h
|Footer|Footer|f
""">>

View File

@ -1,6 +1,6 @@
caption: Tables
created: 20130914132100000
modified: 20220513115945053
modified: 20220819103416274
tags: WikiText
title: Tables in WikiText
type: text/vnd.tiddlywiki
@ -66,17 +66,7 @@ To merge a table cell with the one above, use the special cell text `~`. To merg
! Table Classes, Captions, Headers and Footers
Table CSS classes, captions, headers and footers can be specified as special pseudo-rows. The following example:
{{Table Classes, Captions, Headers and Footers}}
* assigns the CSS classes "myclass" and "anotherClass" to the table
* gives the table the caption "This is a caption"
* adds a header row of cells with the text "Header"
* adds a footer row of cells with the text "Footer"
<<wikitext-example-without-html src:"""|myclass anotherClass|k
|This is a caption |c
|Cell1 |Cell2 |
|Cell3 |Cell3 |
|Header|Header|h
|Footer|Footer|f
""">>
More examples can be found at: [[Tables in WikiText CSS Utility Classes]]

View File

@ -0,0 +1,20 @@
created: 20220818093624828
modified: 20221010074235929
tags: WikiText
title: Utility Classes
type: text/vnd.tiddlywiki
<<.from-version "5.2.4">> The following outlines a few predefined CSS classes intended to make it simpler to style [[HTML block-elements|HTML Block Elements]] and [[wikitext tables|Tables in WikiText CSS Utility Classes]].
!! General Utility Classes
|`tc-center` |Centres a block-element to the middle of the container |
|`tc-max-width `|Expands a block-element to use the maximum width of the container |
|`tc-max-width-80`|Sets the width of a block-element to use 80% of the maximum container width. This setting is useful with the `tc-center` class |
|`tc-edit-max-width `|Expands [[TextWidget]]s to use the maximum available width. See [[ControlPanel -> Info -> Basics|$:/core/ui/ControlPanel/Basics]]|
|`tc-first-link-nowrap` |Ensures that any links in the first table column will never wrap to the next line |
!! Table Utility Classes
|`tc-table-no-border` |Removes the borders of a table |
|`tc-first-col-min-width` |The first column of a table will take up minimal possible width. It adapts to the content |

View File

@ -81,7 +81,7 @@ Palette/Caption: paleta
Palette/Hint: Wybierz paletę kolorów
Permalink/Caption: bezpośredni link
Permalink/Hint: Ustaw adres w przeglądarce na bezpośredni link do tego tiddlera
Permaview/Caption: permanenty widok
Permaview/Caption: link do obecnego widoku
Permaview/Hint: Ustaw adres w przeglądarce na bezpośredni link do obecnego Story River
Print/Caption: wydrukuj stronę
Print/Hint: Drukuje aktualną stronę
@ -97,7 +97,7 @@ HideSideBar/Caption: ukryj menu boczne
HideSideBar/Hint: Ukryj menu boczne
ShowSideBar/Caption: pokaż menu boczne
ShowSideBar/Hint: Pokaż menu boczne
TagManager/Caption: Menedżer tagów
TagManager/Caption: menedżer tagów
TagManager/Hint: Otwórz menedżer tagów
Timestamp/Caption: aktualizacje czasu
Timestamp/Hint: Wybierz czy zmiany mają aktualizować czas
@ -124,7 +124,7 @@ Excise/Caption/Replace/Macro: makro
Excise/Caption/Replace/Link: link
Excise/Caption/Replace/Transclusion: transkluzja
Excise/Caption/Tag: Otaguj nowego tiddlera nazwą tego
Excise/Caption/TiddlerExists: Uwaga: Tiddler już istnieje
Excise/Caption/TiddlerExists: Uwaga: tiddler już istnieje
Excise/Hint: Wytnij zaznaczony tekst i wstaw go do nowego tidlera
Heading1/Caption: nagłówek 1
Heading1/Hint: Zmień zaznaczony tekst na nagłówek 1. stopnia

View File

@ -5,17 +5,19 @@ Advanced/Hint: Wewnętrzne informacje na temat TiddlyWiki
Appearance/Caption: Wyświetlanie
Appearance/Hint: Dostosowywanie wyglądu tej TiddlyWiki
Basics/AnimDuration/Prompt: Długość animacji
Basics/AutoFocus/Prompt: Domyślne pole z fokusem dla nowych tiddlerów
Basics/AutoFocus/Prompt: Domyślne wybrane pole do edycji przy tworzeniu nowego tiddlera
Basics/Caption: Podstawowe
Basics/DefaultTiddlers/BottomHint: Używaj &#91;&#91;podwójnych nawiasów kwadratowych&#93;&#93; dla nazw ze spacjami. Możesz też {{przywrócić ostatnią sesję||$:/snippets/retain-story-ordering-button}}
Basics/DefaultTiddlers/BottomHint: Tiddlery, które mają spację w nazie otocz &#91;&#91;podwójnymi nawiasami kwadratowymi&#93;&#93;. Możesz też ustawić, by zawsze widzieć {{ostatnio otwarte tiddlery||$:/snippets/retain-story-ordering-button}}
Basics/DefaultTiddlers/BottomHint: Use &#91;&#91;double square brackets&#93;&#93; for titles with spaces. Or you can choose to <$button set="$:/DefaultTiddlers" setTo="[list[$:/StoryList]]">retain story ordering</$button>
Basics/DefaultTiddlers/BottomHint: Use &#91;&#91;double square brackets&#93;&#93; for titles with spaces. Or you can choose to {{retain story ordering||$:/snippets/retain-story-ordering-button}}
Basics/DefaultTiddlers/Prompt: Domyślnie otwarte tiddlery
Basics/DefaultTiddlers/TopHint: Wybierz które tiddlery mają być widoczne przy uruchomieniu
Basics/Language/Prompt: Cześć! Wybrany język to:
Basics/NewJournal/Title/Prompt: Tytuł nowych dzienników
Basics/NewJournal/Text/Prompt: Treść nowych dzienników
Basics/NewJournal/Tags/Prompt: Tagi nowych dzienników
Basics/NewTiddler/Title/Prompt: Tytuł nowych tiddlerów
Basics/NewTiddler/Tags/Prompt: Tagi nowych tiddlerów
Basics/NewJournal/Title/Prompt: Domyślny tytuł nowych dzienników
Basics/NewJournal/Text/Prompt: Domyślna treść nowych dzienników
Basics/NewJournal/Tags/Prompt: Domyślne tagi nowych dzienników
Basics/NewTiddler/Title/Prompt: Domyślny tytuł nowych tiddlerów
Basics/NewTiddler/Tags/Prompt: Domyślne tagi nowych tiddlerów
Basics/OverriddenShadowTiddlers/Prompt: Liczba nadpisanych tiddlerów-cieni
Basics/RemoveTags: Zaktualizuj do obecnego formatu
Basics/RemoveTags/Hint: Zaktualizuj konfigurację tagów do najnowszego formatu
@ -58,7 +60,7 @@ LoadedModules/Caption: Wczytane Moduły
LoadedModules/Hint: To są wszystie wczytane moduły podlinkowane do swoich tiddlerów źródłowych. Te zapisane kursywą nie posiadają źródłowych tiddlerów, zwykle dlatego, że były skonfigorwane podczas procesu uruchomienia.
Palette/Caption: Paleta
Palette/Editor/Clone/Caption: kopiuj
Palette/Editor/Clone/Prompt: Zalecane jest skopiowanie taj ukrytej palety przed edycją
Palette/Editor/Clone/Prompt: Zalecamy skopiowanie tej palety przed zmianą kolorów
Palette/Editor/Delete/Hint: usuń tą konfigurację z obecnej palety
Palette/Editor/Names/External/Show: Pokaż nazwy kolorów, które nie są częścią wybranej palety
Palette/Editor/Prompt/Modified: Ukryta paleta została zmieniona
@ -144,7 +146,7 @@ Settings/AutoSave/Disabled/Description: Nie zapisuj zmian automatycznie
Settings/AutoSave/Enabled/Description: Zapisuj zmiany automatycznie
Settings/AutoSave/Hint: Próbuj automatycznie zapisać zmiany podczas edycji, gdy używasz wspierającego to modułu zapisującego
Settings/CamelCase/Caption: Camel Case WikiLinki
Settings/CamelCase/Hint: Możesz wyłączyć automatyczne linkowanie fraz w ~CamelCase. Wymaga ponownego uruchomienia.
Settings/CamelCase/Hint: Możesz wyłączyć automatyczne linkowanie fraz w ~CamelCase; wymaga ponownego uruchomienia
Settings/CamelCase/Description: Włącz automatyczne linkowanie ~CamelCase
Settings/Caption: Ustawienia
Settings/EditorToolbar/Caption: Pasek Narzędzi Edytora
@ -165,11 +167,11 @@ Settings/NavigationHistory/Hint: Aktualizuj historię nawigacji przeglądarki pr
Settings/NavigationHistory/No/Description: Nie aktualizuj historii
Settings/NavigationHistory/Yes/Description: Aktualizuj historię
Settings/NavigationPermalinkviewMode/Caption: Tryb linków bezpośrednich/widoku
Settings/NavigationPermalinkviewMode/Hint: Ustal jak linki bezośrednie/widok się zachowują:
Settings/NavigationPermalinkviewMode/Hint: Ustal jak linki bezpośrednie/widok się zachowują:
Settings/NavigationPermalinkviewMode/CopyToClipboard/Description: Skopiuj URL do linku bezpośredniego/widoku do schowka
Settings/NavigationPermalinkviewMode/UpdateAddressBar/Description: Zaktualizuj pasek adresu o URL do linku bezpośredniego/widoku
Settings/PerformanceInstrumentation/Caption: Logowanie w Konsoli
Settings/PerformanceInstrumentation/Hint: Uruchamia lokowanie w konsoli deweloperskiej przeglądarki. Wymagane ponowne uruchmoenie
Settings/PerformanceInstrumentation/Caption: Logowanie wydajności w Konsoli
Settings/PerformanceInstrumentation/Hint: Uruchamia logowanie wydajności w konsoli deweloperskiej przeglądarki; wymaga ponownego uruchomienia
Settings/PerformanceInstrumentation/Description: Włącz logowanie
Settings/ToolbarButtonStyle/Caption: Styl Przycisków Paska Narzędzi
Settings/ToolbarButtonStyle/Hint: Wybierz styl przycisków w pasku narzędzi
@ -208,22 +210,22 @@ Stylesheets/Hint: To jest wyrenderowany CSS obecnych tiddlerów otagowanych jako
Stylesheets/Restore/Caption: Przywróć
Theme/Caption: Motyw
Theme/Prompt: Obecny motyw:
TiddlerFields/Caption: Pola Tiddlerów
TiddlerFields/Caption: Pola tiddlerów
TiddlerFields/Hint: To jest pełna lista wszystich pól użytych w tej wiki (wliczając systemowe tiddlery ale nie tiddlery-cienie)
TiddlerColour/Caption: Kolor Tiddlera
TiddlerColour/Caption: Kolor tiddlera
TiddlerColour/Hint: Ta kaskada określa kolor używany do wyswietlania tiddlera (kolor ikony oraz taga).
TiddlerIcon/Caption: Ikona Tiddlera
TiddlerIcon/Hint: Ta kaskada określa ikonę używaną przez Tiddlera.
TiddlerIcon/Caption: Ikona tiddlera
TiddlerIcon/Hint: Ta kaskada określa ikonę używaną przez tiddlera.
Toolbars/Caption: Paski Narzędzi
Toolbars/EditToolbar/Caption: Edytuj Pasek Narzędzi
Toolbars/EditToolbar/Hint: Wybierz, które przyciski mają być widoczne podczas edycji tiddlera. Przeciągaj by zmieniać kolejność.
Toolbars/EditToolbar/Caption: Pasek narzędzi przy edycji tiddlera
Toolbars/EditToolbar/Hint: Wybierz, które przyciski mają być widoczne na górze okna edycji tiddlera. Możesz zmienić ich kolejnośc przeciągając wiersze.
Toolbars/Hint: Wybierz, które przyciski mają być widoczne.
Toolbars/PageControls/Caption: Pasek Narzędzi Strony
Toolbars/PageControls/Hint: Wybierz, które przyciski mają być widoczne w głónym pasku narzędzi. Przeciągaj by zmieniać kolejność.
Toolbars/EditorToolbar/Caption: Pasek Narzędzi edytora
Toolbars/EditorToolbar/Hint: Wybierz które przyciski mają być widoczne w pasku narzędzi edytora. Pamiętaj, że tylko niektóre z nich są wyświetlane przy róznych typach tiddlerów. Przeciągaj by zmieniać kolejność
Toolbars/ViewToolbar/Caption: Pasek Narzędzi Oglądania
Toolbars/ViewToolbar/Hint: Wybierz które przyciski są widoczne podczas oglądania tiddlera. Przeciągaj by zmieniać kolejność.
Toolbars/PageControls/Caption: Pasek narzędzi strony
Toolbars/PageControls/Hint: Wybierz, które przyciski mają być widoczne w głównym pasku narzędzi w menu bocznym. Możesz zmienić ich kolejnośc przeciągając wiersze.
Toolbars/EditorToolbar/Caption: Pasek narzędzi edytora treści
Toolbars/EditorToolbar/Hint: Wybierz które przyciski mają być widoczne w pasku narzędzi edytora treści tiddlera. Zależnie od typu edytowanego Tiddlera niektóre z nich mogą być niedostępne. Możesz zmienić ich kolejnośc przeciągając wiersze.
Toolbars/ViewToolbar/Caption: Pasek narzędzi wyświetlania
Toolbars/ViewToolbar/Hint: Wybierz które przyciski są widoczne obok tytułu podczas wyświetlania tiddlera. Możesz zmienić ich kolejnośc przeciągając wiersze.
Tools/Download/Full/Caption: Pobierz całą wiki.
ViewTemplateBody/Caption: Treść Wyświetlanego Tiddlera
ViewTemplateBody/Hint: Ta kaskada określa szablon wyświetlania treści tiddlera (czyli jego tekstu, w przeciwieństwie do kaskady 'Widok Tiddlera').

View File

@ -6,9 +6,9 @@ Options: Opcje
Options/SidebarLayout: Układ menu bocznego
Options/SidebarLayout/Fixed-Fluid: Stałe Story River, zmienne menu boczne
Options/SidebarLayout/Fluid-Fixed: Zmienne Story River, stałe menu boczne
Options/StickyTitles: Przyczep nazwy
Options/StickyTitles/Hint: Spowoduje, że nazwa tiddlera będzie "przyklejona" do górnej części okna przeglądarki
Options/CodeWrapping: Łam długie linie kodu do nowej linii
Options/StickyTitles: Przyklej tytuł i pasek narzędzi
Options/StickyTitles/Hint: Tytuł obecnego tiddlera oraz jego pasek narzędzi będzie przyklejony do góry okna przeglądarki
Options/CodeWrapping: Łam długie linie kodu
Settings: Ustawienia
Settings/FontFamily: Czcionka
Settings/CodeFontFamily: Czcionka kodu

View File

@ -0,0 +1,33 @@
/*\
title: $:/plugins/tiddlywiki/jasmine/command.js
type: application/javascript
module-type: command
The command which executes jasmine on the command line for TiddlyWiki5
\*/
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
var jasmine = require("./jasmine-plugin.js");
exports.info = {
name: "test",
synchronous: false,
namedParameterMode: true
};
var Command = function(params,commander,callback) {
this.params = params;
this.commander = commander;
this.callback = callback;
};
Command.prototype.execute = function() {
var specFilter = this.params.spec;
jasmine.runTests(this.callback,specFilter);
};
exports.Command = Command;

View File

@ -0,0 +1,24 @@
title: $:/language/Help/test
description: Run the jasmine test suite
This runs all of the tests in tiddlers tagged with `$:/tags/test-spec`.
```
--test [spec=<regExp>]
```
''spec'' - optional regular expression to run only specific suites or tests. It will be matched against the full name of every test to see whether to run it. The full name of a test is its assigned name prepended with the names of all containing suites. For instance, to run only the following test:
```
describe("Framework") { it("handles edgecases") { ... } }
```
You might use a specFilter like `"^Framework handles edgecases$"` to match the full name exactly, or more simply `"edgecases"`, though this might run other tests with "edgecases" in their name. You could also run all tests in that suite with `"^Framework"`.
If any tests fail or are skipped, all following commands are ignored. If you have any commands which must be executed regardless of test results, execute them first.
A common usage is to run the tests on the console after creating a Tiddlywiki file which will run the tests on the browser.
```
tiddlywiki --rendertiddler $:/core/save/all test.html text/plain --test
```

View File

@ -1,7 +1,7 @@
/*\
title: $:/plugins/tiddlywiki/jasmine/jasmine-plugin.js
type: application/javascript
module-type: startup
module-type: library
The main module of the Jasmine test plugin for TiddlyWiki5
@ -13,19 +13,14 @@ The main module of the Jasmine test plugin for TiddlyWiki5
"use strict";
var TEST_TIDDLER_FILTER = "[all[tiddlers+shadows]type[application/javascript]tag[$:/tags/test-spec]]";
var TESTS_DONE = false;
exports.name = "jasmine";
// Ensure this startup module is executed in the right order.
// In Node.js, Jasmine calls `process.exit()` with a non-zero exit code if there's
// any failed tests. Because of that, we want to make sure all critical
// startup modules are run before this one.
// * The "commands" module handles the --rendertiddler command-line flag,
// which is typically given in order to export an HTML file that can be opened with
// a browser to run tests.
exports.after = $tw.node ? ["commands"] : [];
exports.testsWereRun = function() {
return TESTS_DONE;
};
/*
Startup function for running tests
function for running tests
Below, paths like jasmine-core/jasmine.js refer to files in the 'jasmine-core' npm
package, whose repository is https://github.com/jasmine/jasmine.
@ -34,7 +29,8 @@ repository is https://github.com/jasmine/jasmine-npm.
They're all locally checked into the `./files` directory.
*/
exports.startup = function() {
exports.runTests = function(callback,specFilter) {
// Set up a shared context object.
var context = {
console: console,
@ -63,6 +59,10 @@ exports.startup = function() {
// is executed, so we use the `context` object instead.
context.global = $tw.browser ? window : context;
// We set this early rather than at the end for simplicity. The browser
// and node.js environments don't end the same way.
TESTS_DONE = true;
function evalInContext(title) {
var code = $tw.wiki.getTiddlerText(title,"");
var _exports = {};
@ -123,7 +123,15 @@ exports.startup = function() {
path: "$:/plugins/tiddlywiki/jasmine/jasmine-core/jasmine-core"
};
// 'jasmine/jasmine.js' references `process.exit`, among other properties
context.process = process;
// It will call 'exit' after it's done, which gives us an
// opportunity to resynchronize and finish any following commands.
context.process = Object.create(process);
context.process.exit = function(code) {
// If jasmine's exit code is non-zero, tests failed. Abort any
// further commands. If they're important, they could have come
// before the testing suite.
callback(code ? "Tests failed with code " + code : undefined);
};
var NodeJasmine = evalInContext("$:/plugins/tiddlywiki/jasmine/jasmine/jasmine.js");
nodeJasmineWrapper = new NodeJasmine({jasmineCore: jasmineCore});
@ -135,13 +143,11 @@ exports.startup = function() {
context = $tw.utils.extend({},jasmineInterface,context);
// Iterate through all the test modules
var tests = $tw.wiki.filterTiddlers(TEST_TIDDLER_FILTER);
$tw.utils.each(tests,function(title) {
evalInContext(title);
});
$tw.utils.each(tests,evalInContext);
// In a browser environment, jasmine-core/boot.js calls `execute()` for us.
// In Node.js, we call it manually.
if(!$tw.browser) {
nodeJasmineWrapper.execute();
nodeJasmineWrapper.execute(null,specFilter);
}
};

View File

@ -1,5 +1,35 @@
title: $:/plugins/tiddlywiki/jasmine/readme
This plugin provides a framework for running tests in the browser and under Node.js. It is based on [[Jasmine|https://jasmine.github.io/]] test framework.
This plugin provides a framework for running tests in the browser and under Node.js. It is based on [[Jasmine|https://jasmine.github.io/]] test framework. On Tiddlywiki, it runs tests in all javascript tiddlers tagged with <<tag $:/tags/test-spec>>.
[[Source code|https://github.com/Jermolene/TiddlyWiki5/blob/master/plugins/tiddlywiki/jasmine]]
!! Usage on Node.js
On the command line, type `tiddlywiki --test`.
Alternatively, you can set up a build task for jasmine by including the following in your tiddlywiki.info file:
```
{
...
"build": {
...
"test": ["--test"]
}
}
```
You could then run tests by typing `tiddlywiki --build test` or just `tiddlywiki --build`. The advantage to this is it allows you to include other commands to run as well. See `tiddlywiki --help test` for more information.
This will run the tests and produce a test file in your output directory.
```
"test": [
"--test",
"--rendertiddler","$:/core/save/all","test.html","text/plain"]
```
!! Usage on a browser
Once you've constructed a Tiddlywiki file using a command like the one above, you can run the tests simply by opening it. Tests run automatically, and the results will be at the bottom of the window.

View File

@ -0,0 +1,37 @@
/*\
title: $:/plugins/tiddlywiki/jasmine/startup.js
type: application/javascript
module-type: startup
The main module of the Jasmine test plugin for TiddlyWiki5
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: true */
"use strict";
var jasmine = require("./jasmine-plugin.js");
exports.name = "jasmine";
if($tw.browser) {
// Jasmine is run automatically on the browser, so always add it here.
exports.startup = jasmine.runTests;
} else {
// However, if we're on node.js, the tests are explciitly run with the
// --test command. This didn't used to be the case, so if they're
// not, we'll issue a small notice to cue users in to the change
// BTW, this notice probably won't be needed forever. It was installed
// Sept 2022. If it's been four years, this notice can probably come out.
exports.startup = function() {
if(!jasmine.testsWereRun()) {
process.stdout.write("Jasmine: no \"--test\" command given, so skipping tests\n");
}
}
// We make this check after the commands are run.
exports.after = ["commands"];
}
})();

View File

@ -326,7 +326,7 @@ table {
}
table th, table td {
padding: 0 7px 0 7px;
padding: 4px 6px 4px 6px;
border-top: 1px solid <<colour table-border>>;
border-left: 1px solid <<colour table-border>>;
}
@ -357,11 +357,36 @@ Table utility classes
width: 1%;
}
/*
** Utility classes work well with tables but also for other containers
*/
/* First link A element will not wrap */
.tc-first-link-nowrap:first-of-type a {
white-space: nowrap;
}
/* Move the table to the center of the container */
.tc-center {
margin-left: auto;
margin-right: auto;
}
.tc-max-width {
width: 100%;
}
.tc-max-width-80 {
max-width: 80%;
}
/* Allow input and textarea to look like the ControlPanel inputs */
.tc-edit-max-width input,
.tc-edit-max-width textarea {
width: 100%;
padding: 3px;
}
/*
CSV parser plugin
*/
@ -370,6 +395,11 @@ CSV parser plugin
white-space: nowrap;
}
.tc-csv-table th,
.tc-csv-table td {
white-space: pre-line;
}
/*
Tiddler frame in story river
*/