Fixed TW2 edition
Now we can build TW2 files with just a few whitespace differences from the old Ruby tools
This commit is contained in:
parent
f37e99d1fb
commit
ae7d1771fd
|
@ -1,27 +0,0 @@
|
||||||
/*\
|
|
||||||
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");
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"title": "$:/plugins/tiddlywiki2/stripcomments",
|
||||||
|
"description": "Strips //# comments from JavaScript source",
|
||||||
|
"author": "JeremyRuston",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"coreVersion": ">=5.0.0"
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
/*\
|
||||||
|
title: $:/plugins/tiddlywiki2/stripcomments/stripcomments.js
|
||||||
|
type: application/javascript
|
||||||
|
module-type: fieldviewer
|
||||||
|
|
||||||
|
Special viewer for cooking old versions of TiddlyWiki. It removes JavaScript comments formatted as `//#`
|
||||||
|
|
||||||
|
\*/
|
||||||
|
(function(){
|
||||||
|
|
||||||
|
/*jslint node: true, browser: true */
|
||||||
|
/*global $tw: false */
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
var stripComments = function(text) {
|
||||||
|
var lines = 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");
|
||||||
|
};
|
||||||
|
|
||||||
|
var StripCommentsViewer = function(viewWidget,tiddler,field,value) {
|
||||||
|
this.viewWidget = viewWidget;
|
||||||
|
this.tiddler = tiddler;
|
||||||
|
this.field = field;
|
||||||
|
this.value = value;
|
||||||
|
};
|
||||||
|
|
||||||
|
StripCommentsViewer.prototype.render = function() {
|
||||||
|
// Get the value as a string
|
||||||
|
if(this.field !== "text" && this.tiddler) {
|
||||||
|
this.value = this.tiddler.getFieldString(this.field);
|
||||||
|
}
|
||||||
|
var value = "";
|
||||||
|
if(this.value !== undefined && this.value !== null) {
|
||||||
|
value = stripComments(this.value);
|
||||||
|
}
|
||||||
|
// Set the element details
|
||||||
|
this.viewWidget.tag = "span";
|
||||||
|
this.viewWidget.attributes = {};
|
||||||
|
this.viewWidget.children = this.viewWidget.renderer.renderTree.createRenderers(this.viewWidget.renderer.renderContext,[{
|
||||||
|
type: "text",
|
||||||
|
text: value
|
||||||
|
}]);
|
||||||
|
};
|
||||||
|
|
||||||
|
exports.stripcomments = StripCommentsViewer;
|
||||||
|
|
||||||
|
})();
|
|
@ -0,0 +1,9 @@
|
||||||
|
title: $:/core/templates/html-div-tiddler-remove-prefix
|
||||||
|
|
||||||
|
<!--
|
||||||
|
|
||||||
|
This template is used for saving tiddlers as an HTML DIV tag with attributes representing the tiddler fields.
|
||||||
|
|
||||||
|
-->`<div`<$fields template=' $name$="$encoded_value$"' stripTitlePrefix="yes"></$fields>`>
|
||||||
|
<pre>`<$view field="text" format="htmlencoded" />`</pre>
|
||||||
|
</div>`
|
|
@ -0,0 +1,3 @@
|
||||||
|
title: $:/core/templates/plain-text-tiddler-strip-comments
|
||||||
|
|
||||||
|
<$view field="text" format="stripcomments" />
|
|
@ -1,40 +1,41 @@
|
||||||
title: $:/core/templates/tiddlywiki2.template.html
|
title: $:/core/templates/tiddlywiki2.template.html
|
||||||
type: text/vnd.tiddlywiki-html
|
|
||||||
|
|
||||||
|
\rules only filteredtranscludeinline transcludeinline
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||||
<head>
|
<head>
|
||||||
<script id="versionArea" type="text/javascript">
|
<script id="versionArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<serialize "[prefix[{version}]]" text/plain>>
|
{{{ [prefix[{version}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
|
<meta name="tiddlywiki-version" content="{{$:/core/templates/version}}" />
|
||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
<meta name="copyright" content="
|
<meta name="copyright" content="
|
||||||
<<serialize "[prefix[{copyright}]]" text/plain>>
|
{{{ [prefix[{copyright}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
" />
|
" />
|
||||||
<!--PRE-HEAD-START-->
|
<!--PRE-HEAD-START-->
|
||||||
<<serialize "[prefix[{prehead}]]" text/plain>>
|
{{{ [prefix[{prehead}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<!--PRE-HEAD-END-->
|
<!--PRE-HEAD-END-->
|
||||||
<title>
|
<title>
|
||||||
<<serialize "[prefix[{title}]]" text/plain>>
|
{{{ [prefix[{title}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
</title>
|
</title>
|
||||||
<style id="styleArea" type="text/css">
|
<style id="styleArea" type="text/css">
|
||||||
<<serialize "[prefix[{style}]]" text/plain>>
|
{{{ [prefix[{style}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
</style>
|
</style>
|
||||||
<!--POST-HEAD-START-->
|
<!--POST-HEAD-START-->
|
||||||
<<serialize "[prefix[{posthead}]]" text/plain>>
|
{{{ [prefix[{posthead}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<!--POST-HEAD-END-->
|
<!--POST-HEAD-END-->
|
||||||
</head>
|
</head>
|
||||||
<body onload="main();" onunload="if(window.unload) unload();">
|
<body onload="main();" onunload="if(window.unload) unload();">
|
||||||
<!--PRE-BODY-START-->
|
<!--PRE-BODY-START-->
|
||||||
<<serialize "[prefix[{prebody}]]" text/plain>>
|
{{{ [prefix[{prebody}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<!--PRE-BODY-END-->
|
<!--PRE-BODY-END-->
|
||||||
<div id="copyright">
|
<div id="copyright">
|
||||||
Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
|
Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jeremy Ruston, Copyright © 2007-2011 UnaMesa Association
|
||||||
</div>
|
</div>
|
||||||
<noscript>
|
<noscript>
|
||||||
<<serialize "[prefix[{noscript}]]" text/plain>>
|
{{{ [prefix[{noscript}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
</noscript>
|
</noscript>
|
||||||
<div id="saveTest"></div>
|
<div id="saveTest"></div>
|
||||||
<div id="backstageCloak"></div>
|
<div id="backstageCloak"></div>
|
||||||
|
@ -46,39 +47,39 @@ Welcome to TiddlyWiki created by Jeremy Ruston; Copyright © 2004-2007 Jerem
|
||||||
<div id="contentWrapper"></div>
|
<div id="contentWrapper"></div>
|
||||||
<div id="contentStash"></div>
|
<div id="contentStash"></div>
|
||||||
<div id="shadowArea">
|
<div id="shadowArea">
|
||||||
<<serialize "[prefix[{shadow}]] +[sort-case-sensitive[title]]" application/x-tiddler-html-div removePrefix:"{shadow}">>
|
{{{ [prefix[{shadow}]] +[sort-case-sensitive[title]] ||$:/core/templates/html-div-tiddler-remove-prefix}}}
|
||||||
</div>
|
</div>
|
||||||
<!--POST-SHADOWAREA-->
|
<!--POST-SHADOWAREA-->
|
||||||
<div id="storeArea">
|
<div id="storeArea">
|
||||||
<<serialize "[prefix[{tiddler}]] +[sort-case-sensitive[title]]" application/x-tiddler-html-div removePrefix:"{tiddler}">>
|
{{{ [prefix[{tiddler}]] +[sort-case-sensitive[title]] ||$:/core/templates/html-div-tiddler-remove-prefix}}}
|
||||||
<<serialize "[prefix[{plugin}]]" text/plain>>
|
{{{ [prefix[{plugin}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<<serialize "[prefix[{posttiddlers}]]" text/plain>>
|
{{{ [prefix[{posttiddlers}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
</div>
|
</div>
|
||||||
<!--POST-STOREAREA-->
|
<!--POST-STOREAREA-->
|
||||||
<!--POST-BODY-START-->
|
<!--POST-BODY-START-->
|
||||||
<<serialize "[prefix[{postbody}]]" text/plain>>
|
{{{ [prefix[{postbody}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<!--POST-BODY-END-->
|
<!--POST-BODY-END-->
|
||||||
<script id="jsArea" type="text/javascript">
|
<script id="jsArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<serialize "[prefix[{prejs}]]" text/plain-strip-comments>>
|
{{{ [prefix[{prejs}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
<<serialize "[prefix[{js}]]" text/plain-strip-comments>>
|
{{{ [prefix[{js}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
<<serialize "[prefix[{postjs}]]" text/plain-strip-comments>>
|
{{{ [prefix[{postjs}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<<serialize "[prefix[{jsext}]]" text/plain-strip-comments>>
|
{{{ [prefix[{jsext}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
<script id="jsdeprecatedArea" type="text/javascript">
|
<script id="jsdeprecatedArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<serialize "[prefix[{jsdeprecated}]]" text/plain-strip-comments>>
|
{{{ [prefix[{jsdeprecated}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script id="jslibArea" type="text/javascript">
|
<script id="jslibArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<serialize "[prefix[{jslib}]]" text/plain-strip-comments>>
|
{{{ [prefix[{jslib}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script id="jqueryArea" type="text/javascript">
|
<script id="jqueryArea" type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
<<serialize "[prefix[{jquery}]]" text/plain-strip-comments>>
|
{{{ [prefix[{jquery}]] ||$:/core/templates/plain-text-tiddler-strip-comments}}}
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -88,7 +89,7 @@ if(useJavaSaver)
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<!--POST-SCRIPT-START-->
|
<!--POST-SCRIPT-START-->
|
||||||
<<serialize "[prefix[{postscript}]]" text/plain>>
|
{{{ [prefix[{postscript}]] ||$:/core/templates/plain-text-tiddler}}}
|
||||||
<!--POST-SCRIPT-END-->
|
<!--POST-SCRIPT-END-->
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue