From 11a07e71dc4bf0396da625af56746dbe5d80fce6 Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Fri, 25 Oct 2013 12:32:57 +0100 Subject: [PATCH] Move stripcomments from the classictools plugin into the core It's a bit of a hack for the moment. The plan is to implement stripcomments via the macro mechanism, at which point it can move back into the plugin. --- core/modules/new_widgets/view.js | 15 ++++++ nbld.sh | 11 ++++ .../classictools/modules/stripcomments.js | 54 ------------------- 3 files changed, 26 insertions(+), 54 deletions(-) delete mode 100644 plugins/tiddlywiki/classictools/modules/stripcomments.js diff --git a/core/modules/new_widgets/view.js b/core/modules/new_widgets/view.js index 5294b8e15..b87a8a088 100755 --- a/core/modules/new_widgets/view.js +++ b/core/modules/new_widgets/view.js @@ -61,6 +61,9 @@ ViewWidget.prototype.execute = function() { case "relativedate": this.text = this.getValueAsRelativeDate(); break; + case "stripcomments": + this.text = this.getValueAsStrippedComments(); + break; default: // "text" this.text = this.getValueAsText(); break; @@ -138,6 +141,18 @@ ViewWidget.prototype.getValueAsRelativeDate = function(format) { } }; +ViewWidget.prototype.getValueAsStrippedComments = function() { + var lines = this.getValueAsText().split("\n"), + out = []; + for(var line=0; line