1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-05 11:43:16 +00:00
Commit Graph

246 Commits

Author SHA1 Message Date
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
jeremy@jermolene.com
34a51d2e23 Typo in comment
Thanks @saqimtiaz
2020-10-08 17:21:31 +01:00
jeremy@jermolene.com
14a28b7779 Add "reduce" and "filter" operators 2020-10-06 19:20:03 +01:00
Robin Munn
d5cf4112fa
Joining an empty list should return an empty list (#4853) 2020-09-24 18:37:51 +01:00
saqimtiaz
72c07a3f81
Format filter to create formatted date strings (#4785)
* asdate filter to create formatted date strings

* Added format filter operator
2020-09-24 18:35:10 +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
5c0d91c510 Fix title of slugify.js filter module 2020-05-14 07:53:30 +01:00
jeremy@jermolene.com
4966f6ab62 Add slugify and duplicateslugs operators
Fixes #3379
2020-05-09 15:54:44 +01:00
Arlen22
81f07cdf85
Use this.wiki where applicable (#4601)
* Use state.wiki

* use local wiki where available

* fix a couple this vs self cases
2020-05-06 11:27:50 +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
Mario Pietsch
de5b0062b5
Add new parameters to fields-widget and fields-operator. (#4433)
* add a new-line before the log text to increase readability of the test output

* make eslint, jslint happy

* extend fields-widget with include/exclude/sort/reverse and fields-filter with include and exclude params plus DOCS

* remove new-line

* remove eslint settings

* restore old eslint settings

* remove typo
2020-04-15 12:36:48 +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
Joshua Fontany
69c8058b72
Add has:index (#4540)
* has:index

* has:index

* has:index docs

* has op examples

* has op examples

* operator macros typo missing </div>

* possible mistake
2020-04-14 16:52:56 +01:00
Jeremy Ruston
7b53f5724c Add new compare filter operator
Fixes #4554
2020-04-13 10:03:01 +01:00
Jeremy Ruston
8c89461291 Adding [is[binary]] filter -- Missed off 1150c87ed 2019-09-16 16:16:03 +01:00
Jeremy Ruston
953038f0b2 Don't use field indexer when looking for blank/missing fields
Fixes #4247
2019-09-09 14:47:27 +01: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
Simon Huber
69d3a47073 Add escapecss filter (#3546)
* add escapecss filter

this filter would allow creating valid css classes from titles containing special characters

we assign a class to an element using `encodeuricomponent[]` so that the class name is encoded

in a stylesheet we create the classname by `<title>escapecss[]` which applies the uri encoding and escapes characters that need to be escaped

* Update encodings.js

* refactor tagToCssSelector, add escapeCssSelector

* use escapeCssSelector

* escape using CSS.escape if it's available

* Update encodings.js

* revert factoring out escapeCssSelector
2019-06-26 12:32:01 +01:00
Jeremy Ruston
6582b106ee Fixes to split operator, plus instructions for using it to do search and replace 2019-06-21 10:21:52 +01:00
Jeremy Ruston
90684f9f52 Add support for [is[blank]] to detect empty/blank strings 2019-06-21 10:20:37 +01:00
Robin Munn
9b27f82a80 Fix sentencecase operator, add titlecase operator (#4006) 2019-06-21 08:24:02 +01:00
Jeremy Ruston
2e2ed7902c Add sentencecase operator
Fixes #4000
2019-06-19 12:11:02 +01:00
Robin Munn
62829dc9d3 Add untrunc operator, the mirror of trunc (#3994) 2019-06-17 18:34:30 +01:00
Jeremy Ruston
73eb7fbd4e Maths operators: Remove concat (same as addsuffix) and add splitregexp 2019-06-13 16:52:19 +01:00
Jeremy Ruston
86387a9185 Add some error trapping to maths operators 2019-06-11 17:18:18 +01:00
Jeremy Ruston
dd7837d164 Fix issue with allafter operator
Fixes #3962
2019-06-11 09:38:14 +01:00
Jeremy Ruston
18fe112da7 Extend the enlist operator to optionally not de-duplicate 2019-06-10 17:54:46 +01:00
Jeremy Ruston
a8f70b08a8
Add indexes to the wiki store to improve performance (#3951)
* First pass at modular wiki indexes

An exploratory experiment

* Fix tests

* Faster checking for existence of index methods

We don't really need to check the type

* Use the index for the has operator

* Fix typo

* Move iterator index methods into indexer modules

Now boot.js doesn't know the core indexers

* Fix up the other iterator index functions

* Fix crash with missing index branch

* Limit the field indexer to values less than 128 characters

* Fallback to the old manual scan if the index method returns null
* Sadly, we can no longe re-use the field indexer to accelerate the `has` operator, because the index now omits tiddlers that have field values longer than the limit

Still need to make the index configuration exposed somehow

* Rearrange tests so that we can test with and without indexers

We also need to expose the list of enabled indexers as a config option

* Test the field indexer with different length fields

So that we test the indexed and non-indexed codepaths
2019-05-24 21:07:37 +01:00
Jermolene
754c1251a9 Add new "variables" and "getvariables" operators 2019-03-30 10:52:28 +00:00
Simon Huber
784db30614 Fix removesuffix filter when title is undefined (#3827) 2019-03-11 09:37:49 +00:00
Jermolene
b862348b06 Fix !is[variable] operator
Fixes #3804
2019-02-28 11:54:04 +00:00
Jermolene
36e76429b1 Add is[variable] filter
See discussion here https://groups.google.com/d/topic/tiddlywiki/4rEuAWc4EpM/discussion
2019-02-25 13:08:22 +00:00
Jermolene
9d7d3fefa0 Split operator: Remove empty strings when splitting
See the discussion on 9b2d527; thanks @kookma
2019-02-08 15:59:07 +00:00
Jermolene
7df58a6813 Fixed bug with length operator
Thanks @BurningTreeC
2019-02-07 12:56:12 +00:00
Jermolene
dc29acd656 Fixed bug with split operator 2019-02-07 12:45:07 +00:00
Jermolene
9b2d52716a Add new string operators: length, join, split, concat etc. 2019-02-07 11:18:53 +00:00
Jermolene
64b665e706 More maths operators 2019-02-07 11:18:32 +00:00
Jermolene
0ea00b59b0 Add numeric maths filter operators
There are other ways we could add maths to TW5 (including @EvanBalster's awesome https://github.com/EvanBalster/TiddlyWikiFormula) but the approach here has the merit of simplicity because it reuses the existing filter evaluation mechanism. That means that it's not ordinary "2+2" maths, it's a unique list processing language...

Docs to come

Fixes #254
2019-02-06 14:19:55 +00:00
Evan Balster
b9df224f99 Change to natural counting in range[N] operator (#3609)
* Add range operator and documentation

* Use 1-based counting in range[N], update docs
2018-12-02 08:39:28 +00:00
Jeremy Ruston
33dd367a65
Introduce new subfilter operator (#3508) 2018-11-16 11:27:19 +00:00
Jermolene
b584295831 Fix crash with search operator with blank field list 2018-11-01 12:56:56 +00:00
Jeremy Ruston
6dcdc2049a
Enhance search operator (#3502)
* Enhance search operator

* Add support for searching all fields

and also searching all fields except nominated fields.

* Docs tweaks

Thanks @pmario

* Error message improvements

* Improve error message formatting
2018-10-30 17:39:18 +00:00
Jermolene
874318091e Fix crash with illegal arguments to decodeuri(component)
Fixes #3428
2018-09-09 20:48:53 +01:00
Jermolene
763f8afaf2 Add "contains" filter operator for searching list fields 2018-08-15 13:50:07 +01:00
Jermolene
8520c9d8fd Coding style tweaks for #3346 2018-07-19 21:48:40 +01:00
Evan Balster
be58de8409 Add range operator and documentation (#3346) 2018-07-19 21:42:09 +01:00
Jermolene
737e9ae4cb Revert multiple suboperator functionality from the "is" operator
See the discussion here: https://github.com/Jermolene/TiddlyWiki5/pull/3240#issuecomment-388035466
2018-05-10 13:15:49 +01:00
Matt Lauber
0ab9ec1ad3 Refactored the is operator for simplicity and efficiency. (#3240)
* Refactored the is operator for simplicity and efficiency.

* Improve `is` filter documentation.

* Update is.js

* extracted `subops.length` to `num_of_subops`
* renamed `subop` to `operator` for clarity/differentiation from `subops`
* refactored to avoid using a `Set` object.

* Update is.js
2018-05-09 18:07:08 +01:00
Matt Lauber
5ea6c9a273 Modify the is operator to allow multiple types to be specified. (#2982)
* Modify the is operator to allow multiple types to be specified.

* Fixed indentation.

* Fixed indentation.

* Rewritten to maintain input order when multiple filters provided.

* Updated documentation.

* Update is.tid
2018-04-12 13:21:49 +01:00
Jermolene
47cdf55133 Add new subtiddlerfields filter operator 2018-04-03 17:48:01 +01:00
Skeeve
6401b5c886 Now fixing bug mentioned in groups (#3188)
* fixed the "0 is not a number bug" in listops and x-listops

* Fixed one comment

* "default" is not a good name for a variable

* Following code styles.
Moving getInt to utils.

* Removing unwanted spaces introduced by me
2018-04-02 19:40:47 +01:00
Rizwan
2b0204422d Sortan filter for alpha-numeric filter (#3134)
* Sortan filter for alpha-numeric filter

* Removing Case sensitive option, Removing default value for isAlphanumeric parameter, updating formatting

* Formatting changes

* Formatting changes
2018-03-05 11:09:25 +00:00
Skeeve
5963adf92e Bugfix/3117 inconsistent each (#3124)
* Following Jeremy's proposal of using a new suffix

* typo fixed
2018-02-17 18:51:18 +00:00
Jermolene
e4b10d42f9 Optimise the tag filter
Spending a bit more time with Chrome dev tools, and further to 254e1ca, this optimisation reduces the rendering time for the sample TOC from 1.9s to about 0.9s...
2017-12-21 16:13:47 +00:00
Jermolene
d7a6816307 Add jsonstringify operator 2017-10-29 15:53:53 +00:00
Jermolene
aa417fe899 Add new "lookup" filter 2017-09-07 15:48:00 +01:00
Xavier Cazin
a7b57d7f97 allbefore:include should be the identity function when applied to 1st item (#2842)
* fr-FR translation of additional error strings

* allbefore:include should be the identity function when applied to the 1st item
2017-06-29 18:02:33 +01:00
Jermolene
f4656b0f25 Add support dragging to the bottom of a list 2017-03-20 22:02:55 +00:00
Jermolene
eba1c3c160 Improve support for drag and drop
Documentation TBD
2017-03-19 19:33:56 +00:00
Jermolene
ad1c2a6571 Fix problem with 'has' operator
Fixes problem introduced in 6085936475
2017-02-23 14:27:43 +00:00
Tobias Beer
6085936475 Introduce "field" suffix for "has" filter operator (#2066)
* has:field — tested & documented

allows to test whether a field exists

* fixed inverted condition

* added from version to docs
2017-02-22 12:13:59 +00:00
Jermolene
cd2bc88658 Add "enlist" operator
Fixes #2767
2017-02-21 15:17:47 +00:00
Jermolene
9fc2086b71 Optimise sameday filter
I used this test:

console.time();for(var t=0; t<200; t++)
{$tw.wiki.filterTiddlers("[all[tiddlers+shadows]sameday[20170210]]");};c
onsole.timeEnd()

Before this patch, I got speeds of approx 190ms, versus 140ms
afterwards.

Note that the ability to add a cache property like this is only
possible because tiddler objects are immutable.
2017-02-21 08:31:05 +00:00
Jermolene
73ded6a82a Add new "count" filter operator
See discussion here:
https://groups.google.com/d/msgid/tiddlywiki/fe51b7f5-5369-493b-82e5-94c
18e863fe0%40googlegroups.com?utm_medium=email&utm_source=footer
2017-02-08 20:11:44 +00:00
Matt Lauber
9c3a6976f0 #2312 Prevent move filter from wrapping (#2658)
given a list `A B C D` if I run `A B C D +[move:-1 [A]]` I get `B C A D`.  However, if I were to do `A B C D +[move:1[D]]` it doesn't wrap around, and I get `A B C D`.  This fixes that such that `A B C D +[move:-1 [A]]` gives 'A B C D`
2016-12-16 17:58:45 +00:00
Jermolene
9a38642141 Add new "order" filter operator 2016-11-28 19:16:08 +00:00
Jermolene
a3dc3b4b98 Add new [all[tags]] filter operator 2016-11-28 19:04:04 +00:00
Jermolene
c65d08240b Add strict mode to tag operator 2016-11-28 13:42:30 +00:00
Jermolene
c460cc03a4 Change "is" filter with blank operand to pass through arguments 2016-11-28 13:42:06 +00:00
Jeremy Ruston
a9b54d6fce Revert "Add provisional version of new tagger manager" 2016-11-28 10:40:55 +00:00
Jermolene
8e033eb0d4 Add new "all[tags]" filter operator 2016-11-27 14:52:04 +00:00
Jermolene
0b4669621a Return all tiddlers when "is" filter operand is missing 2016-11-27 14:51:51 +00:00
Jermolene
e98d324e66 Add provisional version of new tagger manager
For discussion
2016-11-26 12:48:47 +00:00
Jermolene
b4b77d1681 Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
Jermolene
ffcbcbfa82 Add new 'minlength' operator
Fixes #1493
2016-10-11 09:26:20 +01:00
Tobias Beer
f575389d89 Update wikiparserrules operator for no operand (#2193)
* return all wikiparserrules w/o operand

* simpler layout & code / updated instruction details

Also wanted to link each rule to the official docs using a dictionary at
`$:/language/Docs/ParserRules/`. However, without #2194 this is not
doable.
2016-10-08 13:04:11 +01:00
Myeongjin
6388f859d1 Add localisable strings for error (#2447)
* Add localisable strings for error

* Update tiddler Transclusion Basic Usage in fr-FR
2016-05-17 21:58:47 +01:00
nameanyone
19ee5bcf4e "days" filter: yesterday and tomorrow edge cases (#2364)
* Change the negation logic to address an edge case

Make it possible to get an interval ending with yesterday or starting with tomorrow.

* "days" filter: adjust documentation
2016-04-27 17:23:46 +01:00
Matt Lauber
899c5cb835 Update has.js 2016-02-18 11:51:29 -05:00
Matt Lauber
5a14b37686 Update to check if empty sting OR (is array AND is empty) 2016-02-16 08:08:09 -05:00
Matt Lauber
22145e2e51 Fix for #2274
List fields (such as tags) when evaluated to produce tiddlers result in empty arrays.  Using the exact not equals, an empty array is not the same as an empty string.  By using equivelent not equals, we state that the field is either != "" or anything that can be coerced to "".  Which, based on https://dorey.github.io/JavaScript-Equality-Table/ is `false` `0` `[]` or `[[]]`` neither `false` nor `0` can be set as a tiddler field as both will end up being quoted (`"false"`, `"0"`) so this should work.
2016-02-15 08:31:23 -05:00
William Jackson
48987e186a Tidied up the code in the filters 2015-12-28 10:31:39 +02:00
Jermolene
57ceffd67c Merge #1909 from @nameanyone 2015-12-23 12:19:47 +00:00
Jeremy Ruston
da36f1c728 Merge pull request #2037 from matabele/Listops
ActionListopsWidget
2015-12-06 19:04:26 +00:00
Tobias Beer
ef3e44eb48 rename suffix each:list to each_list-item
based on #1422, improves readability of the filter expression

tests passed
2015-11-13 11:07:24 +01:00
William Jackson
befb13dde1 Update x-listops.js
Change default suffix for append[], prepend[] and remove[] operators from 1 to All
2015-11-08 09:49:07 +02:00
William Jackson
817882a404 Update x-listops.js
Added prefix and suffix options to 'append' and 'prepend' operators
2015-10-27 10:17:07 +02:00
William Jackson
3e445b8853 Update x-listops.js
Corrected the logic of the 'allafter' filter and added a new 'move' filter.
2015-10-22 16:40:36 +02:00
William Jackson
49894abaf4 Create x-listops.js
These filters are designed to be used with the action-listops widget.
2015-10-18 18:37:08 +02:00
Tobias Beer
b34e4f628d adopted style recommendations 2015-10-08 14:21:57 +02:00
Tobias Beer
32c41479cc using variable declaration for readability 2015-10-08 14:18:55 +02:00
Tobias Beer
95eb8810b6 removed pushOnce 2015-10-08 14:07:12 +02:00
Tobias Beer
91b5547cdf adopted style recommendations 2015-10-08 14:07:08 +02:00
Tobias Beer
d0a24bd9f0 added $tw.utils.pushOnce
retained check for basic each nonetheless

tests pass
2015-10-08 14:07:06 +02:00
Tobias Beer
f684a6beb0 fixed helper function and added tests
tests: ok
2015-10-08 14:07:00 +02:00
Tobias Beer
a88ead9c0f removed conditional from iterator
I'd really like to see a profiler run against the two to see the
performance impact of one over the other
2015-10-08 14:06:57 +02:00