1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-27 12:07:19 +00:00

Trim javascript module tiddlers to exclude the standard header and footer

This commit is contained in:
Jeremy Ruston 2012-03-02 00:10:39 +00:00
parent 8552f2f894
commit 542561a0fa

View File

@ -200,9 +200,15 @@ var inputTiddlerDOM = function(node) {
}, },
extractModuleTiddler = function(node) { extractModuleTiddler = function(node) {
if(node.hasAttribute && node.hasAttribute("data-tiddler-title")) { if(node.hasAttribute && node.hasAttribute("data-tiddler-title")) {
var text = node.innerHTML,
s = text.indexOf("{"),
e = text.lastIndexOf("}");
if(s !== -1 && e !== -1) {
text = text.substring(s+1,e-1);
}
return { return {
title: node.getAttribute("data-tiddler-title"), title: node.getAttribute("data-tiddler-title"),
text: node.innerHTML, text: text,
type: "application/javascript" type: "application/javascript"
}; };
} else { } else {