1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-29 16:53:14 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/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
..
examples Improve jsonstringify and stringify operators docs (#7650) 2023-09-19 15:52:04 +01:00
syntax Fix a dangling link in filter run prefix docs (#7715) 2023-09-24 20:20:13 +01:00
abs Operator.tid Final chunk of docs for new maths/string operators 2019-06-13 16:53:23 +01:00
acos Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
add.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
addprefix.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
addsuffix.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
after.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
all.tid In 'Filter Operators' add column to indicate those operators that construct an entirely new selection. (#6351) 2022-01-09 14:44:19 +00:00
allafter.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
allbefore.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
append.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
applypatches Operator.tid Introduce new levenshtein, makepatches, applypatches operators (#7290) 2023-03-04 21:16:26 +00:00
asin Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
atan Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
atan2 Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
average.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
backlinks.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
before.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
bf.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
butfirst.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
butlast.tid Make butlast[0] consistent with rest (#6483) 2022-02-26 09:42:24 +00:00
ceil Operator.tid Final chunk of docs for new maths/string operators 2019-06-13 16:53:23 +01:00
charcode.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
commands.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
compare Operator.tid Typo fix (#4951) 2020-11-01 11:03:59 +00:00
Conditional Operators.tid Add a :then filter run prefix (#7392) 2023-06-24 18:07:34 +01:00
contains Operator.tid Update contains Operator.tid (#4746) 2020-08-28 14:44:40 +01:00
cos Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
count_Operator.tid Add new "count" filter operator 2017-02-08 20:11:44 +00:00
cycle Operator.tid Correct error in operator documentation (#5084) 2020-11-20 21:34:43 +00:00
days.tid Improvde days Operator docs for parameter (#3041) 2018-11-27 17:57:13 +00:00
decodebase64 Operator.tid Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
decodehtml_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
decodeuri_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
decodeuricomponent_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
deserialize Operator.tid Docs: created Deserializers tiddler with overview of core deserializer modules (#7564) 2023-06-27 11:43:23 +01:00
deserializers Operator.tid Docs: created Deserializers tiddler with overview of core deserializer modules (#7564) 2023-06-27 11:43:23 +01:00
divide Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
duplicateslugs Operator.tid Fix inaccuracies in documentation for duplicateslugs[] (#5918) 2021-07-29 11:39:20 +01:00
each.tid Tweak docs for each filter 2019-12-12 17:39:23 +00:00
eachday.tid Default eachday to the modified field 2015-02-10 16:21:53 +00:00
editiondescription.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
editions.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
else Operator.tid Add then and else operators 2019-08-02 14:27:58 +01:00
encodebase64 Operator.tid Fix encodebase64 and decodebase64 filters (#7683) 2023-10-18 16:08:56 +01:00
encodehtml_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
encodeuri_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
encodeuricomponent_Operator.tid Extend encodeuricomponent to process additional characters (#7128) 2023-01-19 17:45:54 +00:00
enlist Operator.tid improve setwidget examples and add a link to and from enlist operator (#5666) 2021-05-25 22:19:28 +01:00
enlist-input Operator.tid Docs: Fix filters selection constructors tag (#6154) 2021-10-31 10:36:45 +00:00
escapecss_Operator.tid Make escapecss tiddlers show in recent tab (#4032) 2019-06-29 08:40:46 +01:00
escaperegexp_Operator.tid Add new filter operators for various string encoding/decodings 2016-10-18 09:18:32 +01:00
exponential Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
field.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
fields.tid Add new parameters to fields-widget and fields-operator. (#4433) 2020-04-15 12:36:48 +01:00
Filter Operators.tid In 'Filter Operators' add column to indicate those operators that construct an entirely new selection. (#6351) 2022-01-09 14:44:19 +00:00
filter.tid Fix miscellaneous docs typos (#7143) 2022-12-21 10:07:14 +00:00
first.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
fixed Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
floor Operator.tid Final chunk of docs for new maths/string operators 2019-06-13 16:53:23 +01:00
format.tid Add the timestamp suffix to the format operator (#7292) 2023-05-06 11:44:22 +01:00
function.tid Parameterised transclusions (#6666) 2023-04-19 11:55:25 +01:00
get.tid Improve documentation for get and getindex - Update descriptions and examples (#7349) 2023-03-10 08:48:28 +00:00
getindex.tid Improve documentation for get and getindex - Update descriptions and examples (#7349) 2023-03-10 08:48:28 +00:00
getvariable.tid Fix miscellaneous docs typos (#7143) 2022-12-21 10:07:14 +00:00
has.tid Add a description and examples for "strict" results from getindex (#7333) 2023-03-06 16:14:08 +00:00
haschanged.tid haschanged filter docs improvements from @aelocson 2015-02-09 19:51:02 +00:00
indexes.tid Remove some contractions that have crept in 2023-01-17 16:56:52 +00:00
insertafter Operator.tid Fix copy-and-paste mistake in insertafter docs (#6824) 2022-07-25 08:41:06 +01:00
insertbefore Operator.tid New insertafter filter operator (#6771) 2022-07-13 17:08:17 +01:00
Introduction to filter notation.tid Documentation for multiple filter operands (#4969) 2020-11-08 09:32:37 +00:00
is.tid Docs: Update is.tid (#7213) 2023-01-16 12:56:51 +00:00
join Operator.tid Fix caption for "join" operator docs 2019-06-17 21:44:50 +01:00
jsonextract.tid Fixes for JSON operators (#7105) 2022-12-09 18:31:23 +00:00
jsonget.tid Fixes for JSON operators (#7105) 2022-12-09 18:31:23 +00:00
jsonindexes.tid Fixes for JSON operators (#7105) 2022-12-09 18:31:23 +00:00
jsonset.tid Introduce jsonset operator (#7742) 2023-10-14 09:43:23 +01:00
jsonstringify Operator.tid Improve jsonstringify and stringify operators docs (#7650) 2023-09-19 15:52:04 +01:00
jsontype.tid Fixes for JSON operators (#7105) 2022-12-09 18:31:23 +00:00
last.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
length Operator.tid Docs: Update length Operator.tid (#4428) 2020-01-29 17:14:02 +00:00
levenshtein Operator.tid Introduce new levenshtein, makepatches, applypatches operators (#7290) 2023-03-04 21:16:26 +00:00
limit.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
links.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
list.tid tw5.com : Fix typo in list.tid (#6217) 2021-11-15 21:15:59 +00:00
listed.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
log Operator.tid Added mathematics filter operators power and log (#5080) 2020-11-20 14:00:20 +00:00
lookup Operator.tid Update version tag for #5742 2022-02-21 09:49:55 +00:00
lowercase Operator.tid Add sentencecase operator 2019-06-19 12:11:02 +01:00
makepatches Operator.tid Introduce new levenshtein, makepatches, applypatches operators (#7290) 2023-03-04 21:16:26 +00:00
match Operator.tid Docs tweaks 2019-08-06 14:53:14 +01:00
Mathematics Operators.tid Update Mathematics Operators documentation (#6598) 2022-04-17 21:09:20 +01:00
max Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
maxall Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
median.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
min Operator.tid Fixes for 7fcdc83ba 2019-06-12 11:34:07 +01:00
minall Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
minlength.tid Add new 'minlength' operator 2016-10-11 09:26:20 +01:00
moduleproperty Operator.tid Added modulesproperty filter operator and extended modules operator (#6055) 2021-09-20 08:25:53 +01:00
modules.tid Added modulesproperty filter operator and extended modules operator (#6055) 2021-09-20 08:25:53 +01:00
moduletypes.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
move.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
multiply Operator.tid Fixes for 7fcdc83ba 2019-06-12 11:34:07 +01:00
negate Operator.tid Final chunk of docs for new maths/string operators 2019-06-13 16:53:23 +01:00
next.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
nsort.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
nsortcs.tid Typos in nsortcs and sortcs docs 2015-04-17 13:58:32 +01:00
nth.tid Added zero based zth[] operator and documentation (#6150) 2021-10-30 09:52:38 +01:00
order_Operator.tid Add new "order" filter operator 2016-11-28 19:16:08 +00:00
pad Operator.tid Added string operator pad[] along with tests and docs (#5146) 2020-11-30 17:43:50 +00:00
plugintiddlers.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
power Operator.tid Added mathematics filter operators power and log (#5080) 2020-11-20 14:00:20 +00:00
precision Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
prefix.tid Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
prepend.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
previous.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
product Operator.tid Fixes for 7fcdc83ba 2019-06-12 11:34:07 +01:00
putafter.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
putbefore.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
putfirst.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
putlast.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
range.tid Docs: Fix filters selection constructors tag (#6154) 2021-10-31 10:36:45 +00:00
reduce.tid Fix miscellaneous docs typos (#7143) 2022-12-21 10:07:14 +00:00
regexp.tid Docs: fix regexp default field (#3394) 2018-08-19 18:37:14 +01:00
remainder Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
remove.tid Docs: improve description of remove operator (#2735) 2017-02-27 16:40:48 +00:00
removeprefix.tid Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
removesuffix.tid Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
replace.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
rest.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
reverse.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
round Operator.tid Final chunk of docs for new maths/string operators 2019-06-13 16:53:23 +01:00
sameday.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
search-replace Operator.tid Add from-version banner to search-replace operator "m" flag 2021-08-29 17:45:59 +01:00
search.tid Adjust version tag for #6293 2022-02-21 15:06:39 +00:00
sentencecase Operator.tid Fix sentencecase operator, add titlecase operator (#4006) 2019-06-21 08:24:02 +01:00
sha256 Operator.tid Add sha256 operator 2022-01-29 11:02:47 +00:00
shadowsource.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
sign Operator.tid Docs: Update sign Operator.tid (#4426) 2020-01-29 17:18:33 +00:00
sin Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
slugify Operator.tid Add slugify and duplicateslugs operators 2020-05-09 15:54:44 +01:00
sort.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
sortan.tid Sortan filter for alpha-numeric filter (#3134) 2018-03-05 11:09:25 +00:00
sortby.tid Remove modifier/modified/revision fields from #2037 2015-12-06 19:11:41 +00:00
sortcs.tid Typos in nsortcs and sortcs docs 2015-04-17 13:58:32 +01:00
sortsub Operator.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
split Operator.tid Fixes to split operator, plus instructions for using it to do search and replace 2019-06-21 10:21:52 +01:00
splitbefore.tid Overhaul the macro and variable documentation #1519 2015-02-24 17:41:16 +01:00
splitregexp Operator.tid Fixes to split operator, plus instructions for using it to do search and replace 2019-06-21 10:21:52 +01:00
standard-deviation Operator.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
storyviews.tid Docs: Fix filters selection constructors tag (#6154) 2021-10-31 10:36:45 +00:00
stringify_Operator.tid Improve jsonstringify and stringify operators docs (#7650) 2023-09-19 15:52:04 +01:00
subfilter Operator.tid In 'Filter Operators' add column to indicate those operators that construct an entirely new selection. (#6351) 2022-01-09 14:44:19 +00:00
substitute Operator.tid Update substitute operator docs 2023-07-15 17:58:14 +01:00
subtiddlerfields Operator.tid Add new subtiddlerfields filter operator 2018-04-03 17:48:01 +01:00
subtract Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
suffix.tid Support case insensitive matching in prefix/suffix operators (#6468) 2022-02-22 16:38:40 +00:00
sum Operator.tid First batch of docs for the maths operators 2019-06-11 17:18:51 +01:00
tag.tid Add strict mode to tag operator 2016-11-28 13:42:30 +00:00
tagging.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
tags.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
tan Operator.tid Add documentation and examples for the trigonometric filter operators (#6131) 2021-10-22 11:35:47 +01:00
then Operator.tid Add a :then filter run prefix (#7392) 2023-06-24 18:07:34 +01:00
title.tid Update title.tid (#5292) 2020-12-18 20:19:02 +00:00
titlecase Operator.tid Fix sentencecase operator, add titlecase operator (#4006) 2019-06-21 08:24:02 +01:00
toggle Operator.tid Cycle operator improvements plus docs (#5069) 2020-11-20 18:37:23 +00:00
trim Operator.tid Docs for trim operator suffix use from-version (#5161) 2020-12-03 21:20:23 +00:00
trunc Operator.tid Add untrunc operator, the mirror of trunc (#3994) 2019-06-17 18:34:30 +01:00
unique.tid Fix #5310: docs for unique[] filter operator (#5651) 2021-04-29 13:14:28 +01:00
untagged.tid Define operators via fields and a view template 2015-02-03 19:29:25 +00:00
untrunc Operator.tid Add untrunc operator, the mirror of trunc (#3994) 2019-06-17 18:34:30 +01:00
uppercase Operator.tid Add sentencecase operator 2019-06-19 12:11:02 +01:00
variables.tid Add missing "from-version" tags to new features 2019-03-30 10:55:22 +00:00
variance Operator.tid Search and replace "v5.1.24" to "v5.2.0" 2021-07-14 09:21:37 +01:00
zth Operator.tid Added zero based zth[] operator and documentation (#6150) 2021-10-30 09:52:38 +01:00