1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-18 11:29:55 +00:00
Commit Graph

101 Commits

Author SHA1 Message Date
Robin Munn
246751be1b
Fix last filter operator when zero items selected (#7809)
Previously, [last[0]] was incorrectly returning the entire list. It now
returns zero items as it should.
2023-10-25 13:14:49 +01:00
Jeremy Ruston
08bad90e51 Ensure shadow tiddler listings are always sorted
Currently shadow tiddler ordering depends upon the order in which the shadows appear in the plugin JSON
2023-07-13 19:27:50 +01:00
Saq Imtiaz
f4626aa69e
Fix: Fix tests for deserialize[] so they can be run on browser as well as node.js (#7543) 2023-06-14 17:57:43 +01:00
Jeremy Ruston
0095ea60d9
Switch off CamelCase linking by default (#7513)
* Disable camelcase by default

* New parse rule for ~CamelCase

For backwards compatibility with text that includes ~ to suppress camelcase links

* Enable CamelCase for main documentation wikis

Will take us a bit longer to convert all the links over

* Fix tests

* Release note update
2023-06-08 21:45:14 +01:00
yaisog
d6533b9ee1
Add the timestamp suffix to the format operator (#7292)
* Create timestamp.js

Taken verbatim from @ericshulman.

* Add description of the timestamp suffix

* Add an example for timestamp use

I also snuck it a couple of cosmetic corrections, because I was too lazy to open a new PR. 😢

* Correct example 4 to use the right date formats

* Correct description of the default date format

* Add a test for the timestamp suffix

* Add more format:timestamp tests

* Drop invalid input

* Update version tag in docs

---------

Co-authored-by: jeremy@jermolene.com <jeremy@jermolene.com>
2023-05-06 11:44:22 +01:00
Jeremy Ruston
6bd4127e88
Parameterised transclusions (#6666)
* Initial commit

Everything is draft.

* Fix test execution

* Fix and test missing target handling

* Use the ubertransclude widget for the wikitext transclusion syntax

* Changed transclude widget in binary parser to ubertransclude

* Add a test for custom action widgets

* Don't worry about ordered attributes

The changes in 0bffae2108 mean that we don't need to explicitly maintain the ordered attributes

* Remove need to explicitly clear widget mapping variable when invoking overridden widget

* Use ts- prefix for system slot names

* Add a definition for the value widget just so that it doesn't cause errors

Of course, it doesn't actually need to be a JS widget, it could be a wikitext widget...

* Add support for positional parameters

* Ubertransclusion positional parameters should be based on name, not position

* Add support for shortcut syntax for positional transclusion parameters

* Importvariables should skip parameters widgets

* Refactor transclude widget before uberfying it

* Refactor ubertransclude functionality into transclude widget

* Replace ubertransclude widget with transclude widget

* Add wikitext shortcut for new-style function definitions

* Allow brackets to be omitted for function definitions with no parameters

* Add pragma rule for parameters declarations

* Remove erroneous "tag" property

* Add support for accessing function parameters as name/value pairs

* Be as permissive as possible with parameter names

Previously restricted to upper and lower case, digits and dash and underscore

* Rewrite some tests to use the shortcut syntaxes

* Mustn't allow commas in parameter names

* Fix crash when transcluding an undefined variable

Thanks @pmario

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1114692359

* Unquoted parameters should not eat a succeeding comma

Fixes #6672

* Remove extraneous code

* Allow the let widget to create variables starting with $

* Fix addAttributeToParseTreeNode handling of ordered attributes

* Reuse attribute objects when executing custom widgets

* Fix importing of function definitions

* Fix parameter handling

* Introduce genesis widget for dynamically creating widgets

See the "RedefineLet" test for a contrived example of usage

* Change tiddler separator used in wikitext tests

Underscore looked ambiguous; I kept typing dashes by accident

* Cache parse trees when transcluding variables

* Fix bug with empty strings ignored in $tw.utils.stringifyList/parseStringArray

I will pull this out into a separate PR. Fixing it doesn't cause problems for the core but I imagine it might cause issues for 3rd party code.

* Fixes to enable the transclude widget itself to be overridden

There are two big changes here:

Replace the previous "ts-wrapper" mechanism, which we had been using to redefine custom widgets inside their definitions to prevent recursive calls. Now we've got the genesis widget we can instead control recursion through a new "$remappable" attribute that allows the custom widget mechanism to be skipped.

We also extend the slot widget to allow a depth to be specified; it then reaches up by the indicated number of transclusion widgets to find the one from which it should retrieve the slot value.

* Fix genesis widget example

* Use enlist:raw to preserve duplicates

* Don't create variables with value undefined for missing parameters

* Fix variable retrieval bug with test harness

* Improve recursion detection

While retaining backwards compatibility

* Experimental support for custom filter operators

Just as we can define custom widgets we can also define custom parameterised filter operators

* Add visible transclusions component and demo

Very useful to see transclusions explicitly

Makes a good demo of a super-complicated widget override.

* Genesis widget should pass raw attributes onto child widget...

...so that it can more efficiently handle refreshing itself.

* Use consistent parse tree node property for params

* Extend transclude widget to work with old-style macros and use it for the macrocall shortcut syntax

* Clarify that the recent changes allow functions to be invoked with the double bracket syntax

In other words, the transclude widget distinguishes between functions and macros and handles the parameters appropriately

* Make the macrocall widget delegate to the transclude widget

* Switch to using \procedure to define new-style macros, and \function for custom filter operator functions

I now need to update the OP!

* Fix visible transclusion example

* Remove obsolete code

Left over after refactoring

* Better backwards compatibility for legacy recursion marker

Fixes the problem with tag dropdowns @btheado

* Fix stringifying/parsing string arrays containing newlines

A very old bug.

Fixes the ActionListOpsWidget problem @btheado

* Transclude: replace paramNames/paramValues with more robust JSON payload

More details at https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1123719153

* Rename internal "unknown" filter operator so that users cannot invoke it

* Detect recursion by tracking widget tree depth

The old recursion marker approach was very slow, and didn't catch test cases like editions/test/tiddlers/tests/data/transclude/Recursion.tid

* Use \widget for custom widget definitions, and remove need for angle brackets

Need to do some refactoring of all those isFunctionDefinition/isProcedureDefinition/isWidgetDefinition flags into a single property

* Rename <$value> widget to <$fill>

* Require $$ for custom widgets, and that overridden JS widgets must exist

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1133637763

* Fix invocation of JS macros

* Experimental update of the parse-tree preview visualisation

An experiment to try out using the new JSON operators for rendering the JSON parse tree that we get back from the wikify widget.

As usual with these experiments, this one is going to require quite a lot more work to finish up:

* The formatting is via direct styles rather than classes
* The formatting for attributes and properties is not yet completed
* The same thing needs to also be done to the widget tree preview

* Procedures and widgets inherit whitespace trim setting from their definition

* Missed off 22e7ec2381

* Require period prefix for custom filter operator functions

To ensure that custom filter operators cannot clash with future core operators.

* Allow custom functions to be invoked as attributes

* WIP

* Remove unneeded test tiddler

* Make is[variable] and variables[] operators resilient to fake widgets

* Fix importvariables to work with setvariables as well as set (they are aliases)

* Add support for $:/tags/Global

* Remove accidental commit 6cc99fcbe3

* Add utility function for parsing macro parameter definitions

* Introduce true global variables

The basic idea is that if we don't find a variable `foo` then we fallback to retrieving the value from the tiddler `$:/global/foo`, if it exists.

This allows us to replace the usual importvariables-based mechanism for global definitions, avoiding cluttering up the variable namespace with every macro.

In order to permit subprocedures to be overridden, we also introduce a mechanism for conditional definitions: preceding the word definition|procedure|function|widget with a + causes the definition only to occur if the specified variable doesn't already exist. In the next commit we'll apply this mechanism to the tabs macro

* Convert the tabs macro into a global

So far it appears to be totally backwards compatible... In practice, I think maybe this and the conversion of the other macros should go into a separate subsequent PR.

* Change to `?` for conditional definitions

* Fix tabs global so it doesn't crash when viewed directly

* Test showing how to un-override a core widget

* Cleaning up after f636349007

* Minor cleanups

* Clean up unknown filter

* Introduce function operator for calling functions

Can invoke any functions, not just those start with a period. And can pass zero parameters (in contrast when invoked as a custom filter operator there's no way to omit the first parameter).

* Use underscores for new system fields for global variable tiddlers

For consistency with `_canonical_uri`; unlike many system fields, the behaviour of these fields is baked into the core JS code.

* Refactor $parameters widget

The objective is to add a $depth attribute so that it is possible to reach up to retrieve the parameters of ancestor transclusions. However, doing so requires changing the encoding of parameter names so that it is not possible for a user parameter to clash with an attribute like $depth. So now we have to double up dollars on any attribute names seen by the parameters widget, just like with the transclude widget itself.

* Fix refreshing of global variables

Global variables access within attributes will automatically trigger a refresh if the attribute text changes, but that wasn't happening for transclusions.

* Remove support for $:/tags/Global

It is not needed now that we have true global variables

* Typo from f513b403fe

* Make slot fill data available to transclusions

Allows transcluded content to dynamically process <$fill> widgets within the calling transclusion

* Mark docs as v5.3.0

* Simplify metaparameters implementation

* Fix typo

* Adjust naming of transclusion metaparameter

* Fix up handling of slot/fill for custom widgets

Previously we were wrapping the body in an implicit `<$fill $name="ts-body">` widget

* Add format:json operator

I've been finding this useful for debugging, and it kind of goes with the JSON operators

* Docs: JSON operators and tweaks to genesis widget

* Docs: format:json

Also tweak to the behaviour of format:json if the input string is not valid JSON

* Fix #6721

* Revert "Fix #6721"

This reverts commit b216579255 which was committed to the wrong branch

* Fix new selection tracker to return relative coordinates

* Make use of type attribute consistent

* Docs: Transclude widget

* Simplify the fill widget

We can rely on the default processing in the base class

* Slot widget: be more defensive about negative depth values

* Parameters widget: Be defensive about negative depths

* Protect against excessively recursive functions

* FIx transcluding of functions

This first implementation concatenates the results of the filter (with no separator) and then wikifies the result.

The test in this commit is quite interesting...

* Tweak semantics of JSON operators to match #6932

This allows us to later bring in the optimisations without breaking backwards compatibility.

* Revert obsolete changes to boot.js

* Fix inadvertent whitespace change

* Remove tests related to obsolete changes to boot.js

Should have been part of 2f494ba152

* Revert changes to parse tree preview

This implementation requires #6666

* Add test to show that global widgets need not use the _parameters field

* Disable overriding core widgets in safe mode

* Coding style tweak

* More comments

* Fix caching of parse variables/macros/procedures

* Transcluded functions should operate on the entire store

* Refactor filter recursion detection to avoid an unneeded wrapper function

* Fix error in 25312b3e32

* WIP

* Revert "WIP"

This reverts commit 8654dfc679.

* When transcluding functions, pass an empty item list to the filter, and just return the first item

* Rejig genesis widget to be easier to use

* Parameters widget: protect against negative $depth

* Docs updates

* Docs updates

* Tweak comments

* Add custom view template body for globals, and a new sidebar tab under "more"

And also a custom view template title that greys out the $:/global/ part of the title

* Update function operator to return the input list if the function is missing

* Remove negation from function operator

This implementation was not useful.

* Tests and docs for function operator

* Docs tweaks

* Improve indentation

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#discussion_r967655251

* Missing tests for parameters widget

* Fix visible transclude

* Docs update

* Docs typo

* Huge Documentation Update

Not quite finished, but definitely on the home stretch

* Slight optimisation to user defined widgets

* Remove implementation of $:/globals/

Performance with this implementation is inherently poor because of the need to perform a wiki lookup for each child widget created.

* Docs clarification

* Docs update

* Some widget.js cleanups

* Remove support for conditional definitions

It was introduced for use cases associated with the global mechanism that was dropped in e3d13696c8

* Docs updates

* Revert change to setwidget docs

* Docs update

* Docs updates

* Clarify/simplify some tests

* More docs updates

* Fix doc file locations

* Docs updates

* Revert modified date of docs that have only had minor tweaks

* Docs typo

https://github.com/Jermolene/TiddlyWiki5/pull/6666#discussion_r990811220

Thanks @btheado

* Transcluding functions: fix missing parameters passed as undefined

Thanks @btheado – see https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1276187372

* Parameter parenthesis should be mandatory in function/procedure/widget definitions

See https://github.com/Jermolene/TiddlyWiki5/pull/6666#issuecomment-1280404387

* Attempt to build this branch with CI

* Add release note etc for 5.3.0

* Temporary new release banner for v5.3.0

* New New Release Banner

* New test for undefined parameters

* Adjust modified times of docs tiddlers to make them easier to find

* Update release note

* Add parenthesis to the visible transclusion definition

Parenthesis were made mandatory in 5194b24108

Fixes #6998

* Fix macrocall refresh issue

It turns out that this.transcludeTitle is always truthy, even if we are transcluding a variable

Fixes #7001

* Filter run prefixes should use widget.makeFakeWidgetWithVariables

* Docs typo

Thanks @twMat

* Docs: clarify function operator invocation

See discussion at https://github.com/Jermolene/TiddlyWiki5/issues/6991#issuecomment-1301703599

* Docs: Update \define pragma to cover named ends

* Docs: move tiddlers to correct directory

* Add support for named end markers for procedures, functions and widgets

* Docs note about nested macro definitions

* Rename test

* Fix detection of empty transclusions

See https://talk.tiddlywiki.org/t/exploring-default-tiddler-links-hackability-in-v5-3-0/5745/25?u=jeremyruston

* New test missed off a45349cc99

* Refactor wikified function tests

* Refactor function invocation

* Introduce new widget helper function to evaluate variables.Functions are evaluated as parameterised filter strings, macros as text with textual substitution of parameters and variables, and procedures and widgets as plain text
* Refactor the function operator and unknown operator to use the new helper
* Use the new helper to evaluate variables within filter strings, thus fixing a bug whereby functions called in such a way were being returned as plain text instead of being evaluated
* Refactor the transclude widget to use the new helper
* Update tests

* Fix positional parameters in widget.evaluateVariable()

This should clear up the remaining anomalies in #7009, let me know how you get on @btheado

* Remove 5.2.8 release note

* Fix nonstandard initialisation code for fill/parameter/slot widgets

* Update modification times of doc tiddlers

So that they are at the top of the recent tab

* Update 5.3.0 release note

* Remove custom CI step for this branch

* Restore standard sitetitle
2023-04-19 11:55:25 +01:00
Jeremy Ruston
11ffc83493
Introduce new levenshtein, makepatches, applypatches operators (#7290)
* Initial Commit

* Fix crash with invalid patches

See https://github.com/Jermolene/TiddlyWiki5/pull/7290#issuecomment-1453155311

Thanks @yaisog

* Add words and lines options to makepatches (#7326)

* Prevent infinite loop for single-word texts (#7327)

* Add docs and examples for the new operators (#7328)

* Create makepatches Operator.tid

* Improve wording

* Doc and examples for the new operators

---------

Co-authored-by: yaisog <m@rcuswinter.de>
2023-03-04 21:16:26 +00:00
Jeremy Ruston
a5894946de
Extend encodeuricomponent to process additional characters (#7128)
* First commit

* Fix version number in docs

* Add code comment
2023-01-19 17:45:54 +00:00
btheado
6f9cf20e77
Fixes reduce, filter, and sortsub operators undefined variable exception (#7156)
* Added failing tests for #7155

* Pass getVariable options through to the widget method. Fixes #7155

* Whitespace fix

* Added tests to verify macro parameters work inside filter, reduce, and sortsub operators
2023-01-03 13:48:20 +00:00
Robin Munn
18d8173dcc
New insertafter filter operator (#6771)
* Implement insertafter operator (like insertbefore)

Currently, the behavior of insertafter if the target is not found is to
append the inserted tiddler to the end of the list, like insertbefore
does. In the next commit, we'll add a suffix to customize what both
insertafter and insertbefore do when the target is not found.

* Add failing tests for insertafter suffixes

Also includes tests for insertbefore suffixes (start/end), since we'll
be implementing both of those at the same time.

* Add start/end suffixes for insertafter/before

The tests that exercise the start/end suffixes now pass.
2022-07-13 17:08:17 +01:00
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