diff --git a/js/Recipe.js b/js/Recipe.js index f244bbe3f..72bb584b9 100755 --- a/js/Recipe.js +++ b/js/Recipe.js @@ -406,7 +406,7 @@ Recipe.tiddlerOutputter = { for(var t=0; t"); + out.push("<" + "script type=\"application/javascript\" data-tiddler-title=\"" + title + "\">"); out.push("define(\"" + title + "\",function(require,exports,module) {"); out.push(tid.text); out.push("});"); diff --git a/js/TiddlerInput.js b/js/TiddlerInput.js index 73766fb7a..fce32b74c 100755 --- a/js/TiddlerInput.js +++ b/js/TiddlerInput.js @@ -172,7 +172,7 @@ var inputTiddlyWiki = function(text,fields) { // Given a reference to a DOM node, return the tiddlers stored in the immediate child nodes var inputTiddlerDOM = function(node) { - var extractTiddler = function(node) { + var extractTextTiddler = function(node) { var e = node.firstChild; while(e && e.nodeName.toLowerCase() !== "pre") { e = e.nextSibling; @@ -198,9 +198,21 @@ var inputTiddlerDOM = function(node) { return null; } }, + extractModuleTiddler = function(node) { + if(node.hasAttribute && node.hasAttribute("data-tiddler-title")) { + return { + title: node.getAttribute("data-tiddler-title"), + text: node.innerHTML, + type: "application/javascript" + }; + } else { + return null; + } + }, t,tiddlers = []; for(t = 0; t < node.childNodes.length; t++) { - var tiddler = extractTiddler(node.childNodes[t]); + var tiddler = extractTextTiddler(node.childNodes[t]); + tiddler = tiddler || extractModuleTiddler(node.childNodes[t]); if(tiddler) { tiddlers.push(tiddler); } diff --git a/tiddlywiki5/tiddlywiki5.template.html b/tiddlywiki5/tiddlywiki5.template.html index 65f766ab2..c725e95b8 100644 --- a/tiddlywiki5/tiddlywiki5.template.html +++ b/tiddlywiki5/tiddlywiki5.template.html @@ -27,7 +27,9 @@ +