1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2026-02-14 22:19:50 +00:00

Compare commits

...

11 Commits

Author SHA1 Message Date
jeremy@jermolene.com
ddec146925 Fix boot.js change from master 2023-04-05 11:53:28 +01:00
jeremy@jermolene.com
ba19f487c5 Merge branch 'master' into allow-filter-duplicates 2023-04-05 11:40:44 +01:00
jeremy@jermolene.com
2a19c60e20 Merge branch 'tiddlywiki-com' 2023-04-02 14:00:19 +01:00
Mohammad Rahmani
c28dbd0025 Update regexp.tid (#7382)
The list-links by default show caption of listed tiddlers instead of their title. So in the example here

```
<$macrocall
$name="wikitext-example-without-html"
src="""<$set name="digit-pattern" value="[0-9]{2}">
<<list-links "[regexp:title<digit-pattern>]" field:"title">>
</$set>"""/>
```

you need to use field:"title" to see the correct results visually.
2023-03-28 10:23:02 +02:00
Mohammad Rahmani
29c2260457 Update ListMacro.tid (#7381)
The field input parameter was corrected
2023-03-28 10:22:32 +02:00
Saq Imtiaz
d7c89de11d Update docs for TiddlerTemplate classes (#7377)
* Update docs for TiddlerTemplate classes

* Update SystemTag_ $__tags_ClassFilters_TiddlerTemplate.tid
2023-03-26 18:03:02 +01:00
jeremy@jermolene.com
e0ff54a04e Preparation for v5.2.8 2023-03-26 12:56:40 +01:00
jeremy@jermolene.com
042f3c59ad Merge branch 'tiddlywiki-com' 2023-03-26 12:54:10 +01:00
jeremy@jermolene.com
07960f1527 Update relesase banner for v5.2.8 2023-03-26 09:28:26 +01:00
jeremy@jermolene.com
5cdffd6943 Missed release date for v5.2.7 2023-03-26 09:05:06 +01:00
Jermolene
5376f4953c Add switch for enabling duplicates within filters
Along with some suitably eye catching notification messages
2019-02-21 15:32:36 +00:00
12 changed files with 161 additions and 29 deletions

View File

@@ -5,7 +5,7 @@
# Default to the current version number for building the plugin library
if [ -z "$TW5_BUILD_VERSION" ]; then
TW5_BUILD_VERSION=v5.2.7
TW5_BUILD_VERSION=v5.2.8
fi
echo "Using TW5_BUILD_VERSION as [$TW5_BUILD_VERSION]"

View File

@@ -96,34 +96,42 @@ Push entries onto an array, removing them first if they already exist in the arr
$tw.utils.pushTop = function(array,value) {
var t,p;
if($tw.utils.isArray(value)) {
// Remove any array entries that are duplicated in the new values
if(value.length !== 0) {
if(array.length !== 0) {
if(value.length < array.length) {
for(t=0; t<value.length; t++) {
p = array.indexOf(value[t]);
if(p !== -1) {
array.splice(p,1);
if($tw.config._temp_allowDuplicates) {
Array.prototype.push.apply(array,value);
} else {
// Remove any array entries that are duplicated in the new values
if(value.length !== 0) {
if(array.length !== 0) {
if(value.length < array.length) {
for(t=0; t<value.length; t++) {
p = array.indexOf(value[t]);
if(p !== -1) {
array.splice(p,1);
}
}
}
} else {
for(t=array.length-1; t>=0; t--) {
p = value.indexOf(array[t]);
if(p !== -1) {
array.splice(t,1);
} else {
for(t=array.length-1; t>=0; t--) {
p = value.indexOf(array[t]);
if(p !== -1) {
array.splice(t,1);
}
}
}
}
}
// Push the values on top of the main array
array.push.apply(array,value);
// Push the values on top of the main array
Array.prototype.push.apply(array,value);
}
}
} else {
p = array.indexOf(value);
if(p !== -1) {
array.splice(p,1);
if($tw.config._temp_allowDuplicates) {
array.push(value);
} else {
p = array.indexOf(value);
if(p !== -1) {
array.splice(p,1);
}
array.push(value);
}
array.push(value);
}
return array;
};
@@ -397,7 +405,7 @@ $tw.utils.parseStringArray = function(value, allowDuplicate) {
match = memberRegExp.exec(value);
if(match) {
var item = match[1] || match[2];
if(item !== undefined && (!$tw.utils.hop(names,item) || allowDuplicate)) {
if(item !== undefined && (!$tw.utils.hop(names,item) || allowDuplicate || $tw.config._temp_allowDuplicates)) {
results.push(item);
names[item] = true;
}
@@ -2305,14 +2313,25 @@ $tw.loadTiddlersNode = function() {
Startup TiddlyWiki
*/
$tw.boot.initStartup = function(options) {
var _temp_allowDuplicates;
options = options || {};
// Get the URL hash and check for safe mode
$tw.locationHash = "#";
if($tw.browser && !$tw.node) {
if(location.hash === "#:safe") {
$tw.safeMode = true;
} else if(location.hash === "#dupes") {
_temp_allowDuplicates = true;
$tw.locationHash = $tw.utils.getLocationHash();
} else {
$tw.locationHash = $tw.utils.getLocationHash();
}
} else {
var p = $tw.boot.argv.indexOf("--dupes");
if(p !== -1) {
_temp_allowDuplicates = true;
$tw.boot.argv.splice(p,1);
}
}
// Initialise some more $tw properties
$tw.utils.deepDefaults($tw,{
@@ -2321,6 +2340,7 @@ $tw.boot.initStartup = function(options) {
types: {} // hashmap by module type of hashmap of exports
},
config: { // Configuration overridables
_temp_allowDuplicates: _temp_allowDuplicates,
pluginsPath: "../plugins/",
themesPath: "../themes/",
languagesPath: "../languages/",
@@ -2473,6 +2493,14 @@ $tw.boot.execStartup = function(options){
if($tw.crypto) {
$tw.crypto.updateCryptoStateTiddler();
}
// Warn if using duplicates mode
console.log("\x1b[0;31m--------=====>>>>>> " + $tw.wiki.getTiddler("$:/core/_temp_allowDuplicates/Heading").fields.text + "\x1b[0m");
console.log("\x1b[0;34m--------=====>>>>>> " + $tw.wiki.getTiddler("$:/core/_temp_allowDuplicates/Warning").fields.text + "\x1b[0m");
if($tw.config._temp_allowDuplicates) {
console.log("\x1b[0;31m--------=====>>>>>> " + $tw.wiki.getTiddler("$:/core/_temp_allowDuplicates/StatusOn").fields.text + "\x1b[0m");
} else {
console.log("\x1b[0;32m--------=====>>>>>> " + $tw.wiki.getTiddler("$:/core/_temp_allowDuplicates/StatusOff").fields.text + "\x1b[0m");
}
// Gather up any startup modules
$tw.boot.remainingStartupModules = []; // Array of startup modules
$tw.modules.forEachModuleOfType("startup",function(title,module) {

View File

@@ -0,0 +1,92 @@
title: $:/core/_temp_allowDuplicates
tags: $:/tags/AboveStory
<div class="marching-ants-box" style="
position: fixed;
top: 100px;
left: -4px;
max-width: 50%;
z-index: 1000;
padding: 1em;
border-top-right-radius: 16px;
border-bottom-right-radius: 16px;
color: #fff;">
<$reveal type="match" state="$:/state/_temp_allowDuplicatesWarning" text="hide" default="show">
<$button set="$:/state/_temp_allowDuplicatesWarning" setTo="show" class="tc-btn-invisible" style="
width: 100%;
text-align: left;
fill: #ff0;">
{{$:/core/images/warning}}
</$button>
</$reveal>
<$reveal type="nomatch" state="$:/state/_temp_allowDuplicatesWarning" text="hide" default="show">
<$button set="$:/state/_temp_allowDuplicatesWarning" setTo="hide" class="tc-btn-invisible" style="
width: 100%;
text-align: left;
fill: #ff0;">
<span style="float:right;">{{$:/core/images/chevron-left}}</span> {{$:/core/images/warning}}
</$button>
<div style="
font-weight: bold;">
{{$:/core/_temp_allowDuplicates/Heading}}
</div>
<div style="">
{{$:/core/_temp_allowDuplicates/Warning}}
</div>
<$list filter="1 1 1 1 +[butfirst[]limit[1]]" emptyMessage="""
<div style="
font-weight: bold;
color: #0f0;">
{{$:/core/_temp_allowDuplicates/StatusOff}}
//Append `#dupes` to the browser address bar to enable//
</div>
""">
<div style="
font-weight: bold;
color: #fff;
font-size: 1.5em;
padding: 4px;" class="marching-ants-box">
{{$:/core/_temp_allowDuplicates/StatusOn}}
//Remove `#dupes` from the browser address bar to disable//
</div>
</$list>
</$reveal>
</div>
<style>
@keyframes marching-ants { to { background-position: 100% 100% } }
.marching-ants-box {
border: 4px solid transparent;
background: linear-gradient(#d85858, #d85858) padding-box,
repeating-linear-gradient(-45deg, #f00 0, #f00 25%, transparent 0, transparent 50%) 0 / 12px 12px;
animation: marching-ants 12s linear infinite;
}
</style>

6
core/messages.multids Normal file
View File

@@ -0,0 +1,6 @@
title: $:/core/_temp_allowDuplicates/
Heading: Important Warning
Warning: This is a special prerelease version of TW5 for experimenting with a potentially incompatible change to the core logic of filter processing. It is only intended to be used for evaluation and testing
StatusOff: The allow duplicates setting is currently: OFF
StatusOn: The allow duplicates setting is currently: ON

View File

@@ -1,6 +1,6 @@
title: $:/config/OfficialPluginLibrary
tags: $:/tags/PluginLibrary
url: https://tiddlywiki.com/library/v5.2.7/index.html
url: https://tiddlywiki.com/library/v5.2.8/index.html
caption: {{$:/language/OfficialPluginLibrary}}
{{$:/language/OfficialPluginLibrary/Hint}}

View File

@@ -1,6 +1,6 @@
title: $:/config/OfficialPluginLibrary
tags: $:/tags/PluginLibrary
url: https://tiddlywiki.com/prerelease/library/v5.2.7/index.html
url: https://tiddlywiki.com/prerelease/library/v5.2.8/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.

View File

@@ -17,5 +17,5 @@ The regular expression `[0-9]{2}` matches two consecutive digits. Because it con
<$macrocall
$name="wikitext-example-without-html"
src="""<$set name="digit-pattern" value="[0-9]{2}">
<<list-links "[regexp:title<digit-pattern>]">>
<<list-links "[regexp:title<digit-pattern>]" field:"title">>
</$set>"""/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View File

@@ -15,7 +15,7 @@ Note: Each first [[step|Filter Step]] of a [[filter run|Filter Run]] not given a
;filter
: A [[filter|Filters]] selecting which tiddlers to include
;caption
;field
: The name of the field to transclude for each list item, defaulting to `caption`
;type
: An HTML element to use for the overall list element, defaulting to `ul`

View File

@@ -1,6 +1,7 @@
caption: 5.2.7
created: 20230326083239710
modified: 20230326083239710
released: 20230326083239710
tags: ReleaseNotes
title: Release 5.2.7
type: text/vnd.tiddlywiki

View File

@@ -1,9 +1,14 @@
caption: $:/tags/ClassFilters/TiddlerTemplate
created: 20221020035738692
description: marks filters evaluated to dynamically add classes to the page template.
modified: 20221020035933363
modified: 20230326153057521
tags: SystemTags
title: SystemTag: $:/tags/ClassFilters/TiddlerTemplate
type: text/vnd.tiddlywiki
The [[system tag|SystemTags]] `$:/tags/ClassFilters/TiddlerTemplate` marks filters evaluated to dynamically add their output as CSS classes to the tiddler template.
The variables available are within each filter:
* <<.var storyTiddler>>: the tiddler in the story for which the filter should be evaluated.
* <<.var currentTiddler>>: the tiddler holding the filter definition being evaluated.

View File

@@ -1,7 +1,7 @@
{
"name": "tiddlywiki",
"preferGlobal": "true",
"version": "5.2.7",
"version": "5.2.8-prerelease",
"author": "Jeremy Ruston <jeremy@jermolene.com>",
"description": "a non-linear personal web notebook",
"contributors": [