mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-25 01:20:30 +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:
parent
b7cb1d3391
commit
cc0011abd3
4
2bld.sh
4
2bld.sh
@ -11,7 +11,7 @@ mkdir -p tmp/tw2
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
editions/tw5.com \
|
editions/tw5.com \
|
||||||
--verbose \
|
--verbose \
|
||||||
--new_rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \
|
--rendertiddler TiddlyWiki2ReadMe editions/tw2/readme.md text/html \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# cook the TiddlyWiki 2.x.x index file
|
# cook the TiddlyWiki 2.x.x index file
|
||||||
@ -20,7 +20,7 @@ node ./tiddlywiki.js \
|
|||||||
editions/tw2 \
|
editions/tw2 \
|
||||||
--verbose \
|
--verbose \
|
||||||
--load editions/tw2/source/tiddlywiki.com/index.html.recipe \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html
|
diff -q tmp/tw2/index.html editions/tw2/target/prebuilt.html
|
||||||
|
24
bld.sh
24
bld.sh
@ -35,12 +35,12 @@ rm $TW5_BUILD_OUTPUT/static/*
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/tw5.com \
|
./editions/tw5.com \
|
||||||
--verbose \
|
--verbose \
|
||||||
--new_rendertiddler ReadMe ./readme.md text/html \
|
--rendertiddler ReadMe ./readme.md text/html \
|
||||||
--new_rendertiddler ContributingTemplate ./contributing.md text/html \
|
--rendertiddler ContributingTemplate ./contributing.md text/html \
|
||||||
--new_rendertiddler $:/core/templates/tiddlywiki5.template.html $TW5_BUILD_OUTPUT/index.html text/plain \
|
--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 \
|
--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 \
|
--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 \
|
--rendertiddlers [!is[system]] $:/core/templates/static.tiddler.html $TW5_BUILD_OUTPUT/static text/plain \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
# Second, encrypted.html: a version of the main file encrypted with the password "password"
|
# Second, encrypted.html: a version of the main file encrypted with the password "password"
|
||||||
@ -49,7 +49,7 @@ node ./tiddlywiki.js \
|
|||||||
./editions/tw5.com \
|
./editions/tw5.com \
|
||||||
--verbose \
|
--verbose \
|
||||||
--password password \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Third, empty.html: empty wiki for reuse
|
# Third, empty.html: empty wiki for reuse
|
||||||
@ -57,7 +57,7 @@ node ./tiddlywiki.js \
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/empty \
|
./editions/empty \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
|
# Fourth, tahoelafs.html: empty wiki with plugin for Tahoe-LAFS
|
||||||
@ -65,7 +65,7 @@ node ./tiddlywiki.js \
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/tahoelafs \
|
./editions/tahoelafs \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Fifth, d3demo.html: wiki to demo d3 plugin
|
# Fifth, d3demo.html: wiki to demo d3 plugin
|
||||||
@ -73,7 +73,7 @@ node ./tiddlywiki.js \
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/d3demo \
|
./editions/d3demo \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Sixth, codemirrordemo.html: wiki to demo codemirror plugin
|
# Sixth, codemirrordemo.html: wiki to demo codemirror plugin
|
||||||
@ -81,7 +81,7 @@ node ./tiddlywiki.js \
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/codemirrordemo \
|
./editions/codemirrordemo \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Seventh, codemirrordemo.html: wiki to demo codemirror plugin
|
# Seventh, codemirrordemo.html: wiki to demo codemirror plugin
|
||||||
@ -89,7 +89,7 @@ node ./tiddlywiki.js \
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/markdowndemo \
|
./editions/markdowndemo \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Eighth, run the test edition to run the node.js tests and to generate test.html for tests in the browser
|
# Eighth, run the test edition to run the node.js tests and to generate test.html for tests in the browser
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/commands/new_rendertiddler.js
|
title: $:/core/modules/commands/rendertiddler.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: command
|
module-type: command
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ Command to render a tiddler and save it to a file
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "new_rendertiddler",
|
name: "rendertiddler",
|
||||||
synchronous: false
|
synchronous: false
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -33,7 +33,7 @@ Command.prototype.execute = function() {
|
|||||||
title = this.params[0],
|
title = this.params[0],
|
||||||
filename = this.params[1],
|
filename = this.params[1],
|
||||||
type = this.params[2] || "text/html";
|
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);
|
self.callback(err);
|
||||||
});
|
});
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*\
|
/*\
|
||||||
title: $:/core/modules/commands/new_rendertiddlers.js
|
title: $:/core/modules/commands/rendertiddlers.js
|
||||||
type: application/javascript
|
type: application/javascript
|
||||||
module-type: command
|
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");
|
var widget = require("$:/core/modules/widgets/widget.js");
|
||||||
|
|
||||||
exports.info = {
|
exports.info = {
|
||||||
name: "new_rendertiddlers",
|
name: "rendertiddlers",
|
||||||
synchronous: true
|
synchronous: true
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ Command.prototype.execute = function() {
|
|||||||
extension = this.params[4] || ".html",
|
extension = this.params[4] || ".html",
|
||||||
tiddlers = wiki.filterTiddlers(filter);
|
tiddlers = wiki.filterTiddlers(filter);
|
||||||
$tw.utils.each(tiddlers,function(title) {
|
$tw.utils.each(tiddlers,function(title) {
|
||||||
var parser = wiki.new_parseTiddler(template),
|
var parser = wiki.parseTiddler(template),
|
||||||
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
|
widgetNode = wiki.makeWidget(parser,{variables: {currentTiddler: title}});
|
||||||
var container = $tw.document.createElement("div");
|
var container = $tw.document.createElement("div");
|
||||||
widgetNode.render(container,null);
|
widgetNode.render(container,null);
|
||||||
|
@ -147,7 +147,7 @@ var Command = function(params,commander,callback) {
|
|||||||
path: /^\/$/,
|
path: /^\/$/,
|
||||||
handler: function(request,response,state) {
|
handler: function(request,response,state) {
|
||||||
response.writeHead(200, {"Content-Type": state.server.get("serveType")});
|
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");
|
response.end(text,"utf8");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -59,7 +59,7 @@ exports.parse = function() {
|
|||||||
this.parser.pos = this.parser.sourceLength;
|
this.parser.pos = this.parser.sourceLength;
|
||||||
}
|
}
|
||||||
// Parse the block according to the specified type
|
// 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 there's no render type, just return the parse tree
|
||||||
if(!renderType) {
|
if(!renderType) {
|
||||||
return parser.tree;
|
return parser.tree;
|
||||||
|
@ -106,7 +106,7 @@ exports.startup = function() {
|
|||||||
});
|
});
|
||||||
// Display the PageMacros, which includes the PageTemplate
|
// Display the PageMacros, which includes the PageTemplate
|
||||||
var templateTitle = "$:/core/ui/PageMacros",
|
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.pageWidgetNode = $tw.wiki.makeWidget(parser,{document: document, parentWidget: $tw.rootWidget});
|
||||||
$tw.pageContainer = document.createElement("div");
|
$tw.pageContainer = document.createElement("div");
|
||||||
$tw.utils.addClass($tw.pageContainer,"tw-page-container");
|
$tw.utils.addClass($tw.pageContainer,"tw-page-container");
|
||||||
|
@ -73,14 +73,14 @@ Modal.prototype.display = function(title,options) {
|
|||||||
} else {
|
} else {
|
||||||
titleText = title;
|
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 = this.wiki.makeWidget(headerParser,{parentWidget: $tw.rootWidget, document: document});
|
||||||
headerWidgetNode.render(headerTitle,null);
|
headerWidgetNode.render(headerTitle,null);
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
headerWidgetNode.refresh(changes,modalHeader,null);
|
headerWidgetNode.refresh(changes,modalHeader,null);
|
||||||
});
|
});
|
||||||
// Render the body of the message
|
// 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 = this.wiki.makeWidget(bodyParser,{parentWidget: $tw.rootWidget, document: document});
|
||||||
bodyWidgetNode.render(modalBody,null);
|
bodyWidgetNode.render(modalBody,null);
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
@ -107,7 +107,7 @@ Modal.prototype.display = function(title,options) {
|
|||||||
} else {
|
} else {
|
||||||
footerText = '<$button message="tw-close-tiddler" class="btn btn-primary">Close</$button>';
|
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 = this.wiki.makeWidget(footerParser,{parentWidget: $tw.rootWidget, document: document});
|
||||||
footerWidgetNode.render(modalFooterButtons,null);
|
footerWidgetNode.render(modalFooterButtons,null);
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
|
@ -37,7 +37,7 @@ Notifier.prototype.display = function(title,options) {
|
|||||||
// Add classes
|
// Add classes
|
||||||
$tw.utils.addClass(notification,"tw-notification");
|
$tw.utils.addClass(notification,"tw-notification");
|
||||||
// Render the body of the 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 = this.wiki.makeWidget(parser,{parentWidget: $tw.rootWidget, document: document});
|
||||||
widgetNode.render(notification,null);
|
widgetNode.render(notification,null);
|
||||||
this.wiki.addEventListener("change",function(changes) {
|
this.wiki.addEventListener("change",function(changes) {
|
||||||
|
@ -34,7 +34,7 @@ StylesheetManager.prototype.addStylesheet = function(title) {
|
|||||||
// Record the stylesheet in the hashmap
|
// Record the stylesheet in the hashmap
|
||||||
this.stylesheets[title] = true;
|
this.stylesheets[title] = true;
|
||||||
// Parse the tiddler and render as plain text
|
// 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
|
// Create a style element and put it in the document
|
||||||
var styleNode = document.createElement("style");
|
var styleNode = document.createElement("style");
|
||||||
styleNode.setAttribute("type","text/css");
|
styleNode.setAttribute("type","text/css");
|
||||||
|
@ -81,7 +81,7 @@ ListWidget.prototype.getTiddlerList = function() {
|
|||||||
|
|
||||||
ListWidget.prototype.getEmptyMessage = function() {
|
ListWidget.prototype.getEmptyMessage = function() {
|
||||||
var emptyMessage = this.getAttribute("emptyMessage",""),
|
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) {
|
if(parser) {
|
||||||
return parser.tree;
|
return parser.tree;
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,12 +53,12 @@ MacroCallWidget.prototype.execute = function() {
|
|||||||
// Are we rendering to HTML?
|
// Are we rendering to HTML?
|
||||||
if(this.renderOutput === "text/html") {
|
if(this.renderOutput === "text/html") {
|
||||||
// If so we'll return the parsed macro
|
// 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});
|
{parseAsInline: !this.parseTreeNode.isBlock});
|
||||||
parseTreeNodes = parser ? parser.tree : [];
|
parseTreeNodes = parser ? parser.tree : [];
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, we'll render the text
|
// 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}];
|
parseTreeNodes = [{type: "text", text: plainText}];
|
||||||
}
|
}
|
||||||
// Construct the child widgets
|
// Construct the child widgets
|
||||||
|
@ -50,7 +50,7 @@ TranscludeWidget.prototype.execute = function() {
|
|||||||
// Set context variables for recursion detection
|
// Set context variables for recursion detection
|
||||||
this.setVariable("transclusion",recursionMarker);
|
this.setVariable("transclusion",recursionMarker);
|
||||||
// Parse the text reference
|
// Parse the text reference
|
||||||
var parser = this.wiki.new_parseTextReference(
|
var parser = this.wiki.parseTextReference(
|
||||||
this.transcludeTitle,
|
this.transcludeTitle,
|
||||||
this.transcludeField,
|
this.transcludeField,
|
||||||
this.transcludeIndex,
|
this.transcludeIndex,
|
||||||
|
@ -121,7 +121,7 @@ ViewWidget.prototype.getValueAsText = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
ViewWidget.prototype.getValueAsHtmlWikified = 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() {
|
ViewWidget.prototype.getValueAsHtmlEncoded = function() {
|
||||||
|
@ -218,7 +218,7 @@ Widget.prototype.computeAttributes = function() {
|
|||||||
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler"));
|
value = self.wiki.getTextReference(attribute.textReference,"",self.getVariable("currentTiddler"));
|
||||||
} else if(attribute.type === "macro") {
|
} else if(attribute.type === "macro") {
|
||||||
var text = self.getVariable(attribute.value.name,{params: attribute.value.params});
|
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
|
} else { // String attribute
|
||||||
value = attribute.value;
|
value = attribute.value;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ exports.getTiddlerLinks = function(title) {
|
|||||||
// We'll cache the links so they only get computed if the tiddler changes
|
// We'll cache the links so they only get computed if the tiddler changes
|
||||||
return this.getCacheForTiddler(title,"links",function() {
|
return this.getCacheForTiddler(title,"links",function() {
|
||||||
// Parse the tiddler
|
// Parse the tiddler
|
||||||
var parser = self.new_parseTiddler(title);
|
var parser = self.parseTiddler(title);
|
||||||
// Count up the links
|
// Count up the links
|
||||||
var links = [],
|
var links = [],
|
||||||
checkParseTree = function(parseTree) {
|
checkParseTree = function(parseTree) {
|
||||||
@ -672,7 +672,7 @@ var tweakParser = function(parser) {
|
|||||||
tweakParseTreeNodes(parser.tree);
|
tweakParseTreeNodes(parser.tree);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.new_parseText = function(type,text,options) {
|
exports.parseText = function(type,text,options) {
|
||||||
var parser = this.old_parseText(type,text,options);
|
var parser = this.old_parseText(type,text,options);
|
||||||
if(parser) {
|
if(parser) {
|
||||||
tweakParser(parser)
|
tweakParser(parser)
|
||||||
@ -680,7 +680,7 @@ exports.new_parseText = function(type,text,options) {
|
|||||||
return parser;
|
return parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.new_parseTiddler = function(title,options) {
|
exports.parseTiddler = function(title,options) {
|
||||||
var parser = this.old_parseTiddler(title,options);
|
var parser = this.old_parseTiddler(title,options);
|
||||||
if(parser) {
|
if(parser) {
|
||||||
tweakParser(parser)
|
tweakParser(parser)
|
||||||
@ -688,9 +688,9 @@ exports.new_parseTiddler = function(title,options) {
|
|||||||
return parser;
|
return parser;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.new_parseTextReference = function(title,field,index,options) {
|
exports.parseTextReference = function(title,field,index,options) {
|
||||||
if(field === "text" || (!field && !index)) {
|
if(field === "text" || (!field && !index)) {
|
||||||
return this.new_parseTiddler(title,options);
|
return this.parseTiddler(title,options);
|
||||||
} else {
|
} else {
|
||||||
var tiddler,text;
|
var tiddler,text;
|
||||||
if(field) {
|
if(field) {
|
||||||
@ -699,10 +699,10 @@ exports.new_parseTextReference = function(title,field,index,options) {
|
|||||||
if(text === undefined) {
|
if(text === undefined) {
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
return this.new_parseText("text/vnd.tiddlywiki",text,options);
|
return this.parseText("text/vnd.tiddlywiki",text,options);
|
||||||
} else if(index) {
|
} else if(index) {
|
||||||
text = this.extractTiddlerDataItem(title,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
|
variables: hashmap of variables to set
|
||||||
parentWidget: optional parent widget for the root node
|
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 || {};
|
options = options || {};
|
||||||
var parser = $tw.wiki.new_parseText(textType,text),
|
var parser = $tw.wiki.parseText(textType,text),
|
||||||
widgetNode = this.makeWidget(parser,options);
|
widgetNode = this.makeWidget(parser,options);
|
||||||
var container = $tw.document.createElement("div");
|
var container = $tw.document.createElement("div");
|
||||||
widgetNode.render(container,null);
|
widgetNode.render(container,null);
|
||||||
@ -774,9 +774,9 @@ Options include:
|
|||||||
variables: hashmap of variables to set
|
variables: hashmap of variables to set
|
||||||
parentWidget: optional parent widget for the root node
|
parentWidget: optional parent widget for the root node
|
||||||
*/
|
*/
|
||||||
exports.new_renderTiddler = function(outputType,title,options) {
|
exports.renderTiddler = function(outputType,title,options) {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var parser = this.new_parseTiddler(title),
|
var parser = this.parseTiddler(title),
|
||||||
widgetNode = this.makeWidget(parser,options);
|
widgetNode = this.makeWidget(parser,options);
|
||||||
var container = $tw.document.createElement("div");
|
var container = $tw.document.createElement("div");
|
||||||
widgetNode.render(container,null);
|
widgetNode.render(container,null);
|
||||||
@ -832,7 +832,7 @@ exports.saveWiki = function(options) {
|
|||||||
options = options || {};
|
options = options || {};
|
||||||
var template = options.template || "$:/core/templates/tiddlywiki5.template.html",
|
var template = options.template || "$:/core/templates/tiddlywiki5.template.html",
|
||||||
downloadType = options.downloadType || "text/plain";
|
downloadType = options.downloadType || "text/plain";
|
||||||
var text = this.new_renderTiddler(downloadType,template);
|
var text = this.renderTiddler(downloadType,template);
|
||||||
this.callSaver("save",text,function(err) {
|
this.callSaver("save",text,function(err) {
|
||||||
$tw.notifier.display("$:/messages/Saved");
|
$tw.notifier.display("$:/messages/Saved");
|
||||||
});
|
});
|
||||||
|
@ -25,7 +25,7 @@ describe("Widget module", function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parseText(text,wiki,options) {
|
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;
|
return parser ? {type: "widget", children: parser.tree} : undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe("WikiText parser tests", function() {
|
|||||||
|
|
||||||
// Define a parsing shortcut
|
// Define a parsing shortcut
|
||||||
var parse = function(text) {
|
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() {
|
it("should parse tags", function() {
|
||||||
|
@ -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>"});
|
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() {
|
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() {
|
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() {
|
it("should use double new lines to create paragraphs", function() {
|
||||||
// The paragraphs are lost in the conversion to plain text
|
// 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() {
|
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() {
|
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() {
|
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() {
|
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>");
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
4
ginsu.sh
4
ginsu.sh
@ -9,6 +9,6 @@ node ./tiddlywiki.js \
|
|||||||
./editions/empty \
|
./editions/empty \
|
||||||
--verbose \
|
--verbose \
|
||||||
--load $1 \
|
--load $1 \
|
||||||
--new_rendertiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
|
--rendertiddler $:/core/templates/split-recipe tmp/ginsu/split.recipe text/plain \
|
||||||
--new_rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
|
--rendertiddlers [!is[system]] $:/core/templates/tid-tiddler tmp/ginsu text/plain .tid \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
@ -152,7 +152,7 @@ FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
|||||||
if(err) {
|
if(err) {
|
||||||
return callback(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) {
|
fs.writeFile(fileInfo.filepath + ".meta",content,{encoding: "utf8"},function (err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
@ -164,7 +164,7 @@ console.log("FileSystem: Saved file",fileInfo.filepath);
|
|||||||
} else {
|
} else {
|
||||||
// Save the tiddler as a self contained templated file
|
// Save the tiddler as a self contained templated file
|
||||||
template = $tw.config.typeTemplates[fileInfo.type];
|
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) {
|
fs.writeFile(fileInfo.filepath,content,{encoding: "utf8"},function (err) {
|
||||||
if(err) {
|
if(err) {
|
||||||
return callback(err);
|
return callback(err);
|
||||||
|
2
test.sh
2
test.sh
@ -20,5 +20,5 @@ echo "Using TW5_BUILD_OUTPUT as [$TW5_BUILD_OUTPUT]"
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
./editions/test \
|
./editions/test \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
2
wbld.sh
2
wbld.sh
@ -15,7 +15,7 @@ mkdir -p tmp
|
|||||||
node ./tiddlywiki.js \
|
node ./tiddlywiki.js \
|
||||||
editions/tw5tiddlyweb \
|
editions/tw5tiddlyweb \
|
||||||
--verbose \
|
--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
|
|| exit 1
|
||||||
|
|
||||||
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file
|
# Prepend the type information that TiddlyWeb needs to turn the .html file into a .tid file
|
||||||
|
Loading…
Reference in New Issue
Block a user