mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-27 02:20:28 +00:00
28 lines
584 B
JavaScript
28 lines
584 B
JavaScript
/*\
|
|
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<lines.length; line++) {
|
|
var text = lines[line];
|
|
if(!/^\s*\/\/#/.test(text)) {
|
|
out.push(text);
|
|
}
|
|
}
|
|
return out.join("\n");
|
|
};
|
|
|
|
})();
|