mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +00:00
Added ability for TW2 cooking to strip //#
comments from JavaScript source
This commit is contained in:
parent
05d9cb60fc
commit
84a1337792
27
tw2/plugins/stripcomments.js
Normal file
27
tw2/plugins/stripcomments.js
Normal file
@ -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<lines.length; line++) {
|
||||||
|
var text = lines[line];
|
||||||
|
if(!/^\s*\/\/#/.test(text)) {
|
||||||
|
out.push(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return out.join("\n");
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
@ -60,26 +60,25 @@ Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jerem
|
|||||||
<!--POST-BODY-END-->
|
<!--POST-BODY-END-->
|
||||||
<script id="jsArea" type="text/javascript">
|
<script id="jsArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<include "[prefix[{prejs}]]" text/plain>>
|
<<include "[prefix[{prejs}]]" text/plain-strip-comments>>
|
||||||
<<include "[prefix[{js}]]" text/plain>>
|
<<include "[prefix[{js}]]" text/plain-strip-comments>>
|
||||||
<<include "[prefix[{postjs}]]" text/plain>>
|
<<include "[prefix[{postjs}]]" text/plain-strip-comments>>
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<<include "[prefix[{jsext}]]" text/plain>>
|
<<include "[prefix[{jsext}]]" text/plain-strip-comments>>
|
||||||
<script id="jsdeprecatedArea" type="text/javascript">
|
<script id="jsdeprecatedArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<include "[prefix[{jsdeprecated}]]" text/plain>>
|
<<include "[prefix[{jsdeprecated}]]" text/plain-strip-comments>>
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script id="jslibArea" type="text/javascript">
|
<script id="jslibArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<include "[prefix[{jslib}]]" text/plain>>
|
<<include "[prefix[{jslib}]]" text/plain-strip-comments>>
|
||||||
|
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script id="jqueryArea" type="text/javascript">
|
<script id="jqueryArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<include "[prefix[{jquery}]]" text/plain>>
|
<<include "[prefix[{jquery}]]" text/plain-strip-comments>>
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
Loading…
Reference in New Issue
Block a user