1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-16 18:39:54 +00:00
Commit Graph

91 Commits

Author SHA1 Message Date
jeremy@jermolene.com
35b0833e0c Fix handling of {!!title} in a filter with no currentTiddler
Fixes #6721
2022-06-14 08:33:47 +01:00
Ben Webber
2c38c8351b
Make butlast[0] consistent with rest (#6483)
butlast[0] now returns the input list unchanged.

Fixes: #5833
2022-02-26 09:42:24 +00:00
Ben Webber
a51191d334
Support specifying insertbefore position title as parameter (#6477)
* Support specifying insertbefore position title as parameter

Closes: #6133

* Update insertbefore calls with new variable parameter syntax

See-also: 96b52606a (Support specifying insertbefore position title as parameter, 2022-02-21)
2022-02-24 11:08:06 +00:00
Ben Webber
7a7472833f
Consider non-existent tiddlers untagged (#6478)
Fixes regression introduced in 575c23359.

Fixes: #6119
See-also: 575c23359 (Update untagged filter to avoid $tw.utils.pushTop (#6034), 2021-09-18)
2022-02-23 12:46:34 +00:00
Cameron Fischer
d0b5b2124a
Is draft (#6442)
* corrected [!is[draft]] to be a proper complement

* Ensuring [is[draft]] and [!is[draft]] are complements

* Made [is[draft]] more analogous to .isDraft()
2022-02-22 16:41:29 +00:00
Ben Webber
95bd694a65
Support case insensitive matching in prefix/suffix operators (#6468)
* Support case insensitive matching in prefix/suffix operators

Support `caseinsensitive`/`caseinsensitive` suffixes in the following
filter operators:

  * prefix
  * suffix
  * removeprefix
  * removesuffix

The suffixes have the same behaviour as in the match operator.

Closes: #6407

* Do not filter titles if suffix/removesuffix operand is empty

Issue: #6407
2022-02-22 16:38:40 +00:00
Jeremy Ruston
36b162a377
Fix for tag ordering issue #6382 (#6383)
* Failing test

* Fix underlying problem

* Less naive fix

Now we make sure we maintain the sort order of the titles array when adding a new tiddler

* Fix failing tests

* Refactor filter tests to repeat them with different store orderings

* Revert "Fix failing tests"

This reverts commit ee03ee57f5.

* Refine fix to retain stylesheet ordering

The order of tiddlers in the HTML file uses localeCompare(), and that determines the insertion order. So if we want to be compatible with older versions we have to use localeCompare() to order tiddlers, not a plain sort()

* Don't sort shadow tiddlers

Instead rely on the existing ordering

* Fix failing tests, take 2

I think that all of these changes are explained by the store no longer retaining insertion order, but now using localecompare ordering

* Fix tests from #6327
2022-02-21 15:34:05 +00:00
Cameron Fischer
a4ab42da8a
findListingsOfTiddler should cache results (#6327)
* findListingsOfTiddler uses FieldIndexer now

* Turns out FieldIndexer can't help listed[]
2022-02-21 15:07:30 +00:00
Mario Pietsch
6b4e5c74ad
Add "some" flag to search operator (#6293) 2022-02-21 15:05:34 +00:00
Joshua Fontany
1d0af90ba2
Extend lookup operator to work with fields and indexes (#5742)
* extend lookup op flexibility with 2 parameters

* bumped .from macro to .24

* aligned syntax

* lookup fixes

* bugfix

* docs

* messed up the tests somehow

* docs fix

* lookup bugfix

* docs

* docs

* call self.displayError

* Revert "call self.displayError"

This reverts commit 5d599aa979.

* storylist

* tests

* tests pass
2022-02-21 09:48:29 +00:00
Cameron Fischer
1b3c2557b8
Fixed issue: deprecated regexp could cause crash (#6438)
* Fixed issue: deprecated regexp could cause crash

* Different fix which will bother plugins less
2022-02-07 16:39:29 +00:00
Saq Imtiaz
b6ce353a7d
Fix: resolved search-replace operator regexp encoding bug (#6162)
* fix: resolved search-replace operator bug with $ character in replacement strings, added test and more examples

* fix: reset regexp after each title
2021-11-01 13:24:30 +00:00
jeremy@jermolene.com
0be39cfbc2 More sorting tests to help with #6053 2021-09-20 11:04:37 +01:00
jeremy@jermolene.com
e6fd0caf6b Update range operator to use multiple operands
We still also support the old way of packing all three parameters into one operand with a delimiter
2021-09-07 17:16:09 +01:00
Simon Huber
c13f04d838
Add m flag for multiline matches to search-replace filter operator (#5968)
* add m flag to search-replace operator and add tests

* update documentation

* Update test-filters.js

* Update test-filters.js

* Update search-replace Operator (Examples).tid

* Fix "Hello There" title (HelloThere)
2021-08-29 17:44:34 +01:00
Saq Imtiaz
041c3e817c
Support for macro params in filter operands (#5836)
* Exploratory pass at adding support for macro params in filter operands

* whitspace correction

* rename varInfo to varTree for disambiguation

* Refactored parseMacroInvocation to be re-usable, performance improvements for variables with no params and tests

* Revised regular expression and removed spurious white space changes

* Revised regular expression and removed spurious white space changes

* More whitespace cleanup and added more tests for edge cases

* Added test for macro params with square brackets
2021-06-29 22:21:39 +01:00
jeremy@jermolene.com
83ee363cb4 Add charcode operator to make it easier to generate strings containing control characters
Avoids some confusing hacks. @saqimtiaz I'm guessing you might have already done something like this?
2021-06-22 21:52:00 +01:00
Saq Imtiaz
7a41283c6b
Format:titlelist operator (#5665) 2021-05-24 19:28:43 +01:00
Saq Imtiaz
10b20657cc
Deserializers[] filter operator (#5673) 2021-05-22 10:50:11 +01:00
Saq Imtiaz
cb44cc0f2b
Add :sort filter run prefix (#5653)
* Add :sort filter run prefix, docs and tests. Also extended .utils.makeCompareFunction with a flag for caseSensitivity.

* Documentation updates

* Move case sensitivity handling entirely to utils method so it is reusable
2021-05-01 13:58:40 +01:00
cdruan
3b35411aba
Change css-escape-polyfill to a tw uitility method (#5552)
* Replace css-escape-polyfill.js with escapecss.js utility module

* Add $tw.utils.escapeCSS() method and invoke that function within the
  escapecss operator.

* Add test cases for the "escapecss" filter operator

* Fix $tw.boot.doesTaskMatchPlatform() so it works as expected if
  a module's export.platforms contains more than one values

* Add missed files to the last commit
2021-04-02 09:25:01 +01:00
Cameron Fischer
427eb6d085
Refactored filter tests to use nifty spyOn method (#5550) 2021-03-18 08:57:21 +00:00
Cameron Fischer
b8a9826f23
Cleaned up jasmine test suite output (#5377)
* Cleaned up jasmine test suite output

Also testing for expected log messages, instead of just letting them print
to the console every single time, constantly making you think there's some
warning you need to worry about, and making all those dots not line up nicely.

* switched single quotes to double in collectLogs
2021-01-09 20:53:17 +00:00
Cameron Fischer
be70e5851d
Taking advantage of linkedLists in all operator (#5362)
* Taking advantage of linkedLists in all operator

* Test to confirm [all[]] with LinkList is the same
2021-01-04 08:38:50 +00:00
Cameron Fischer
fbe5bb229a
Fix for filterrunprefixes using $tw.wiki (#5202)
* Fixed runprefix 'and' to use widget wiki

* Made widget arg of filterTiddlers optional again

* Switched to passing {wiki: wiki} to prefixes
2020-12-05 16:12:40 +00:00
Robin Munn
fd3e77d38f
"dedupe" and "raw" suffixes for enlist-input operator (#5152)
Includes unit tests.
2020-11-30 17:52:46 +00:00
saqimtiaz
8fc6910c03
Added string operator pad[] along with tests and docs (#5146) 2020-11-30 17:43:50 +00:00
saqimtiaz
51ca14861e
Fixed bug with default value in lookup operator (#5088)
* Fixed bug with default value in lookup operator

* Fixed test for lookup operator with default
2020-11-22 20:43:36 +00:00
saqimtiaz
13499557bf
Fix whitespace in x-listops.js and tweak toggle operator (#5024)
* Replaced leading spaces with tabs

* Tweak toggle[] to insert new value in same list position
2020-11-15 16:04:03 +00:00
saqimtiaz
445c15e719
Extend toggle operator (#5015)
* Extend toggle operator to support optional second operand to toggle a value pair

* Added tests for extended toggle filter

* Updated docs for toggle operator
2020-11-09 18:27:45 +00:00
saqimtiaz
66636d1a86
Docs for new operators (#4994)
* Docs for is[draft]

* Better error handling for suffixes

* Docs for search-replace operator

* Added tests for search-replace operator

* Docs for toggle operator
2020-11-08 09:34:05 +00:00
saqimtiaz
2b31c7a509
Multiple operands for filter operators (#4964)
* Firt pass at adding multiple operands to filter operators

* Optimized parsing of multiple operands and added more tests. Need more flexibility for interpreting multiple operands as variables/text references

* Add support for parsing text references and variables in multiple operands

* Added string-replace filter for testing multiple filter operands

* Added more tests for variables and text references in operands

* Removed string-replace operator and some whitespace corrections

* Removed string-replace operator and some whitespace corrections

* Added test with comma in operand
2020-11-07 09:47:08 +00:00
saqimtiaz
e7245a709c
Add string operator enlist-input[] (#4948)
* Add string operator titlelist[]

* Update strings.js

* Update strings.js

* Add tests
2020-11-01 17:11:46 +00:00
Robin Munn
77fe6244a2
Fix bug with sortan operator called on date fields (#4839)
* Add failing unit test that shows the bug

* Fix the bug
2020-11-01 10:45:18 +00:00
Robin Munn
d5cf4112fa
Joining an empty list should return an empty list (#4853) 2020-09-24 18:37:51 +01:00
Robin Munn
5202441769
Add suffix and parameter to trim operator (#4811)
* Add suffix and parameter to trim operator

Fixes #4809

* Unit tests for new trim operator parameters

* Mention trim operator in 5.1.23 release notes

* Address review comments

* Move regex escaping into utils.js trim functions

This way the trimPrefix and trimSuffix functions from utils.js are safe
to call without regex-escaping their parameters, which should make them
easier to use from other parts of the Javascript code.
2020-08-29 12:27:58 +01:00
Bimba Laszlo
6570561d4e
The !has[tags] filter didn't work because tags field is an array (#4643)
* The `!has[tags]` filter didn't work because "tags" is an array

The negated `has` filter only considered empty strings, but not empty
arrays (such as the `tags` field).

* Add tests for `has` filter operator with array-like fields (tags, list)
2020-05-14 13:57:12 +01:00
jeremy@jermolene.com
4966f6ab62 Add slugify and duplicateslugs operators
Fixes #3379
2020-05-09 15:54:44 +01:00
jeremy@jermolene.com
ad575efdcc Update sortsub to evaluate the subfilter for each item in the list
See the discussion here https://groups.google.com/d/msg/tiddlywiki/BqUFQ3v-fZw/U0F04CFFBQAJ
2020-04-25 15:22:24 +01:00
jeremy@jermolene.com
619c0752bd Add new sortsub operator 2020-04-25 11:26:19 +01:00
Cameron Fischer
65347ae858
Fixed join filter operator to never returns null (#4396)
If the operator were passed an empty list, it would return null
which could cause some proceeding operators to crash.
2020-04-14 17:49:38 +01:00
Mario Pietsch
db13e49724
More listops tests (#4409)
* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* make eslint happy

* add more listops tests

* new listops filter tests

* remove new-line

* make eslint happier.

* revert eslint settings
2020-01-31 14:09:06 +00:00
Mario Pietsch
3aa5198c3e Update tests (#4392)
add 3 new tiddlers, add 1 "enlist" test, fix all tests that failed, because 3 new tiddlers where added. stopped ESLint to complain about global vars, fix some mixed-tab-space indent typos.
2019-12-19 13:38:09 +00:00
Jeremy Ruston
17711657b6 Add then and else operators
Fixes #4147
2019-08-02 14:27:58 +01:00
Jeremy Ruston
3afaa9de9a Add support for anchored searches 2019-07-31 21:36:12 +01:00
Jeremy Ruston
5faae2547d Add "match" operator for string comparison
Fixes #4130
2019-07-31 09:11:12 +01:00
Jeremy Ruston
269fa5313f Fix for index ordering issue
Fixes #4082

This version removes selective updating of the tag index, instead completely clearing the index on each update. I'm investigating restoring that optimisation.
2019-07-28 16:39:34 +01:00
Jeremy Ruston
cbd07465f3 Fix test rig shadow tiddler behaviour
The test rig previously used a simplified implementation of shadow tiddlers which broke with the new indexing engine. There was also a problem that made that even if indexers were disabled they were still initialised.

This PR fixes both problems, in preparation for fixing #4082
2019-07-16 16:53:37 +01:00
Jeremy Ruston
c8d6f3b681 Fix tests for changes to split operator
We now retain any blank strings
2019-06-21 10:36:53 +01:00
Jeremy Ruston
630a0ecf9e Remove test for concat operator 2019-06-13 16:55:55 +01:00