From 84a13377927e13cf839890810f3e232747e06ee3 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Thu, 12 Jul 2012 17:37:10 +0100 Subject: [PATCH] Added ability for TW2 cooking to strip `//#` comments from JavaScript source --- tw2/plugins/stripcomments.js | 27 ++++++++++++++++++++++++++ tw2/wiki/tiddlywiki2.template.html.tid | 15 +++++++------- 2 files changed, 34 insertions(+), 8 deletions(-) create mode 100644 tw2/plugins/stripcomments.js diff --git a/tw2/plugins/stripcomments.js b/tw2/plugins/stripcomments.js new file mode 100644 index 000000000..f8a445e60 --- /dev/null +++ b/tw2/plugins/stripcomments.js @@ -0,0 +1,27 @@ +/*\ +title: $:/plugins/stripcomments.js +type: application/javascript +module-type: tiddlerserializer + +Special serializer for cooking old versions of TiddlyWiki. It removes JavaScript comments formatted as `//#` + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +exports["text/plain-strip-comments"] = function(tiddler) { + var lines =tiddler.fields.text.split("\n"), + out = []; + for(var line=0; line -<> +<>