diff --git a/2bld.sh b/2bld.sh index b432c3a9d..d95a7d5a9 100755 --- a/2bld.sh +++ b/2bld.sh @@ -11,7 +11,7 @@ mkdir -p tmp/tw2 node ./tiddlywiki.js \ editions/tw5.com \ --verbose \ - --rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \ + --new_rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \ || exit 1 # cook the TiddlyWiki 2.x.x index file @@ -20,7 +20,7 @@ node ./tiddlywiki.js \ editions/tw2 \ --verbose \ --load editions/tw2/source/tiddlywiki.com/index.html.recipe \ - --rendertiddler $:/core/templates/tiddlywiki2.template.html ./tmp/tw2/index.html text/plain \ + --new_rendertiddler $:/core/templates/tiddlywiki2.template.html ./tmp/tw2/index.html text/plain \ || exit 1 -opendiff tmp/tw2/index.html editions/tw2/target/index.2.6.5.html +diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html diff --git a/bld.sh b/bld.sh index 94b9092d0..6dce60d91 100755 --- a/bld.sh +++ b/bld.sh @@ -35,12 +35,12 @@ rm $TW5_BUILD_OUTPUT/static/* node ./tiddlywiki.js \ ./editions/tw5.com \ --verbose \ - --rendertiddler ReadMe ./readme.md text/html \ - --rendertiddler ContributingTemplate ./contributing.md text/html \ - --rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/index.html text/plain \ - --rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \ - --rendertiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \ - --rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \ + --new_rendertiddler ReadMe ./readme.md text/html \ + --new_rendertiddler ContributingTemplate ./contributing.md text/html \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/index.html text/plain \ + --new_rendertiddler $:/core/templates/static.template.html $TW5_BUILD_OUTPUT/static.html text/plain \ + --new_rendertiddler $:/core/templates/static.template.css $TW5_BUILD_OUTPUT/static/static.css text/plain \ + --new_rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \ || exit 1 # Second, encrypted.html: a version of the main file encrypted with the password "password" @@ -49,7 +49,7 @@ node ./tiddlywiki.js \ ./editions/tw5.com \ --verbose \ --password password \ - --rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/encrypted.html text/plain \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/encrypted.html text/plain \ || exit 1 # Third, empty.html: empty wiki for reuse @@ -57,7 +57,7 @@ node ./tiddlywiki.js \ node ./tiddlywiki.js \ ./editions/empty \ --verbose \ - --rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/empty.html text/plain \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/empty.html text/plain \ || exit 1 # Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS @@ -65,7 +65,7 @@ node ./tiddlywiki.js \ node ./tiddlywiki.js \ ./editions/tahoelafs \ --verbose \ - --rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \ || exit 1 # Fifth, d3demo.html: wiki to demo d3 plugin @@ -73,9 +73,25 @@ node ./tiddlywiki.js \ node ./tiddlywiki.js \ ./editions/d3demo \ --verbose \ - --rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/d3demo.html text/plain \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/d3demo.html text/plain \ || exit 1 -# Sixth, run the test edition to run the node.js tests and to generate test.html for tests in the browser +# Sixth, codemirrordemo.html: wiki to demo codemirror plugin + +node ./tiddlywiki.js \ + ./editions/codemirrordemo \ + --verbose \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \ + || exit 1 + +# Seventh, codemirrordemo.html: wiki to demo codemirror plugin + +node ./tiddlywiki.js \ + ./editions/markdowndemo \ + --verbose \ + --new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \ + || exit 1 + +# Eighth, run the test edition to run the node.js tests and to generate test.html for tests in the browser ./test.sh diff --git a/boot/boot.js b/boot/boot.js index 8f4dd74f3..5b7edd7a7 100644 --- a/boot/boot.js +++ b/boot/boot.js @@ -107,6 +107,7 @@ children: array of further child nodes innerHTML: optional HTML for element class: class name(s) document: defaults to current document +eventListeners: array of event listeners (this option won't work until $tw.utils.addEventListeners() has been loaded) */ $tw.utils.domMaker = function(tag,options) { var doc = options.document || document; @@ -126,6 +127,9 @@ $tw.utils.domMaker = function(tag,options) { $tw.utils.each(options.attributes,function(attribute,name) { element.setAttribute(name,attribute); }); + if(options.eventListeners) { + $tw.utils.addEventListeners(element,options.eventListeners); + } return element; }; @@ -227,7 +231,8 @@ $tw.utils.stringifyDate = function(value) { $tw.utils.pad(value.getUTCMonth() + 1) + $tw.utils.pad(value.getUTCDate()) + $tw.utils.pad(value.getUTCHours()) + - $tw.utils.pad(value.getUTCMinutes()); + $tw.utils.pad(value.getUTCMinutes()) + + $tw.utils.pad(value.getUTCMilliseconds(),3); }; // Parse a date from a UTC YYYYMMDDHHMMSSMMM format string @@ -722,6 +727,7 @@ $tw.modules.define("$:/boot/tiddlerfields/created","tiddlerfield",{ }); $tw.modules.define("$:/boot/tiddlerfields/color","tiddlerfield",{ name: "color", + editTag: "input", editType: "color" }); $tw.modules.define("$:/boot/tiddlerfields/tags","tiddlerfield",{ diff --git a/contributing.md b/contributing.md index 7dbb858dd..312e9decf 100644 --- a/contributing.md +++ b/contributing.md @@ -1,60 +1,8 @@ -
- -TiddlyWiki5 welcomes contributions to its code and documentation via -GitHub. Please take a moment to read these notes to help make the process as smooth as possible.
-From the perspective of the developers, a bug report that says little more than "it doesn't work" can be frustrating. For effective debugging, we need as much information as possible. At a minimum, please try to include:
-There's a lot of good material on the web about bug reports:
-Like other -OpenSource projects, -TiddlyWiki5 needs a signed -ContributorLicenseAgreement from individual contributors before contributions of code can be accepted. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the -UnaMesa Association (the legal entity that owns -TiddlyWiki on behalf of the community).
- -This is a first pass at a CLA for -TiddlyWiki. Please let us know if we missed something important. If we do have to make essential changes to the CLA, there is a possibility that all contributors will need to sign it again
-git clone https://github.com/Jermolene/TiddlyWiki5.git TiddlyWiki5 +Contributing to TiddlyWiki5
TiddlyWiki5 welcomes contributions to its code and documentation via GitHub. Please take a moment to read these notes to help make the process as smooth as possible.
Bug Reports
From the perspective of the developers, a bug report that says little more than "it doesn't work" can be frustrating. For effective debugging, we need as much information as possible. At a minimum, please try to include:
There's a lot of good material on the web about bug reports:
Like other OpenSource projects, TiddlyWiki5 needs a signed contributor license agreement from individual contributors before contributions of code can be accepted. This is a legal agreement that allows contributors to assert that they own the copyright of their contribution, and that they agree to license it to the UnaMesa Association (the legal entity that owns TiddlyWiki on behalf of the community).
This is a first pass at a CLA for TiddlyWiki. Please let us know if we missed something important. If we do have to make essential changes to the CLA, there is a possibility that all contributors will need to sign it again
git clone https://github.com/Jermolene/TiddlyWiki5.git TiddlyWiki5 cd TiddlyWiki5 -git checkout -b sign-cla
-
-Add your name and the date to cla-individual.md or cla-entity.md. Date format (YYYY/MM/DD)
-eg:
-Jeremy Ruston, @Jermolene, 2011/11/22
-git add . +git checkout -b sign-cla
Add your name and the date to cla-individual.md or cla-entity.md. Date format (YYYY/MM/DD)
+eg: Jeremy Ruston, @Jermolene, 2011/11/22
git add . git commit -m "sign contributor license agreement" -git push origin sign-cla
- -Go to your github repo and create a pull request.
- -Thank you!
-The CLA documents used for this project where created using -Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity" -
- -This file was automatically generated by -TiddlyWiki5 +git push origin sign-cla
Go to your github repo and create a pull request.
Thank you!
The CLA documents used for this project where created using Harmony Project Templates. "HA-CLA-I-LIST Version 1.0" for "CLA-individual" and "HA-CLA-E-LIST Version 1.0" for "CLA-entity" +
This file was automatically generated by TiddlyWiki5
\ No newline at end of file diff --git a/core/modules/commands/rendertiddler.js b/core/modules/commands/new_rendertiddler.js old mode 100644 new mode 100755 similarity index 80% rename from core/modules/commands/rendertiddler.js rename to core/modules/commands/new_rendertiddler.js index b63d9855d..41dc5d66d --- a/core/modules/commands/rendertiddler.js +++ b/core/modules/commands/new_rendertiddler.js @@ -1,5 +1,5 @@ /*\ -title: $:/core/modules/commands/rendertiddler.js +title: $:/core/modules/commands/new_rendertiddler.js type: application/javascript module-type: command @@ -13,7 +13,7 @@ Command to render a tiddler and save it to a file "use strict"; exports.info = { - name: "rendertiddler", + name: "new_rendertiddler", synchronous: false }; @@ -33,7 +33,7 @@ Command.prototype.execute = function() { title = this.params[0], filename = this.params[1], type = this.params[2] || "text/html"; - fs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),"utf8",function(err) { + fs.writeFile(filename,this.commander.wiki.new_renderTiddler(type,title),"utf8",function(err) { self.callback(err); }); return null; diff --git a/core/modules/commands/rendertiddlers.js b/core/modules/commands/new_rendertiddlers.js similarity index 78% rename from core/modules/commands/rendertiddlers.js rename to core/modules/commands/new_rendertiddlers.js index 1bb1fa448..26362f39d 100644 --- a/core/modules/commands/rendertiddlers.js +++ b/core/modules/commands/new_rendertiddlers.js @@ -1,5 +1,5 @@ /*\ -title: $:/core/modules/commands/rendertiddlers.js +title: $:/core/modules/commands/new_rendertiddlers.js type: application/javascript module-type: command @@ -12,8 +12,10 @@ Command to render several tiddlers to a folder of files /*global $tw: false */ "use strict"; +var widget = require("$:/core/modules/new_widgets/widget.js"); + exports.info = { - name: "rendertiddlers", + name: "new_rendertiddlers", synchronous: true }; @@ -36,13 +38,12 @@ Command.prototype.execute = function() { pathname = this.params[2], type = this.params[3] || "text/html", extension = this.params[4] || ".html", - parser = wiki.parseTiddler(template), tiddlers = wiki.filterTiddlers(filter); $tw.utils.each(tiddlers,function(title) { - var renderTree = new $tw.WikiRenderTree(parser,{wiki: wiki, context: {tiddlerTitle: title}, document: $tw.document}); - renderTree.execute(); + var parser = wiki.new_parseTiddler(template), + widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}}); var container = $tw.document.createElement("div"); - renderTree.renderInDom(container); + widgetNode.render(container,null); var text = type === "text/html" ? container.innerHTML : container.textContent; fs.writeFileSync(path.resolve(pathname,encodeURIComponent(title) + extension),text,"utf8"); }); diff --git a/core/modules/commands/server.js b/core/modules/commands/server.js index 78e3f5962..b71db0533 100644 --- a/core/modules/commands/server.js +++ b/core/modules/commands/server.js @@ -147,7 +147,7 @@ var Command = function(params,commander,callback) { path: /^\/$/, handler: function(request,response,state) { response.writeHead(200, {"Content-Type": state.server.get("serveType")}); - var text = state.wiki.renderTiddler(state.server.get("renderType"),state.server.get("rootTiddler")); + var text = state.wiki.new_renderTiddler(state.server.get("renderType"),state.server.get("rootTiddler")); response.end(text,"utf8"); } }); diff --git a/core/modules/filters/modules.js b/core/modules/filters/modules.js new file mode 100644 index 000000000..bb9485876 --- /dev/null +++ b/core/modules/filters/modules.js @@ -0,0 +1,39 @@ +/*\ +title: $:/core/modules/filters/modules.js +type: application/javascript +module-type: filteroperator + +Filter operator for returning the titles of the modules of a given type in this wiki + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports.modules = function(source,operator,options) { + var results = [], + pushModules = function(type) { + $tw.utils.each($tw.modules.types[type],function(moduleInfo,moduleName) { + results.push(moduleName); + }); + }; + // Iterate through the source tiddlers + if($tw.utils.isArray(source)) { + $tw.utils.each(source,function(title) { + pushModules(title); + }); + } else { + $tw.utils.each(source,function(element,title) { + pushModules(title); + }); + } + results.sort(); + return results; +}; + +})(); diff --git a/core/modules/filters/moduletypes.js b/core/modules/filters/moduletypes.js new file mode 100644 index 000000000..67321caea --- /dev/null +++ b/core/modules/filters/moduletypes.js @@ -0,0 +1,27 @@ +/*\ +title: $:/core/modules/filters/moduletypes.js +type: application/javascript +module-type: filteroperator + +Filter operator for returning the names of the module types in this wiki + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Export our filter function +*/ +exports.moduletypes = function(source,operator,options) { + var results = []; + $tw.utils.each($tw.modules.types,function(moduleInfo,type) { + results.push(type); + }); + results.sort(); + return results; +}; + +})(); diff --git a/core/modules/macros/changecount.js b/core/modules/macros/changecount.js new file mode 100644 index 000000000..2d0f62e5a --- /dev/null +++ b/core/modules/macros/changecount.js @@ -0,0 +1,30 @@ +/*\ +title: $:/core/modules/macros/changecount.js +type: application/javascript +module-type: macro + +Macro to return the changecount for the current tiddler + +\*/ +(function(){ + +/*jslint node: true, browser: true */ +/*global $tw: false */ +"use strict"; + +/* +Information about this macro +*/ + +exports.name = "changecount"; + +exports.params = []; + +/* +Run the macro +*/ +exports.run = function() { + return this.wiki.getChangeCount(this.getVariable("currentTiddler")) + ""; +}; + +})(); diff --git a/core/modules/macros/makedatauri.js b/core/modules/macros/makedatauri.js new file mode 100644 index 000000000..418a95f6b --- /dev/null +++ b/core/modules/macros/makedatauri.js @@ -0,0 +1,44 @@ +/*\ +title: $:/core/modules/macros/makedatauri.js +type: application/javascript +module-type: macro + +Macro to convert the content of a tiddler to a data URI + +<< | <$edit-text tiddler=< | <$button message="tw-remove-field" param=< |
+