1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-07-06 04:03:16 +00:00
TiddlyWiki5/core/modules/filters
Robin Munn 326ae61929
Fix encodebase64 and decodebase64 filters (#7683)
* Fix encodebase64 and decodebase64 filters

The documentation for encodebase64 says that the input is treated as
binary data, but in fact the input is being treated as text data, with
an extra UTF-8 encoding step being performed first.

Likewise, the decodebase64 documentation says that it outputs binary
data, but in fact it will do a UTF-8 decoding step before producing
output, which will in fact garble binary data.

This commit changes the behavior of encodebase64 and decodebase64 to
match what the documentation says they do. It also adds an optional
`text` suffix to both filters to keep the current behavior.

Finally, an optional `urlsafe` suffix is added to both filters to allow
them to use the "URL-safe" variant of base64 (using `-` instead of `+`
and `_` instead of `/`).

* Try to fix failing test

Turns out a little more than this is going to be needed.

* Fix binary base64 encoding, including unit tests

* Update base64 filter documentation

* Can't use replaceAll, too new

Have to use String.replace with a global regex instead

* Replace uses of window.btoa() in rest of code

Since window.btoa() is not available under Node.js, we'll replace all
uses of it with the $tw.utils.base64encode() function that now works
correctly for binary data.

* Add link to UTF-8 glossary definition at MDN
2023-10-18 16:08:56 +01:00
..
all Add new [all[tags]] filter operator 2016-11-28 19:04:04 +00:00
format Add the timestamp suffix to the format operator (#7292) 2023-05-06 11:44:22 +01:00
is Fix [is[variable]] operator doesn't work for "fake" variables #6303 (#6996) 2022-10-18 17:08:04 +01:00
addprefix.js Added new filter operator for adding prefixes and suffixes to titles; these new filter operators are useful in contexts where only a filter expression is allowed and where macro processing isn't allowed. The filters complement the existing remove suffix and prefix filter operators. (So much for the "filter" in filter operator.) 2014-09-30 23:01:32 +02:00
addsuffix.js Added new filter operator for adding prefixes and suffixes to titles; these new filter operators are useful in contexts where only a filter expression is allowed and where macro processing isn't allowed. The filters complement the existing remove suffix and prefix filter operators. (So much for the "filter" in filter operator.) 2014-09-30 23:01:32 +02:00
after.js Add "before" and "after" filter operators 2014-05-12 15:16:44 +01:00
all.js Slightly speed up [all[shadows+tiddlers]] filters (#7702) 2023-09-24 20:19:04 +01:00
backlinks.js Change backlinks to use LinkedList (#6050) 2021-09-19 19:58:45 +01:00
before.js Add "before" and "after" filter operators 2014-05-12 15:16:44 +01:00
commands.js Add a new "commands" filter 2014-02-25 14:49:56 +00:00
compare.js Add new sortsub operator 2020-04-25 11:26:19 +01:00
contains.js Add support for JSON-formatted tiddler store, and make it the default (#5708) 2021-07-14 09:15:30 +01:00
count.js Add new "count" filter operator 2017-02-08 20:11:44 +00:00
crypto.js Add sha256 operator 2022-01-29 11:02:47 +00:00
days.js "days" filter: yesterday and tomorrow edge cases (#2364) 2016-04-27 17:23:46 +01:00
deserialize.js Adds a deserialize filter operator (#7511) 2023-06-03 14:33:10 +01:00
deserializers.js Deserializers[] filter operator (#5673) 2021-05-22 10:50:11 +01:00
duplicateslugs.js Add slugify and duplicateslugs operators 2020-05-09 15:54:44 +01:00
each.js Bugfix/3117 inconsistent each (#3124) 2018-02-17 18:51:18 +00:00
eachday.js Removed uneeded function but still converts TW5 Date strings. 2015-03-13 13:14:30 -05:00
editiondescription.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
editions.js Ignore edition filters if not running on node (#5222) 2020-12-07 15:59:32 +00:00
else.js Add then and else operators 2019-08-02 14:27:58 +01:00
encodings.js Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
enlist.js Extend the enlist operator to optionally not de-duplicate 2019-06-10 17:54:46 +01:00
field.js Add support for JSON-formatted tiddler store, and make it the default (#5708) 2021-07-14 09:15:30 +01:00
fields.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
filter.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
format.js Format filter to create formatted date strings (#4785) 2020-09-24 18:35:10 +01:00
function.js Refactor function evaluation code to avoid adding evaluateVariable method 2023-06-10 08:58:04 +01:00
get.js Add 'get' filter operator 2014-04-27 18:45:01 +01:00
getindex.js Correct case of getindex filter operator 2015-02-09 21:42:25 +00:00
getvariable.js Add new "variables" and "getvariables" operators 2019-03-30 10:52:28 +00:00
has.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
haschanged.js Display warning banner when plugins are modified 2015-02-08 19:40:15 +00:00
indexes.js Revert getTiddlerData() and add getTiddlerDataCached() 2015-07-10 16:43:50 +01:00
insertafter.js New insertafter filter operator (#6771) 2022-07-13 17:08:17 +01:00
insertbefore.js New insertafter filter operator (#6771) 2022-07-13 17:08:17 +01:00
is.js Revert multiple suboperator functionality from the "is" operator 2018-05-10 13:15:49 +01:00
json-ops.js Introduce jsonset operator (#7742) 2023-10-14 09:43:23 +01:00
limit.js First pass at refactoring filter execution 2014-04-03 20:49:16 +01:00
links.js Optimise LinkedList filter ops to return iterator instead of array (#6035) 2021-09-16 22:22:44 +01:00
list.js Revert #1496 2015-02-16 19:17:10 +00:00
listed.js Extend listed filter operator to use any field 2014-06-13 10:58:19 +01:00
listops.js Make butlast[0] consistent with rest (#6483) 2022-02-26 09:42:24 +00:00
lookup.js Extend lookup operator to work with fields and indexes (#5742) 2022-02-21 09:48:29 +00:00
match.js Add "match" operator for string comparison 2019-07-31 09:11:12 +01:00
math.js Add missing parameter to atan2 operator (#6142) 2021-10-25 21:13:18 +01:00
minlength.js Add new 'minlength' operator 2016-10-11 09:26:20 +01:00
moduleproperty.js Added modulesproperty filter operator and extended modules operator (#6055) 2021-09-20 08:25:53 +01:00
modules.js Added modulesproperty filter operator and extended modules operator (#6055) 2021-09-20 08:25:53 +01:00
moduletypes.js Whoops file in the wrong place 2013-10-24 12:00:32 +01:00
next.js First pass at refactoring filter execution 2014-04-03 20:49:16 +01:00
plugintiddlers.js Revert getTiddlerData() and add getTiddlerDataCached() 2015-07-10 16:43:50 +01:00
prefix.js Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
previous.js First pass at refactoring filter execution 2014-04-03 20:49:16 +01:00
range.js Update range operator to use multiple operands 2021-09-07 17:16:09 +01:00
reduce.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
regexp.js Add support for JSON-formatted tiddler store, and make it the default (#5708) 2021-07-14 09:15:30 +01:00
removeprefix.js Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
removesuffix.js Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
sameday.js Optimise sameday filter 2017-02-21 08:31:05 +00:00
search.js Add "some" flag to search operator (#6293) 2022-02-21 15:05:34 +00:00
shadowsource.js Obeisance to JSHint for core modules 2014-08-30 20:44:26 +01:00
slugify.js Fix title of slugify.js filter module 2020-05-14 07:53:30 +01:00
sort.js Sortan filter for alpha-numeric filter (#3134) 2018-03-05 11:09:25 +00:00
sortsub.js Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
splitbefore.js Add experimental system tiddler browser 2014-12-02 15:25:27 +00:00
storyviews.js Move "storyviews" filter operator to correct folder 2014-05-28 17:17:47 +01:00
strings.js Remove "const" accidentally included in #7290 2023-03-10 12:32:52 +00:00
subfilter.js Introduce new subfilter operator (#3508) 2018-11-16 11:27:19 +00:00
substitute.js Adds Text substitution support in widget attributes and new operator (#7526) 2023-06-24 14:57:15 +01:00
subtiddlerfields.js Add new subtiddlerfields filter operator 2018-04-03 17:48:01 +01:00
suffix.js Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
tag.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00
tagging.js First pass at refactoring filter execution 2014-04-03 20:49:16 +01:00
tags.js Performance optimisations 2015-07-05 19:47:44 +01:00
then.js Add then and else operators 2019-08-02 14:27:58 +01:00
title.js First pass at refactoring filter execution 2014-04-03 20:49:16 +01:00
unknown.js Refactor function evaluation code to avoid adding evaluateVariable method 2023-06-10 08:58:04 +01:00
untagged.js Consider non-existent tiddlers untagged (#6478) 2022-02-23 12:46:34 +00:00
variables.js Fix [is[variable]] operator doesn't work for "fake" variables #6303 (#6996) 2022-10-18 17:08:04 +01:00
wikiparserrules.js Update wikiparserrules operator for no operand (#2193) 2016-10-08 13:04:11 +01:00
x-listops.js style(App) eliminate whitespace at the end of code lines (#5735) 2021-05-30 19:20:17 +01:00