Folks,
I was thinking it could be quite simple to provide a way to enter a filter test various aspects of its syntax. A “filter checker”. We could past a problem filter, or an experiment when writing one, in a field and get feedback or list its results (with a +[limit[]]) so it does not run to all tiddlers or infinity.
Simple feedback request:
I am starting this discussion to seek the communities feedback on different valid tests we can do on a filter. Please provide any you think of and I will incorporate them below, and also point out any exceptions if any you find any. Don’t worry if you propose something already listed.
Regex challenge;
For those of you who know regex, filters could be interrogated for their syntax and a far more advanced way. If you do share some “regular expressions” these please spell out what the regex determines in plain English.
Syntax Checks:
- Always match a “[” with a “]”
- Always match a “{” with a “}”
- Always match a “<” with a “>”
- Reject “{{” or “}}” “{{{” or “}}}”
4.1 Exception unless it is the outer - If “!” follows “{!” ensure it is “{!!”
- Display the result of the filter if broken
- Propose a closing “]” at the end of the filter if “[” mismatch occurs (common error of mine)
- If a filter run prefix such as “:intersection” is used check it is one of the documented names, and is a prefix “only”
8.1 except if inside a<:>
or “[:]” - If a filter run prefix such as “+ - ~” is used check it is one of the documented names, and is a prefix “only”. Provide a translation to a full name is available
- Check for the cases where a “[” or “]” wraps a “<”, “>”,"{, “}” because these are always/often? invalid
- If we see a “!!” it proceeds a fieldname
;Syntax checker features
- Provide the ability to set an “outer” variable, or filter
- Provide for the testing of nested filters
Provide for the testing of filtered transclusions, even show both a list and filtered transclusion for a given filter. - Automatically set +[limit[]] toggle off
- Simultaneously retrieve a count of the filter result +[count[]] and display
- If above a threshold number hide output until you choose to review.
- Allow you to list a set of tag pills to reorder ones used in your filter
- Provide a list of “words” found in your filter which are most often tags, fieldnames, titles or variables. Test each to see what it may be (one or more)
- Provide a set of variables for values that cant be used directly inside a filter because they will break filters.
- Provide a set of variables with special characters that can not be entered from the keyboard.
9.1 Also allow a charcode or html entity to be the value of a variable
If someone wants to build or collaborate on the “filter checker” please let me know here or private message, I would prefer a wikitext/widget solution than javascript unless there was a good reason.