mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-02-02 00:00:22 +00:00
Compare commits
7 Commits
saqimtiaz-
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1ef2ef6d4 | ||
|
|
75edd9b488 | ||
|
|
cde9c931c8 | ||
|
|
70b4557738 | ||
|
|
efe58e41bc | ||
|
|
79e3d14698 | ||
|
|
763d717a13 |
21
boot/boot.js
21
boot/boot.js
@@ -316,8 +316,25 @@ $tw.utils.htmlDecode = function(s) {
|
||||
return s.toString().replace(/</mg,"<").replace(/ /mg,"\xA0").replace(/>/mg,">").replace(/"/mg,"\"").replace(/&/mg,"&");
|
||||
};
|
||||
|
||||
/** @deprecated Use window.location.hash instead. */
|
||||
$tw.utils.getLocationHash = () => window.location.hash;
|
||||
/*
|
||||
Get the browser location.hash. We don't use location.hash because of the way that Firefox auto-urldecodes it (see http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash)
|
||||
*/
|
||||
$tw.utils.getLocationHash = function() {
|
||||
const href = window.location.href,
|
||||
idx = href.indexOf("#");
|
||||
|
||||
if(idx === -1) {
|
||||
return "#";
|
||||
}
|
||||
|
||||
const afterHash = href.substring(idx + 1);
|
||||
if(afterHash.startsWith("#") || afterHash.startsWith("%23")) {
|
||||
// Special case: ignore location hash if it itself starts with a #
|
||||
return "#";
|
||||
}
|
||||
return href.substring(idx);
|
||||
};
|
||||
|
||||
|
||||
/** @deprecated Pad a string to a given length with "0"s. Length defaults to 2 */
|
||||
$tw.utils.pad = function(value,length = 2) {
|
||||
|
||||
@@ -82,8 +82,8 @@ SelectWidget.prototype.handleChangeEvent = function(event) {
|
||||
if(this.selectMultiple == false) {
|
||||
var value = this.getSelectDomNode().value;
|
||||
} else {
|
||||
var value = this.getSelectValues()
|
||||
value = $tw.utils.stringifyList(value);
|
||||
var value = this.getSelectValues();
|
||||
value = $tw.utils.stringifyList(value);
|
||||
}
|
||||
this.wiki.setText(this.selectTitle,this.selectField,this.selectIndex,value);
|
||||
// Trigger actions
|
||||
@@ -118,7 +118,7 @@ SelectWidget.prototype.setSelectValue = function() {
|
||||
}
|
||||
}
|
||||
// Assign it to the select element if it's different than the current value
|
||||
if (this.selectMultiple) {
|
||||
if(this.selectMultiple) {
|
||||
value = value === undefined ? "" : value;
|
||||
var select = this.getSelectDomNode();
|
||||
var child,
|
||||
@@ -156,14 +156,14 @@ SelectWidget.prototype.getSelectValues = function() {
|
||||
select = this.getSelectDomNode();
|
||||
result = [];
|
||||
options = select && select.options;
|
||||
for (var i=0; i<options.length; i++) {
|
||||
for(var i=0; i<options.length; i++) {
|
||||
opt = options[i];
|
||||
if (opt.selected) {
|
||||
if(opt.selected) {
|
||||
result.push(opt.value || opt.text);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Compute the internal state of the widget
|
||||
@@ -192,7 +192,7 @@ Selectively refreshes the widget if needed. Returns true if the widget or any of
|
||||
SelectWidget.prototype.refresh = function(changedTiddlers) {
|
||||
var changedAttributes = this.computeAttributes();
|
||||
// If we're using a different tiddler/field/index then completely refresh ourselves
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.tabindex || changedAttributes.disabled) {
|
||||
if(changedAttributes.tiddler || changedAttributes.field || changedAttributes.index || changedAttributes.tooltip || changedAttributes.default || changedAttributes.tabindex || changedAttributes.disabled) {
|
||||
this.refreshSelf();
|
||||
return true;
|
||||
} else {
|
||||
|
||||
@@ -160,7 +160,7 @@ Widget.prototype.getVariableInfo = function(name,options) {
|
||||
});
|
||||
// Parameters are an array of {name:, value:, multivalue:} pairs (name and multivalue are optional)
|
||||
$tw.utils.each(params,function(param) {
|
||||
if(param.multiValue && param.multiValue.length) {
|
||||
if(param.multiValue) {
|
||||
variables[param.name] = param.multiValue;
|
||||
} else {
|
||||
variables[param.name] = param.value || "";
|
||||
@@ -233,10 +233,8 @@ Widget.prototype.resolveVariableParameters = function(formalParams,actualParams)
|
||||
paramMultiValue = typeof param === "string" ? [param] : (param.multiValue || [paramValue]);
|
||||
}
|
||||
// If we've still not got a value, use the default, if any
|
||||
if(!paramValue) {
|
||||
paramValue = paramInfo["default"] || "";
|
||||
paramMultiValue = [paramValue];
|
||||
}
|
||||
paramValue = paramValue || paramInfo["default"] || "";
|
||||
paramMultiValue = paramMultiValue || [paramValue];
|
||||
// Store the parameter name and value
|
||||
results.push({name: paramInfo.name, value: paramValue, multiValue: paramMultiValue});
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
title: Functions/FunctionDefaultValues
|
||||
description: Use defaults for missing parameters in functions in filters
|
||||
type: text/vnd.tiddlywiki-multiple
|
||||
tags: [[$:/tags/wiki-test-spec]]
|
||||
|
||||
title: Output
|
||||
|
||||
\whitespace trim
|
||||
\function .test(prefix:Default) [[ Content]addprefix<prefix>]
|
||||
|
||||
<$text text={{{ [.test[Special]] }}}/>,<$text text={{{ [.test[]] }}}/>
|
||||
|
||||
+
|
||||
title: ExpectedResult
|
||||
|
||||
<p>Special Content,Default Content</p>
|
||||
@@ -4,22 +4,22 @@ tags: Learning
|
||||
title: TaskManagementExample
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
TiddlyWiki5 can be used as a simple task management system without further customisation. The idea is that tasks be tagged `task`, with those that are completed also tagged `done`. In this way it is straightforward to generate task lists.
|
||||
TiddlyWiki5 can be used as a simple task management system without further customisation.<br>The idea is that tasks be tagged `task`, with those that are completed also tagged `done`. In this way it is straightforward to generate task lists.
|
||||
|
||||
<<.tip """There is [[an enhanced version of this demo|TaskManagementExample (Draggable)]] that adds the ability to drag and drop the tasks to re-order them.""">>
|
||||
|
||||
! Outstanding tasks
|
||||
|
||||
<$list filter="[!has[draft.of]tag[task]!tag[done]sort[created]]">
|
||||
|
||||
<$checkbox tag="done"> <$link/></$checkbox>
|
||||
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""<$list filter="[!has[draft.of]tag[task]!tag[done]sort[created]]">
|
||||
<$checkbox tag="done"> <$link/></$checkbox><br>
|
||||
</$list>
|
||||
"""/>
|
||||
|
||||
! Completed tasks
|
||||
|
||||
<$list filter="[!has[draft.of]tag[task]tag[done]sort[created]]">
|
||||
|
||||
<$checkbox tag="done"> ~~<$link/>~~</$checkbox>
|
||||
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""<$list filter="[!has[draft.of]tag[task]tag[done]sort[created]]">
|
||||
<$checkbox tag="done"> ~~<$link/>~~</$checkbox><br>
|
||||
</$list>
|
||||
"""/>
|
||||
|
||||
@@ -4,20 +4,24 @@ tags: Learning
|
||||
title: TaskManagementExample (Draggable)
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
This is a version of the TaskManagementExample enhanced with the ability to drag and drop the task list to re-order them.
|
||||
This is a version of the TaskManagementExample enhanced with the ability to drag and drop the task list to re-order them.<br>The list uses a the itemTemplate [[TaskManagementExampleDraggableTemplate]] tiddler, which you will also need to experiment yourself.
|
||||
|
||||
! Outstanding tasks
|
||||
|
||||
//Drag the tasks to re-order them//
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""//Drag the tasks to re-order them//
|
||||
|
||||
<<list-tagged-draggable tag:"task" subFilter:"!has[draft.of]!tag[done]" itemTemplate:"TaskManagementExampleDraggableTemplate" emptyMessage:"You don't have any active tasks">>
|
||||
"""/>
|
||||
|
||||
! Completed tasks
|
||||
|
||||
//(Listed in reverse order of completion)//
|
||||
<$macrocall $name='wikitext-example-without-html'
|
||||
src="""//(Listed in reverse order of completion)//
|
||||
|
||||
<$list filter="[!has[draft.of]tag[task]tag[done]sort[modified]]">
|
||||
<div>
|
||||
<$checkbox tag="done"> ~~<$link/>~~</$checkbox>
|
||||
</div>
|
||||
</$list>
|
||||
"""/>
|
||||
|
||||
@@ -4,35 +4,36 @@ tags: Features
|
||||
title: DateFormat
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The default representation of dates is a compact string such as <<.value 20211002153802059>>. The associated template is `[UTC]YYYY0MM0DD0hh0mm0ss0XXX`. For example, the <<.field created>> and <<.field modified>> fields are stored like this.
|
||||
The default representation of dates is a compact string such as <<.value "<$view field='modified' format='text'/>">>. The associated template is `[UTC]YYYY0MM0DD0hh0mm0ss0XXX`. For example, the <<.field created>> and <<.field modified>> fields are stored like this.
|
||||
|
||||
The display format for this string can be controlled with a template. For example, transcluding the <<.field modified>> field automatically applies a template to display the date as <<.value "Sat Oct 02 2021 17:40:50 GMT+0200 (Central European Summer Time)">>. A few widgets and filter operators allow you to manually specify a template, for example the ViewWidget:
|
||||
The display format for this string can be controlled with a template. For example, transcluding the <<.field modified>> field automatically applies a template to display the date as "{{!!modified}}". A few widgets and filter operators allow you to manually specify a template, for example the ViewWidget:
|
||||
|
||||
`<$view field=modified format=date template="DDth mmm YYYY 0hh:0mm:0ss" />`
|
||||
|
||||
The date string is processed with the following substitutions:
|
||||
|
||||
|!Token |!Substituted Value |
|
||||
|`[UTC]`|Time-shift the represented date to UTC. Must be at very start of format string |
|
||||
|`YYYY` |Full year |
|
||||
|`YY` |Two-digit year |
|
||||
|`wYYYY` |Full year with respect to week number |
|
||||
|`aYYYY` |<<.from-version "5.1.23">> Full year but negative dates are displayed as positive |
|
||||
|`wYY` |Two digit year with respect to week number |
|
||||
|`{era:BCE||CE}` |<<.from-version "5.1.23">> Displays a different string for years that are negative, zero or positive (see below) |
|
||||
|`MMM` |Month in full (e.g. "July") |
|
||||
|`mmm` |Short month (e.g. "Jul") |
|
||||
|`MM` |Month number |
|
||||
|`0MM` |Adds leading zero |
|
||||
|`ddddd` |<<.from-version "5.2.0">> Day of year (1 to 365, or 366 for leap years) |
|
||||
|`0ddddd` |<<.from-version "5.2.0">> Zero padded day of year (001 to 365, or 366 for leap years) |
|
||||
|`DDD` |Day of week in full (eg, "Monday") |
|
||||
|`ddd` |Short day of week (eg, "Mon") |
|
||||
|`DDD` |Day of week in full (e.g. "Monday") |
|
||||
|`ddd` |Short day of week (e.g. "Mon") |
|
||||
|`dddd` |<<.from-version "5.2.0">> Weekday number from 1 through 7, beginning with Monday and ending with Sunday |
|
||||
|`DD` |Day of month |
|
||||
|`0DD` |Adds a leading zero |
|
||||
|`DDth` |Adds a suffix |
|
||||
|`WW` |ISO-8601 week number of year |
|
||||
|`0WW` |Adds a leading zero |
|
||||
|`MMM` |Month in full (eg, "July") |
|
||||
|`mmm` |Short month (eg, "Jul") |
|
||||
|`MM` |Month number |
|
||||
|`0MM` |Adds leading zero |
|
||||
|`YYYY` |Full year |
|
||||
|`YY` |Two digit year |
|
||||
|`wYYYY` |Full year with respect to week number |
|
||||
|`aYYYY` |<<.from-version "5.1.23">> Full year but negative dates are displayed as positive |
|
||||
|`wYY` |Two digit year with respect to week number |
|
||||
|`{era:BCE||CE}` |<<.from-version "5.1.23">> Displays a different string for years that are negative, zero or positive (see below) |
|
||||
|`hh` |Hours |
|
||||
|`0hh` |Adds a leading zero |
|
||||
|`hh12` |Hours in 12 hour clock |
|
||||
@@ -43,12 +44,12 @@ The date string is processed with the following substitutions:
|
||||
|`0ss` |Seconds with leading zero |
|
||||
|`XXX` |Milliseconds |
|
||||
|`0XXX` |Milliseconds with leading zero |
|
||||
|`am` or `pm` |Lower case AM/PM indicator |
|
||||
|`am` or `pm` |Lower case am/pm indicator |
|
||||
|`AM` or `PM` |Upper case AM/PM indicator |
|
||||
|`TZD` |Timezone offset |
|
||||
|`TZD` |Timezone offset from UTC (e.g. "+01:00", "-05:00"…) |
|
||||
|`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|
|
||||
|
||||
|
||||
Note that other text is passed through unchanged, allowing commas, colons or other separators to be used.
|
||||
|
||||
|
||||
@@ -6,15 +6,13 @@ type: text/vnd.tiddlywiki
|
||||
<<.operator-example 2 "[!days:created[-800]]" "tiddlers created more than 800 days ago">>
|
||||
The filter can be used to highlight new items in a list. For example:
|
||||
<$macrocall
|
||||
$name="wikitext-example-without-html" src=
|
||||
"""
|
||||
<ul>
|
||||
$name="wikitext-example-without-html"
|
||||
src="""<ul>
|
||||
<$list filter="[tag[ReleaseNotes]!<currentTiddler>!sort[modified]]">
|
||||
<li>
|
||||
<$link><$view field="title"/></$link>
|
||||
<$list filter="[<currentTiddler>days[-180]]"> @@color:red;^^new^^@@</$list>
|
||||
<$list filter="[<currentTiddler>days[-500]!days[-180]]"> @@color:black;^^recent^^@@</$list>
|
||||
<$list filter="[<currentTiddler>days[-180]]"> @@color:red;^^new^^@@</$list>
|
||||
<$list filter="[<currentTiddler>days[-500]!days[-180]]"> @@color:black;^^recent^^@@</$list>
|
||||
</li>
|
||||
</$list>
|
||||
</ul>
|
||||
"""/>
|
||||
</ul>"""/>
|
||||
|
||||
@@ -4,8 +4,8 @@ release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: enhancement
|
||||
change-category: hackability
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/8972 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9614
|
||||
github-contributors: Jermolene saqimtiaz
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/8972
|
||||
github-contributors: Jermolene
|
||||
|
||||
This PR introduces a new filter run prefix `:let` that assigns the result of the filter run to a variable that is made available for the remaining filter runs of the filter expression. It solves the problem that previously it was impossible to compute values for filter operator parameters; parameters could only be a literal string, text reference or variable reference.
|
||||
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
change-category: usability
|
||||
change-type: bugfix
|
||||
created: 20260125195754439
|
||||
description: Refresh widget if "default" parameter input value is changed
|
||||
github-contributors: pmario
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9217
|
||||
modified: 20260125195754439
|
||||
release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
title: $:/changenotes/5.4.0/#9217
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
@@ -4,7 +4,7 @@ release: 5.4.0
|
||||
tags: $:/tags/ChangeNote
|
||||
change-type: deprecation
|
||||
change-category: developer
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9251
|
||||
github-contributors: Leilei332
|
||||
github-links: https://github.com/TiddlyWiki/TiddlyWiki5/pull/9251 https://github.com/TiddlyWiki/TiddlyWiki5/pull/9622
|
||||
github-contributors: Leilei332 saqimtiaz
|
||||
|
||||
Deprecate some utility functions. Some of them are moved to [[$:/core/modules/utils/deprecated.js]].
|
||||
@@ -5,8 +5,16 @@ tags: Releases
|
||||
title: TiddlyWiki Releases
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Here are the details of recent releases of TiddlyWiki5. See [[TiddlyWiki5 Versioning]] for details of how releases are named, and [[Release Notes and Changes]] for details of how release notes are constructed.
|
||||
Here are the details of recent releases of TiddlyWiki5. See [[TiddlyWiki5 Versioning]] for details of how releases are named.
|
||||
|
||||
* An overview about all TW versions can be found at the [[TiddlyWiki Archive]].
|
||||
|
||||
* If you are using Node.js, you can also install ''prior'' versions like this:
|
||||
|
||||
*> npm install -g tiddlywiki@5.3.0
|
||||
|
||||
* BetaReleases and AlphaReleases are listed separately
|
||||
|
||||
<$list filter="[tag[ReleaseNotes]!sort[created]limit[1]]">
|
||||
<$macrocall $name="tabs" tabsList="[tag[ReleaseNotes]!sort[created]]" default={{!!title}} class="tc-vertical" template="ReleaseTemplate" />
|
||||
</$list>
|
||||
</$list>
|
||||
Reference in New Issue
Block a user