kopia lustrzana https://github.com/miklobit/TiddlyWiki5
Added sort order to tiddler div attributes
So that file comparisons work betterprint-window-tiddler
rodzic
e281d5dc16
commit
468749159d
|
@ -507,6 +507,12 @@ $tw.plugins.applyMethods("tiddlerdeserializer",$tw.Wiki.tiddlerDeserializerPlugi
|
|||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("pluginModules"))
|
||||
);
|
||||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernelPrefix"))
|
||||
);
|
||||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("bootKernel"))
|
||||
);
|
||||
// Load the stylesheet tiddlers from the DOM
|
||||
$tw.wiki.shadows.addTiddlers(
|
||||
$tw.wiki.deserializeTiddlers("(DOM)",document.getElementById("styleArea"))
|
||||
|
|
|
@ -22,4 +22,4 @@ PlainTextParser.prototype.parse = function(type,text) {
|
|||
|
||||
exports["text/plain"] = PlainTextParser;
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
@ -69,13 +69,17 @@ exports["application/x-tiddler-module"] = function(tiddler) {
|
|||
};
|
||||
|
||||
exports["application/x-tiddler-html-div"] = function(tiddler) {
|
||||
var result = [];
|
||||
var result = [],fields = [];
|
||||
result.push("<div");
|
||||
for(var f in tiddler.fields) {
|
||||
if(f !== "text") {
|
||||
result.push(" " + f + "=\"" + tiddler.getFieldString(f) + "\"");
|
||||
fields.push(f);
|
||||
}
|
||||
}
|
||||
fields.sort();
|
||||
for(f=0; f<fields.length; f++) {
|
||||
result.push(" " + fields[f] + "=\"" + tiddler.getFieldString(fields[f]) + "\"");
|
||||
}
|
||||
result.push(">\n<pre>");
|
||||
result.push($tw.utils.htmlEncode(tiddler.fields.text));
|
||||
result.push("</pre>\n</div>");
|
||||
|
|
|
@ -48,12 +48,17 @@ Element.prototype.execute = function(parents,tiddlerTitle) {
|
|||
|
||||
Element.prototype.render = function(type) {
|
||||
var isHtml = type === "text/html",
|
||||
output = [];
|
||||
output = [],attr,a,v;
|
||||
if(isHtml) {
|
||||
output.push("<",this.type);
|
||||
if(this.attributes) {
|
||||
for(var a in this.attributes) {
|
||||
var v = this.attributes[a];
|
||||
attr = []
|
||||
for(a in this.attributes) {
|
||||
attr.push(a);
|
||||
}
|
||||
attr.sort();
|
||||
for(a=0; a<attr.length; a++) {
|
||||
v = this.attributes[attr[a]];
|
||||
if(v !== undefined) {
|
||||
if($tw.utils.isArray(v)) {
|
||||
v = v.join(" ");
|
||||
|
@ -64,7 +69,7 @@ Element.prototype.render = function(type) {
|
|||
}
|
||||
v = s.join("");
|
||||
}
|
||||
output.push(" ",a,"='",$tw.utils.htmlEncode(v),"'");
|
||||
output.push(" ",attr[a],"='",$tw.utils.htmlEncode(v),"'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,7 +189,7 @@ exports.operators = {
|
|||
},
|
||||
filter: function(operator) {
|
||||
var desc = operator.prefix === "!" ? "true" : "false";
|
||||
return "this.sortTiddlers(subResults,\"" + $tw.utils.stringify(operator.operand) + "\"," + desc + ");"
|
||||
return "this.sortTiddlers(subResults,\"" + $tw.utils.stringify(operator.operand) + "\"," + desc + ");";
|
||||
}
|
||||
},
|
||||
"field": {
|
||||
|
|
|
@ -36,12 +36,16 @@ type: text/x-tiddlywiki-html
|
|||
<<include "[is[tiddler]]" application/x-tiddler-html-div>>
|
||||
</div>
|
||||
<!----------- Boot kernel prologue ----------->
|
||||
<div id="bootKernelPrefix" style="display:none;">
|
||||
<<include "$:/core/bootprefix.js" application/javascript shadow:yes>>
|
||||
</div>
|
||||
<!----------- Plugin modules ----------->
|
||||
<div id="pluginModules" style="display:none;">
|
||||
<<include "[type[application/javascript]has[module-type]]" application/x-tiddler-module shadow:yes>>
|
||||
</div>
|
||||
<!----------- Boot kernel ----------->
|
||||
<div id="bootKernel" style="display:none;">
|
||||
<<include "$:/core/boot.js" application/javascript shadow:yes>>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
14
readme.md
14
readme.md
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
<div data-tiddler-target='SixthTiddler' data-tiddler-template='SixthTiddler' class='tw-tiddler-frame'>SixthTiddler<br>11 February 2011<br><a href='Jermolene' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>Jermolene</a><br></div><br><div data-tiddler-target='SixthTiddler' data-tiddler-template='SixthTiddler' class='tw-tiddler-frame'>SixthTiddler<br>11 February 2011<br><a href='Jermolene' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>Jermolene</a><br></div><br><div data-tiddler-target='EighthTiddler' data-tiddler-template='SixthTiddler' class='tw-tiddler-frame'>EighthTiddler<br><br><br></div><br><div data-tiddler-target='FirstTiddler' data-tiddler-template='SixthTiddler' class='tw-tiddler-frame'>FirstTiddler<br><br><br></div><br>
|
||||
<div class='tw-tiddler-frame' data-tiddler-target='SixthTiddler' data-tiddler-template='SixthTiddler'>SixthTiddler<br>11 February 2011<br><a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing' href='Jermolene'>Jermolene</a><br></div><br><div class='tw-tiddler-frame' data-tiddler-target='SixthTiddler' data-tiddler-template='SixthTiddler'>SixthTiddler<br>11 February 2011<br><a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing' href='Jermolene'>Jermolene</a><br></div><br><div class='tw-tiddler-frame' data-tiddler-target='EighthTiddler' data-tiddler-template='SixthTiddler'>EighthTiddler<br><br><br></div><br><div class='tw-tiddler-frame' data-tiddler-target='FirstTiddler' data-tiddler-template='SixthTiddler'>FirstTiddler<br><br><br></div><br>
|
|
@ -1 +1 @@
|
|||
This is the <strong>text</strong> of the first tiddler, with a <span style='font-size:8em;color:red;'>link</span> to the <a href='SecondTiddler' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>SecondTiddler</a>, too. And a link to <a href='http://tiddlywiki.com/' class='tw-tiddlylink tw-tiddlylink-external'>http://tiddlywiki.com/</a>.<br>
|
||||
This is the <strong>text</strong> of the first tiddler, with a <span style='font-size:8em;color:red;'>link</span> to the <a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='SecondTiddler'>SecondTiddler</a>, too. And a link to <a class='tw-tiddlylink tw-tiddlylink-external' href='http://tiddlywiki.com/'>http://tiddlywiki.com/</a>.<br>
|
|
@ -1 +1 @@
|
|||
SixthTiddler<br>11 February 2011<br><a href='Jermolene' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>Jermolene</a><br>
|
||||
SixthTiddler<br>11 February 2011<br><a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing' href='Jermolene'>Jermolene</a><br>
|
|
@ -1 +1 @@
|
|||
An explicit link <a href='Fourth%20Tiddler' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>Fourth Tiddler</a> and <a href='Fourth%20Tiddler' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>a pretty link</a> and a transclusion <div data-tiddler-target='Fourth Tiddler' data-tiddler-template='Fourth Tiddler' class='tw-tiddler-frame'>A missing image <img src='Something.jpg'> and a Stringy couple of Ç Ç "HTML Entity"</div><br><br><img src='http://placehold.it/350x150'><br>
|
||||
An explicit link <a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='Fourth%20Tiddler'>Fourth Tiddler</a> and <a class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves' href='Fourth%20Tiddler'>a pretty link</a> and a transclusion <div class='tw-tiddler-frame' data-tiddler-target='Fourth Tiddler' data-tiddler-template='Fourth Tiddler'>A missing image <img src='Something.jpg'> and a Stringy couple of Ç Ç "HTML Entity"</div><br><br><img src='http://placehold.it/350x150'><br>
|
Ładowanie…
Reference in New Issue