diff --git a/plugins/tiddlywiki/aws/docs/help.tid b/plugins/tiddlywiki/aws/docs/help.tid index dc07f24f3..159f9521a 100644 --- a/plugins/tiddlywiki/aws/docs/help.tid +++ b/plugins/tiddlywiki/aws/docs/help.tid @@ -59,7 +59,7 @@ Save raw tiddlers matching a filter to an S3 bucket. * ''filter'': filter identifying tiddlers to render * ''region'': AWS region * ''bucket'': name of the bucket to save the files -* ''filenamefilter'': filter for converting tiddler titles to filepaths (eg `[encodeuricomponent[]addprefix[files/]addsuffix[.html]]`) +* ''filenamefilter'': filter for converting tiddler titles to filepaths (eg `[aws-encodeuricomponent[]addprefix[files/]addsuffix[.html]]`) * ''savetypefilter'': optional; a filter that is passed the title of the tiddler being saved and should yield the MIME type for the saved file (defaults to a filter that yields the value of the ''type'' field) ! "s3-rendertiddler" subcommand @@ -91,6 +91,6 @@ Save the results of rendering tiddlers identified by a filter to files in an S3 * ''template'': template for rendering each tiddler * ''region'': AWS region * ''bucket'': name of the bucket to save the rendered file -* ''filenamefilter'': filter for converting tiddler titles to filepaths (eg `[encodeuricomponent[]addprefix[files/]addsuffix[.html]]`) +* ''filenamefilter'': filter for converting tiddler titles to filepaths (eg `[aws-encodeuricomponent[]addprefix[files/]addsuffix[.html]]`) * ''type'': optional render type (defaults to "text/html") * ''savetypefilter'': optional; a filter that is passed the title of the tiddler being rendered and should yield the MIME type for the saved file (defaults to the value of the ''type'' field via `[is[tiddler]get[type]]`) diff --git a/plugins/tiddlywiki/aws/docs/readme.tid b/plugins/tiddlywiki/aws/docs/readme.tid index 3677cbb71..402771661 100644 --- a/plugins/tiddlywiki/aws/docs/readme.tid +++ b/plugins/tiddlywiki/aws/docs/readme.tid @@ -4,3 +4,4 @@ This plugin provides several tools for working with Amazon Web Services: * Templates for saving a TiddlyWiki as a single JavaScript file in a ZIP file that can be executed as an AWS Lambda function. In this form, TiddlyWiki is a self contained single file containing both code and data, just like the standalone HTML file configuration * Commands that can be used to interact with AWS services, under both the Node.js and Lambda configurations of TiddlyWiki +* A new "aws-encodeuricomponent" filter that acts like the core "encodeuricomponent" filter except it additionally encodes the single quote character \ No newline at end of file diff --git a/plugins/tiddlywiki/aws/modules/encodings.js b/plugins/tiddlywiki/aws/modules/encodings.js new file mode 100644 index 000000000..f67fded27 --- /dev/null +++ b/plugins/tiddlywiki/aws/modules/encodings.js @@ -0,0 +1,27 @@ +/*\ +title: $:/plugins/tiddlywiki/aws/encodings.js +type: application/javascript +module-type: filteroperator + +Filter operator for applying encodeuricomponent() to each item, with the addition of converting single quotes to %27, as required by AWS + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter functions +*/ + +exports["aws-encodeuricomponent"] = function(source,operator,options) { + var results = []; + source(function(tiddler,title) { + results.push(encodeURIComponent(title).replace(/'/g,"%27")); + }); + return results; +}; + +})();