1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-12-23 16:40:28 +00:00

Get rid of the "new_" prefix we had on some methods

There's still the "old_" prefix to get rid of too.
This commit is contained in:
Jeremy Ruston 2013-11-08 08:51:14 +00:00
parent b7cb1d3391
commit cc0011abd3
23 changed files with 61 additions and 61 deletions

View File

@ -11,7 +11,7 @@ mkdir -p tmp/tw2
node ./tiddlywiki.js \
editions/tw5.com \
--verbose \
--new_rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \
--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 \
--new_rendertiddler $:/core/templates/tiddlywiki2.template.html ./tmp/tw2/index.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki2.template.html ./tmp/tw2/index.html text/plain \
|| exit 1
diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html

24
bld.sh
View File

@ -35,12 +35,12 @@ rm $TW5_BUILD_OUTPUT/static/*
node ./tiddlywiki.js \
./editions/tw5.com \
--verbose \
--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 \
--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 \
|| 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 \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/encrypted.html text/plain \
--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 \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/empty.html text/plain \
--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 \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/tahoelafs.html text/plain \
|| exit 1
# Fifth, d3demo.html: wiki to demo d3 plugin
@ -73,7 +73,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/d3demo \
--verbose \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/d3demo.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/d3demo.html text/plain \
|| exit 1
# Sixth, codemirrordemo.html: wiki to demo codemirror plugin
@ -81,7 +81,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/codemirrordemo \
--verbose \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/codemirrordemo.html text/plain \
|| exit 1
# Seventh, codemirrordemo.html: wiki to demo codemirror plugin
@ -89,7 +89,7 @@ node ./tiddlywiki.js \
node ./tiddlywiki.js \
./editions/markdowndemo \
--verbose \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/markdowndemo.html text/plain \
--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

View File

@ -1,5 +1,5 @@
/*\
title: $:/core/modules/commands/new_rendertiddler.js
title: $:/core/modules/commands/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: "new_rendertiddler",
name: "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.new_renderTiddler(type,title),"utf8",function(err) {
fs.writeFile(filename,this.commander.wiki.renderTiddler(type,title),"utf8",function(err) {
self.callback(err);
});
return null;

View File

@ -1,5 +1,5 @@
/*\
title: $:/core/modules/commands/new_rendertiddlers.js
title: $:/core/modules/commands/rendertiddlers.js
type: application/javascript
module-type: command
@ -15,7 +15,7 @@ Command to render several tiddlers to a folder of files
var widget = require("$:/core/modules/widgets/widget.js");
exports.info = {
name: "new_rendertiddlers",
name: "rendertiddlers",
synchronous: true
};
@ -40,7 +40,7 @@ Command.prototype.execute = function() {
extension = this.params[4] || ".html",
tiddlers = wiki.filterTiddlers(filter);
$tw.utils.each(tiddlers,function(title) {
var parser = wiki.new_parseTiddler(template),
var parser = wiki.parseTiddler(template),
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
var container = $tw.document.createElement("div");
widgetNode.render(container,null);

View File

@ -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.new_renderTiddler(state.server.get("renderType"),state.server.get("rootTiddler"));
var text = state.wiki.renderTiddler(state.server.get("renderType"),state.server.get("rootTiddler"));
response.end(text,"utf8");
}
});

View File

@ -59,7 +59,7 @@ exports.parse = function() {
this.parser.pos = this.parser.sourceLength;
}
// Parse the block according to the specified type
var parser = this.parser.wiki.new_parseText(parseType,text,{defaultType: "text/plain"});
var parser = this.parser.wiki.parseText(parseType,text,{defaultType: "text/plain"});
// If there's no render type, just return the parse tree
if(!renderType) {
return parser.tree;

View File

@ -106,7 +106,7 @@ exports.startup = function() {
});
// Display the PageMacros, which includes the PageTemplate
var templateTitle = "$:/core/ui/PageMacros",
parser = $tw.wiki.new_parseTiddler(templateTitle);
parser = $tw.wiki.parseTiddler(templateTitle);
$tw.pageWidgetNode = $tw.wiki.makeWidget(parser,{document: document, parentWidget: $tw.rootWidget});
$tw.pageContainer = document.createElement("div");
$tw.utils.addClass($tw.pageContainer,"tw-page-container");

View File

@ -73,14 +73,14 @@ Modal.prototype.display = function(title,options) {
} else {
titleText = title;
}
var headerParser = this.wiki.new_parseText("text/vnd.tiddlywiki",titleText,{parseAsInline: true}),
var headerParser = this.wiki.parseText("text/vnd.tiddlywiki",titleText,{parseAsInline: true}),
headerWidgetNode = this.wiki.makeWidget(headerParser,{parentWidget: $tw.rootWidget, document: document});
headerWidgetNode.render(headerTitle,null);
this.wiki.addEventListener("change",function(changes) {
headerWidgetNode.refresh(changes,modalHeader,null);
});
// Render the body of the message
var bodyParser = this.wiki.new_parseTiddler(title),
var bodyParser = this.wiki.parseTiddler(title),
bodyWidgetNode = this.wiki.makeWidget(bodyParser,{parentWidget: $tw.rootWidget, document: document});
bodyWidgetNode.render(modalBody,null);
this.wiki.addEventListener("change",function(changes) {
@ -107,7 +107,7 @@ Modal.prototype.display = function(title,options) {
} else {
footerText = '<$button message="tw-close-tiddler" class="btn btn-primary">Close</$button>';
}
var footerParser = this.wiki.new_parseText("text/vnd.tiddlywiki",footerText,{parseAsInline: true}),
var footerParser = this.wiki.parseText("text/vnd.tiddlywiki",footerText,{parseAsInline: true}),
footerWidgetNode = this.wiki.makeWidget(footerParser,{parentWidget: $tw.rootWidget, document: document});
footerWidgetNode.render(modalFooterButtons,null);
this.wiki.addEventListener("change",function(changes) {

View File

@ -37,7 +37,7 @@ Notifier.prototype.display = function(title,options) {
// Add classes
$tw.utils.addClass(notification,"tw-notification");
// Render the body of the notification
var parser = this.wiki.new_parseTiddler(title),
var parser = this.wiki.parseTiddler(title),
widgetNode = this.wiki.makeWidget(parser,{parentWidget: $tw.rootWidget, document: document});
widgetNode.render(notification,null);
this.wiki.addEventListener("change",function(changes) {

View File

@ -34,7 +34,7 @@ StylesheetManager.prototype.addStylesheet = function(title) {
// Record the stylesheet in the hashmap
this.stylesheets[title] = true;
// Parse the tiddler and render as plain text
var text = this.wiki.new_renderTiddler("text/plain",title);
var text = this.wiki.renderTiddler("text/plain",title);
// Create a style element and put it in the document
var styleNode = document.createElement("style");
styleNode.setAttribute("type","text/css");

View File

@ -81,7 +81,7 @@ ListWidget.prototype.getTiddlerList = function() {
ListWidget.prototype.getEmptyMessage = function() {
var emptyMessage = this.getAttribute("emptyMessage",""),
parser = this.wiki.new_parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true});
parser = this.wiki.parseText("text/vnd.tiddlywiki",emptyMessage,{parseAsInline: true});
if(parser) {
return parser.tree;
} else {

View File

@ -53,12 +53,12 @@ MacroCallWidget.prototype.execute = function() {
// Are we rendering to HTML?
if(this.renderOutput === "text/html") {
// If so we'll return the parsed macro
var parser = this.wiki.new_parseText(this.parseType,text,
var parser = this.wiki.parseText(this.parseType,text,
{parseAsInline: !this.parseTreeNode.isBlock});
parseTreeNodes = parser ? parser.tree : [];
} else {
// Otherwise, we'll render the text
var plainText = this.wiki.new_renderText("text/plain",this.parseType,text,{parentWidget: this});
var plainText = this.wiki.renderText("text/plain",this.parseType,text,{parentWidget: this});
parseTreeNodes = [{type: "text", text: plainText}];
}
// Construct the child widgets

View File

@ -50,7 +50,7 @@ TranscludeWidget.prototype.execute = function() {
// Set context variables for recursion detection
this.setVariable("transclusion",recursionMarker);
// Parse the text reference
var parser = this.wiki.new_parseTextReference(
var parser = this.wiki.parseTextReference(
this.transcludeTitle,
this.transcludeField,
this.transcludeIndex,

View File

@ -121,7 +121,7 @@ ViewWidget.prototype.getValueAsText = function() {
};
ViewWidget.prototype.getValueAsHtmlWikified = function() {
return this.wiki.new_renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),this);
return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),this);
};
ViewWidget.prototype.getValueAsHtmlEncoded = function() {

View File

@ -218,7 +218,7 @@ Widget.prototype.computeAttributes = function() {
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler"));
} else if(attribute.type === "macro") {
var text = self.getVariable(attribute.value.name,{params: attribute.value.params});
value = self.wiki.new_renderText("text/plain","text/vnd.tiddlywiki",text);
value = self.wiki.renderText("text/plain","text/vnd.tiddlywiki",text);
} else { // String attribute
value = attribute.value;
}

View File

@ -329,7 +329,7 @@ exports.getTiddlerLinks = function(title) {
// We'll cache the links so they only get computed if the tiddler changes
return this.getCacheForTiddler(title,"links",function() {
// Parse the tiddler
var parser = self.new_parseTiddler(title);
var parser = self.parseTiddler(title);
// Count up the links
var links = [],
checkParseTree = function(parseTree) {
@ -672,7 +672,7 @@ var tweakParser = function(parser) {
tweakParseTreeNodes(parser.tree);
};
exports.new_parseText = function(type,text,options) {
exports.parseText = function(type,text,options) {
var parser = this.old_parseText(type,text,options);
if(parser) {
tweakParser(parser)
@ -680,7 +680,7 @@ exports.new_parseText = function(type,text,options) {
return parser;
};
exports.new_parseTiddler = function(title,options) {
exports.parseTiddler = function(title,options) {
var parser = this.old_parseTiddler(title,options);
if(parser) {
tweakParser(parser)
@ -688,9 +688,9 @@ exports.new_parseTiddler = function(title,options) {
return parser;
};
exports.new_parseTextReference = function(title,field,index,options) {
exports.parseTextReference = function(title,field,index,options) {
if(field === "text" || (!field && !index)) {
return this.new_parseTiddler(title,options);
return this.parseTiddler(title,options);
} else {
var tiddler,text;
if(field) {
@ -699,10 +699,10 @@ exports.new_parseTextReference = function(title,field,index,options) {
if(text === undefined) {
text = "";
}
return this.new_parseText("text/vnd.tiddlywiki",text,options);
return this.parseText("text/vnd.tiddlywiki",text,options);
} else if(index) {
text = this.extractTiddlerDataItem(title,index,"");
return this.new_parseText("text/vnd.tiddlywiki",text,options);
return this.parseText("text/vnd.tiddlywiki",text,options);
}
}
};
@ -756,9 +756,9 @@ Options include:
variables: hashmap of variables to set
parentWidget: optional parent widget for the root node
*/
exports.new_renderText = function(outputType,textType,text,options) {
exports.renderText = function(outputType,textType,text,options) {
options = options || {};
var parser = $tw.wiki.new_parseText(textType,text),
var parser = $tw.wiki.parseText(textType,text),
widgetNode = this.makeWidget(parser,options);
var container = $tw.document.createElement("div");
widgetNode.render(container,null);
@ -774,9 +774,9 @@ Options include:
variables: hashmap of variables to set
parentWidget: optional parent widget for the root node
*/
exports.new_renderTiddler = function(outputType,title,options) {
exports.renderTiddler = function(outputType,title,options) {
options = options || {};
var parser = this.new_parseTiddler(title),
var parser = this.parseTiddler(title),
widgetNode = this.makeWidget(parser,options);
var container = $tw.document.createElement("div");
widgetNode.render(container,null);
@ -832,7 +832,7 @@ exports.saveWiki = function(options) {
options = options || {};
var template = options.template || "$:/core/templates/tiddlywiki5.template.html",
downloadType = options.downloadType || "text/plain";
var text = this.new_renderTiddler(downloadType,template);
var text = this.renderTiddler(downloadType,template);
this.callSaver("save",text,function(err) {
$tw.notifier.display("$:/messages/Saved");
});

View File

@ -25,7 +25,7 @@ describe("Widget module", function() {
}
function parseText(text,wiki,options) {
var parser = wiki.new_parseText("text/vnd.tiddlywiki",text,options);
var parser = wiki.parseText("text/vnd.tiddlywiki",text,options);
return parser ? {type: "widget", children: parser.tree} : undefined;
}

View File

@ -19,7 +19,7 @@ describe("WikiText parser tests", function() {
// Define a parsing shortcut
var parse = function(text) {
return wiki.new_parseText("text/vnd.tiddlywiki",text).tree;
return wiki.parseText("text/vnd.tiddlywiki",text).tree;
};
it("should parse tags", function() {

View File

@ -23,27 +23,27 @@ describe("WikiText tests", function() {
wiki.addTiddler({title: "TiddlerFour", text: "\\define my-macro(adjective:'groovy')\nThis is my ''amazingly'' $adjective$ macro!\n\\end\n\n<$link to=<<my-macro>>>This is a link</$link>"});
it("should render tiddlers with no special markup as-is", function() {
expect(wiki.new_renderTiddler("text/plain","TiddlerOne")).toBe("The quick brown fox");
expect(wiki.renderTiddler("text/plain","TiddlerOne")).toBe("The quick brown fox");
});
it("should preserve single new lines", function() {
expect(wiki.new_renderTiddler("text/plain","TiddlerTwo")).toBe("The rain in Spain\nfalls mainly on the plain");
expect(wiki.renderTiddler("text/plain","TiddlerTwo")).toBe("The rain in Spain\nfalls mainly on the plain");
});
it("should use double new lines to create paragraphs", function() {
// The paragraphs are lost in the conversion to plain text
expect(wiki.new_renderTiddler("text/plain","TiddlerThree")).toBe("The speed of soundThe light of speed");
expect(wiki.renderTiddler("text/plain","TiddlerThree")).toBe("The speed of soundThe light of speed");
});
it("should render plain text tiddlers as a paragraph", function() {
expect(wiki.new_renderTiddler("text/html","TiddlerOne")).toBe("<p>The quick brown fox</p>");
expect(wiki.renderTiddler("text/html","TiddlerOne")).toBe("<p>The quick brown fox</p>");
});
it("should preserve single new lines", function() {
expect(wiki.new_renderTiddler("text/html","TiddlerTwo")).toBe("<p>The rain in Spain\nfalls mainly on the plain</p>");
expect(wiki.renderTiddler("text/html","TiddlerTwo")).toBe("<p>The rain in Spain\nfalls mainly on the plain</p>");
});
it("should use double new lines to create paragraphs", function() {
expect(wiki.new_renderTiddler("text/html","TiddlerThree")).toBe("<p>The speed of sound</p><p>The light of speed</p>");
expect(wiki.renderTiddler("text/html","TiddlerThree")).toBe("<p>The speed of sound</p><p>The light of speed</p>");
});
it("should support attributes specified as macro invocations", function() {
expect(wiki.new_renderTiddler("text/html","TiddlerFour")).toBe("<p><a class=' tw-tiddlylink tw-tiddlylink-missing' href='#This%20is%20my%20amazingly%20groovy%20macro!'>This is a link</a></p>");
expect(wiki.renderTiddler("text/html","TiddlerFour")).toBe("<p><a class=' tw-tiddlylink tw-tiddlylink-missing' href='#This%20is%20my%20amazingly%20groovy%20macro!'>This is a link</a></p>");
});
});

View File

@ -9,6 +9,6 @@ node ./tiddlywiki.js \
./editions/empty \
--verbose \
--load $1 \
--new_rendertiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
--new_rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
--rendertiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
|| exit 1

View File

@ -152,7 +152,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
if(err) {
return callback(err);
}
content = $tw.wiki.new_renderTiddler("text/plain","$:/core/templates/tiddler-metadata",{variables: {currentTiddler: tiddler.fields.title}});
content = $tw.wiki.renderTiddler("text/plain","$:/core/templates/tiddler-metadata",{variables: {currentTiddler: tiddler.fields.title}});
fs.writeFile(fileInfo.filepath + ".meta",content,{encoding: "utf8"},function (err) {
if(err) {
return callback(err);
@ -164,7 +164,7 @@ console.log("FileSystem: Saved file",fileInfo.filepath);
} else {
// Save the tiddler as a self contained templated file
template = $tw.config.typeTemplates[fileInfo.type];
content = $tw.wiki.new_renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
content = $tw.wiki.renderTiddler("text/plain",template,{variables: {currentTiddler: tiddler.fields.title}});
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
if(err) {
return callback(err);

View File

@ -20,5 +20,5 @@ echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]"
node ./tiddlywiki.js \
./editions/test \
--verbose \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/test.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/test.html text/plain \
|| exit 1

View File

@ -15,7 +15,7 @@ mkdir -p tmp
node ./tiddlywiki.js \
editions/tw5tiddlyweb \
--verbose \
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html tmp/tiddlyweb.html text/plain \
--rendertiddler $:/core/templates/tiddlywiki5.template.html tmp/tiddlyweb.html text/plain \
|| exit 1
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file