mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2025-08-07 14:23:53 +00:00
Added support for generating the <title> tag from wikifying WindowTitle
This commit is contained in:
parent
d39b9a047f
commit
d748d04d92
28
js/Recipe.js
28
js/Recipe.js
@ -220,7 +220,10 @@ Recipe.prototype.outputTiddlersForMarker = function(out,marker) {
|
|||||||
var tiddlers = this.markers[marker],
|
var tiddlers = this.markers[marker],
|
||||||
outputType = Recipe.tiddlerOutputMapper[marker] || "raw",
|
outputType = Recipe.tiddlerOutputMapper[marker] || "raw",
|
||||||
outputter = Recipe.tiddlerOutputter[outputType];
|
outputter = Recipe.tiddlerOutputter[outputType];
|
||||||
if(outputter && tiddlers) {
|
if(!tiddlers) {
|
||||||
|
tiddlers = [];
|
||||||
|
}
|
||||||
|
if(outputter) {
|
||||||
outputter.call(this,out,tiddlers);
|
outputter.call(this,out,tiddlers);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -231,7 +234,8 @@ Recipe.tiddlerOutputMapper = {
|
|||||||
js: "javascript",
|
js: "javascript",
|
||||||
jsdeprecated: "javascript",
|
jsdeprecated: "javascript",
|
||||||
jquery: "javascript",
|
jquery: "javascript",
|
||||||
shadow: "shadow"
|
shadow: "shadow",
|
||||||
|
title: "title"
|
||||||
};
|
};
|
||||||
|
|
||||||
Recipe.tiddlerOutputter = {
|
Recipe.tiddlerOutputter = {
|
||||||
@ -273,6 +277,9 @@ Recipe.tiddlerOutputter = {
|
|||||||
tid = this.store.shadows.getTiddler(title);
|
tid = this.store.shadows.getTiddler(title);
|
||||||
out.push(tiddlerOutput.outputTiddlerDiv(tid));
|
out.push(tiddlerOutput.outputTiddlerDiv(tid));
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
title: function(out,tiddlers) {
|
||||||
|
out.push(this.renderTiddler("WindowTitle","text/plain"));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -283,17 +290,13 @@ Recipe.prototype.cookRss = function()
|
|||||||
numRssItems = 20,
|
numRssItems = 20,
|
||||||
s = [],
|
s = [],
|
||||||
d = new Date(),
|
d = new Date(),
|
||||||
renderTiddler = function(title,type) {
|
u = this.renderTiddler("SiteUrl","text/plain"),
|
||||||
var r = new WikiTextRenderer(me.store.getTiddler(title).getParseTree(),me.store,title);
|
|
||||||
return r.render(type);
|
|
||||||
},
|
|
||||||
u = renderTiddler("SiteUrl","text/plain"),
|
|
||||||
encodeTiddlyLink = function(title) {
|
encodeTiddlyLink = function(title) {
|
||||||
return title.indexOf(" ") == -1 ? title : "[[" + title + "]]";
|
return title.indexOf(" ") == -1 ? title : "[[" + title + "]]";
|
||||||
},
|
},
|
||||||
tiddlerToRssItem = function(tiddler,uri) {
|
tiddlerToRssItem = function(tiddler,uri) {
|
||||||
var s = "<title" + ">" + utils.htmlEncode(tiddler.fields.title) + "</title" + ">\n";
|
var s = "<title" + ">" + utils.htmlEncode(tiddler.fields.title) + "</title" + ">\n";
|
||||||
s += "<description>" + utils.htmlEncode(renderTiddler(tiddler.fields.title,"text/plain")) + "</description>\n";
|
s += "<description>" + utils.htmlEncode(me.renderTiddler(tiddler.fields.title,"text/plain")) + "</description>\n";
|
||||||
var i;
|
var i;
|
||||||
if(tiddler.fields.tags) {
|
if(tiddler.fields.tags) {
|
||||||
for(i=0; i<tiddler.fields.tags.length; i++) {
|
for(i=0; i<tiddler.fields.tags.length; i++) {
|
||||||
@ -332,10 +335,10 @@ Recipe.prototype.cookRss = function()
|
|||||||
s.push("<" + "?xml version=\"1.0\"?" + ">");
|
s.push("<" + "?xml version=\"1.0\"?" + ">");
|
||||||
s.push("<rss version=\"2.0\">");
|
s.push("<rss version=\"2.0\">");
|
||||||
s.push("<channel>");
|
s.push("<channel>");
|
||||||
s.push("<title" + ">" + utils.htmlEncode(renderTiddler("SiteTitle","text/plain")) + "</title" + ">");
|
s.push("<title" + ">" + utils.htmlEncode(this.renderTiddler("SiteTitle","text/plain")) + "</title" + ">");
|
||||||
if(u)
|
if(u)
|
||||||
s.push("<link>" + utils.htmlEncode(u) + "</link>");
|
s.push("<link>" + utils.htmlEncode(u) + "</link>");
|
||||||
s.push("<description>" + utils.htmlEncode(renderTiddler("SiteSubtitle","text/plain")) + "</description>");
|
s.push("<description>" + utils.htmlEncode(this.renderTiddler("SiteSubtitle","text/plain")) + "</description>");
|
||||||
//s.push("<language>" + config.locale + "</language>");
|
//s.push("<language>" + config.locale + "</language>");
|
||||||
s.push("<pubDate>" + d.toUTCString() + "</pubDate>");
|
s.push("<pubDate>" + d.toUTCString() + "</pubDate>");
|
||||||
s.push("<lastBuildDate>" + d.toUTCString() + "</lastBuildDate>");
|
s.push("<lastBuildDate>" + d.toUTCString() + "</lastBuildDate>");
|
||||||
@ -354,5 +357,10 @@ Recipe.prototype.cookRss = function()
|
|||||||
return s.join("\n");
|
return s.join("\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Recipe.prototype.renderTiddler = function(title,type) {
|
||||||
|
var r = new WikiTextRenderer(this.store.getTiddler(title).getParseTree(),this.store,title);
|
||||||
|
return r.render(type);
|
||||||
|
};
|
||||||
|
|
||||||
exports.Recipe = Recipe;
|
exports.Recipe = Recipe;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user