mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-23 10:07:19 +00:00
Getting selective refresh working
A bunch of changes, and we're halfway there
This commit is contained in:
parent
0d9a94e702
commit
dad7756f65
15
js/App.js
15
js/App.js
@ -109,24 +109,19 @@ var App = function() {
|
||||
navigators.install("a","StoryNavigator");
|
||||
// Open the PageTemplate
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = this.store.renderMacro("tiddler",
|
||||
"text/html",
|
||||
this.store.getTiddler("PageTemplate"),
|
||||
{
|
||||
target: "PageTemplate"
|
||||
});
|
||||
div.innerHTML = this.store.renderTiddler("text/html","PageTemplate");
|
||||
document.body.appendChild(div);
|
||||
// Set up a timer to change the value of a tiddler
|
||||
var me = this;
|
||||
window.setInterval(function() {
|
||||
me.store.addTiddler(new Tiddler({
|
||||
title: "TiddlyWiki5",
|
||||
text: "This is a newly created tiddler!"
|
||||
title: "HelloThere",
|
||||
text: "This tiddler is growing\n" + me.store.getTiddlerText("HelloThere")
|
||||
}));
|
||||
},3000);
|
||||
// Register an event handler to handle refreshing the DOM
|
||||
this.store.addEventListener("",function() {
|
||||
me.store.refreshDomNode(div,me.store.getTiddler("PageTemplate"));
|
||||
this.store.addEventListener("",function(changes) {
|
||||
me.store.refreshDomNode(div,changes);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -276,11 +276,8 @@ utils.stitchElement = function(element,attributes,options) {
|
||||
if(options.classNames) {
|
||||
output.push(" class='",options.classNames.join(" "),"'");
|
||||
}
|
||||
if(options.selfClosing) {
|
||||
output.push(" /");
|
||||
}
|
||||
output.push(">");
|
||||
if(options.content) {
|
||||
if("content" in options) {
|
||||
output.push(options.content);
|
||||
output.push("</",element,">");
|
||||
}
|
||||
|
107
js/WikiStore.js
107
js/WikiStore.js
@ -85,16 +85,6 @@ If the tiddler is already marked "deleted",
|
||||
|
||||
*/
|
||||
WikiStore.prototype.touchTiddler = function(type,title) {
|
||||
var existingType = this.changedTiddlers[title];
|
||||
if(existingType === undefined && type === "modified") {
|
||||
type = "created";
|
||||
}
|
||||
if(existingType === "modified" && type === "created") {
|
||||
type = "modified";
|
||||
}
|
||||
if(existingType === "deleted" && type === "created") {
|
||||
type = "modified";
|
||||
}
|
||||
this.changedTiddlers[title] = type;
|
||||
this.triggerEvents();
|
||||
};
|
||||
@ -149,8 +139,10 @@ WikiStore.prototype.tiddlerExists = function(title) {
|
||||
};
|
||||
|
||||
WikiStore.prototype.addTiddler = function(tiddler) {
|
||||
var status = tiddler.title in this.tiddlers ? "modified" : "created";
|
||||
this.clearCache(tiddler.title);
|
||||
this.tiddlers[tiddler.title] = tiddler;
|
||||
this.touchTiddler("modified",tiddler.title);
|
||||
this.touchTiddler(status,tiddler.title);
|
||||
};
|
||||
|
||||
WikiStore.prototype.forEachTiddler = function(/* [sortField,[excludeTag,]]callback */) {
|
||||
@ -279,6 +271,13 @@ WikiStore.prototype.getCacheForTiddler = function(title,cacheName,initializer) {
|
||||
}
|
||||
};
|
||||
|
||||
// Clear all caches associated with a particular tiddler
|
||||
WikiStore.prototype.clearCache = function(title) {
|
||||
if(title in this.caches) {
|
||||
delete this.caches[title];
|
||||
}
|
||||
};
|
||||
|
||||
WikiStore.prototype.parseText = function(type,text) {
|
||||
var parser = this.parsers[type];
|
||||
if(!parser) {
|
||||
@ -341,8 +340,10 @@ Render a tiddler to a particular MIME type. Optionally render it with a differen
|
||||
as the context. This option is used to render a tiddler through a template eg
|
||||
store.renderTiddler("text/html",templateTitle,tiddlerTitle)
|
||||
*/
|
||||
WikiStore.prototype.renderTiddler = function(targetType,title,asTitle) {
|
||||
var tiddler = this.getTiddler(title),
|
||||
WikiStore.prototype.renderTiddler = function(targetType,title,asTitle,options) {
|
||||
options = options || {};
|
||||
var stitcher = ((targetType === "text/html") && !options.noWrap) ? utils.stitchElement : function(a,b,c) {return c.content;},
|
||||
tiddler = this.getTiddler(title),
|
||||
renderer = this.compileTiddler(title,targetType),
|
||||
renditions = this.getCacheForTiddler(title,"renditions",function() {
|
||||
return {};
|
||||
@ -350,12 +351,21 @@ WikiStore.prototype.renderTiddler = function(targetType,title,asTitle) {
|
||||
if(tiddler) {
|
||||
if(asTitle) {
|
||||
var asTiddler = this.getTiddler(asTitle);
|
||||
return renderer.render(asTiddler,this);
|
||||
return stitcher("div",{
|
||||
"data-tw-render-tiddler": title,
|
||||
"data-tw-render-as": asTitle
|
||||
},{
|
||||
content: renderer.render(asTiddler,this)
|
||||
});
|
||||
} else {
|
||||
if(!renditions[targetType]) {
|
||||
renditions[targetType] = renderer.render(tiddler,this);
|
||||
}
|
||||
return renditions[targetType];
|
||||
return stitcher("div",{
|
||||
"data-tw-render-tiddler": title
|
||||
},{
|
||||
content: renditions[targetType]
|
||||
});
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -367,48 +377,47 @@ Executes a macro and returns the result
|
||||
WikiStore.prototype.renderMacro = function(macroName,targetType,tiddler,params,content) {
|
||||
var macro = this.macros[macroName];
|
||||
if(macro) {
|
||||
var wrapperTag = macro.wrapperTag || "div";
|
||||
return utils.stitchElement(wrapperTag,{
|
||||
"data-tw-macro": macroName,
|
||||
"data-tw-render-tiddler": tiddler.title
|
||||
},{
|
||||
content: macro.handler(targetType,tiddler,this,params,content)
|
||||
});
|
||||
return macro.handler(targetType,tiddler,this,params,content);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Refresh a DOM node so that it reflects the current state of the store
|
||||
|
||||
The refresh processing is:
|
||||
|
||||
1. If the node is a link, check the link classes correctly reflect the status of the target tiddler. Recursively process any children. Exit
|
||||
2. If the node is a macro, and dependencies have changed, re-render the macro into the DOM node. Exit
|
||||
3. If the node is a macro and the dependencies haven't changed, recursively process each child node of the macro. Exit
|
||||
|
||||
Arguments
|
||||
node - the DOM node to be processed
|
||||
tiddler - the tiddler providing context for the rendering
|
||||
|
||||
Refresh a DOM node and it's children so that it reflects the current state of the store
|
||||
node: reference to the DOM node to be refreshed
|
||||
changes: hashmap of {title: "created|modified|deleted"}
|
||||
*/
|
||||
WikiStore.prototype.refreshDomNode = function(node,tiddler) {
|
||||
// Process macros
|
||||
var macro = node.getAttribute && node.getAttribute("data-tw-macro"),
|
||||
params = node.getAttribute && node.getAttribute("data-tw-params");
|
||||
if(macro && params) {
|
||||
}
|
||||
// Process children
|
||||
if(node.hasChildNodes()) {
|
||||
this.refreshDomChildren(node,tiddler);
|
||||
}
|
||||
};
|
||||
WikiStore.prototype.refreshDomNode = function(node,changes) {
|
||||
var me = this,
|
||||
refreshChildNodes = function(node) {
|
||||
if(node.hasChildNodes()) {
|
||||
for(var c=0; c<node.childNodes.length; c++) {
|
||||
me.refreshDomNode(node.childNodes[c],changes);
|
||||
}
|
||||
}
|
||||
};
|
||||
// Get all the various attributes we need
|
||||
var renderTiddler = node.getAttribute ? node.getAttribute("data-tw-render-tiddler") : null,
|
||||
renderAs = node.getAttribute ? node.getAttribute("data-tw-render-as") : null,
|
||||
macro = node.getAttribute ? node.getAttribute("data-tw-macro") : null,
|
||||
renderStep = node.getAttribute ? node.getAttribute("data-tw-render-step") : null;
|
||||
// Is this node the rendering of a tiddler?
|
||||
if(renderTiddler !== null) {
|
||||
// Rerender the content of the node if the tiddler being rendered has changed
|
||||
if((renderTiddler in changes) || (renderAs && renderAs in changes)) {
|
||||
node.innerHTML = this.renderTiddler("text/html",renderTiddler,renderAs,{noWrap: true});
|
||||
} else {
|
||||
// If it hasn't changed, just refresh the child nodes
|
||||
refreshChildNodes(node);
|
||||
}
|
||||
|
||||
WikiStore.prototype.refreshDomChildren = function(node,tiddler) {
|
||||
var nodes = node.childNodes;
|
||||
for(var c=0; c<nodes.length; c++) {
|
||||
this.refreshDomNode(nodes[c],tiddler);
|
||||
// Is this node a macro
|
||||
} else if(macro !== null) {
|
||||
refreshChildNodes(node);
|
||||
// If it's not a macro or a tiddler rendering, just process any child nodes
|
||||
} else {
|
||||
refreshChildNodes(node);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -178,10 +178,10 @@ WikiTextParseTree.prototype.compileMacroCall = function(output,renderer,type,nod
|
||||
renderStep.handler = eval(this.store.jsParser.createTree(macroCall).render());
|
||||
var wrapperTag = macro.wrapperTag || "div";
|
||||
if(type === "text/html") {
|
||||
pushString(output,"<" + wrapperTag +
|
||||
" data-tw-macro='" + name + "' data-tw-render-step='" + renderStepIndex + "' data-tw-render-tiddler='");
|
||||
output.push({type: "PropertyAccess", name: "title", base: {type: "Variable", name: "tiddler"}});
|
||||
pushString(output,"'>");
|
||||
pushString(output,utils.stitchElement(wrapperTag,{
|
||||
"data-tw-macro": name,
|
||||
"data-tw-render-step": renderStepIndex
|
||||
}));
|
||||
}
|
||||
output.push({
|
||||
type: "FunctionCall",
|
||||
@ -343,7 +343,6 @@ WikiTextParseTree.prototype.toString = function(type) {
|
||||
if(node.children) {
|
||||
utils.renderObject(output,type,node.children,customTemplates);
|
||||
}
|
||||
output.push("</span>");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -377,6 +376,7 @@ WikiTextParseTree.prototype.toString = function(type) {
|
||||
classNames: ["splitLabelRight"]
|
||||
}));
|
||||
}
|
||||
output.push("</span>");
|
||||
}
|
||||
if(node.children) {
|
||||
utils.renderObject(output,type,node.children,customTemplates);
|
||||
|
@ -24,19 +24,9 @@ exports.macro = {
|
||||
var title = tiddlers[t].trim();
|
||||
if(title !== "") {
|
||||
if(params.template) {
|
||||
output.push(store.renderMacro("tiddler",
|
||||
type,
|
||||
store.getTiddler(title),
|
||||
{
|
||||
target: params.template
|
||||
}));
|
||||
output.push(store.renderTiddler(type,params.template,title));
|
||||
} else {
|
||||
output.push(store.renderMacro("tiddler",
|
||||
type,
|
||||
store.getTiddler(title),
|
||||
{
|
||||
target: title
|
||||
}));
|
||||
output.push(store.renderTiddler(type,title));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
readme.md
12
readme.md
@ -1,12 +1,12 @@
|
||||
<h1>Welcome to <span data-tw-macro='link' data-tw-render-step='1' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span></h1><div data-tw-macro='tiddler' data-tw-render-step='2' data-tw-render-tiddler='ReadMe'>Welcome to <span data-tw-macro='link' data-tw-render-step='1' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span>, an interactive wiki written in <span data-tw-macro='link' data-tw-render-step='2' data-tw-render-tiddler='ReadMe'><a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a></span> to run in the browser or under node.js. It is a reboot of <span data-tw-macro='link' data-tw-render-step='3' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> (<span data-tw-macro='link' data-tw-render-step='4' data-tw-render-tiddler='ReadMe'><a href='http://www.tiddlywiki.com/' class='tw-tiddlylink tw-tiddlylink-external'>http://www.tiddlywiki.com/</a></span>), the now venerable, reusable non-linear personal web notebook first released in 2004.<br /><br /><span data-tw-macro='link' data-tw-render-step='5' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> is based on the idea of making information more useful by modelling it in the smallest meaningful semantic units, referred to as "tiddlers". Structure comes from links, tags, and stories (sequences of tiddlers). Tiddlers use a wikitext notation that concisely represents a wide range of text formatting and hypertext features.<br /><br /><span data-tw-macro='link' data-tw-render-step='6' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> has earned an enduring place as a tool that people <span data-tw-macro='link' data-tw-render-step='7' data-tw-render-tiddler='ReadMe'><a href='Raves' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>love using</a></span> for its rich, interactive interface to <span data-tw-macro='link' data-tw-render-step='8' data-tw-render-tiddler='ReadMe'><a href='TiddlyWikiConcepts' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>manipulate complex data</a></span> with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors. Because people can use it without needing any complicated server infrastructure, and because it is <span data-tw-macro='link' data-tw-render-step='9' data-tw-render-tiddler='ReadMe'><a href='OpenSourceLicense' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>open source</a></span>, it has bought unprecedented freedom to people to keep their precious information under their own control. <span data-tw-macro='link' data-tw-render-step='10' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> was originally created by <span data-tw-macro='link' data-tw-render-step='11' data-tw-render-tiddler='ReadMe'><a href='JeremyRuston' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JeremyRuston</a></span> and is now a thriving <span data-tw-macro='link' data-tw-render-step='12' data-tw-render-tiddler='ReadMe'><a href='OpenSourceLicense' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>open source</a></span> project with a busy <span data-tw-macro='link' data-tw-render-step='13' data-tw-render-tiddler='ReadMe'><a href='Community' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>Community</a></span> of independent developers.<br /></div><br /><h1>Usage</h1><div data-tw-macro='tiddler' data-tw-render-step='3' data-tw-render-tiddler='ReadMe'><span data-tw-macro='link' data-tw-render-step='1' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span> can be used on the command line to perform an extensive set of operations based on <span data-tw-macro='link' data-tw-render-step='2' data-tw-render-tiddler='ReadMe'><a href='RecipeFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>RecipeFiles</a></span>, <span data-tw-macro='link' data-tw-render-step='3' data-tw-render-tiddler='ReadMe'><a href='TiddlerFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlerFiles</a></span> and <span data-tw-macro='link' data-tw-render-step='4' data-tw-render-tiddler='ReadMe'><a href='TiddlyWikiFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWikiFiles</a></span>.<br /><br />Usage:<br /><code>
|
||||
<div data-tw-render-tiddler='ReadMe'><h1>Welcome to <span data-tw-macro='link' data-tw-render-step='1'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span></h1><div data-tw-macro='tiddler' data-tw-render-step='2'><div data-tw-render-tiddler='HelloThere' data-tw-render-as='ReadMe'>Welcome to <span data-tw-macro='link' data-tw-render-step='1'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span>, an interactive wiki written in <span data-tw-macro='link' data-tw-render-step='2'><a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a></span> to run in the browser or under node.js. It is a reboot of <span data-tw-macro='link' data-tw-render-step='3'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> (<span data-tw-macro='link' data-tw-render-step='4'><a href='http://www.tiddlywiki.com/' class='tw-tiddlylink tw-tiddlylink-external'>http://www.tiddlywiki.com/</a></span>), the now venerable, reusable non-linear personal web notebook first released in 2004.<br><br><span data-tw-macro='link' data-tw-render-step='5'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> is based on the idea of making information more useful by modelling it in the smallest meaningful semantic units, referred to as "tiddlers". Structure comes from links, tags, and stories (sequences of tiddlers). Tiddlers use a wikitext notation that concisely represents a wide range of text formatting and hypertext features.<br><br><span data-tw-macro='link' data-tw-render-step='6'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> has earned an enduring place as a tool that people <span data-tw-macro='link' data-tw-render-step='7'><a href='Raves' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>love using</a></span> for its rich, interactive interface to <span data-tw-macro='link' data-tw-render-step='8'><a href='TiddlyWikiConcepts' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>manipulate complex data</a></span> with structure that doesn't easily fit into conventional tools like spreadsheets or wordprocessors. Because people can use it without needing any complicated server infrastructure, and because it is <span data-tw-macro='link' data-tw-render-step='9'><a href='OpenSourceLicense' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>open source</a></span>, it has bought unprecedented freedom to people to keep their precious information under their own control. <span data-tw-macro='link' data-tw-render-step='10'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> was originally created by <span data-tw-macro='link' data-tw-render-step='11'><a href='JeremyRuston' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JeremyRuston</a></span> and is now a thriving <span data-tw-macro='link' data-tw-render-step='12'><a href='OpenSourceLicense' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>open source</a></span> project with a busy <span data-tw-macro='link' data-tw-render-step='13'><a href='Community' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>Community</a></span> of independent developers.<br></div></div><br><h1>Usage</h1><div data-tw-macro='tiddler' data-tw-render-step='3'><div data-tw-render-tiddler='CommandLineInterface' data-tw-render-as='ReadMe'><span data-tw-macro='link' data-tw-render-step='1'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span> can be used on the command line to perform an extensive set of operations based on <span data-tw-macro='link' data-tw-render-step='2'><a href='RecipeFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>RecipeFiles</a></span>, <span data-tw-macro='link' data-tw-render-step='3'><a href='TiddlerFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>TiddlerFiles</a></span> and <span data-tw-macro='link' data-tw-render-step='4'><a href='TiddlyWikiFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWikiFiles</a></span>.<br><br>Usage:<br><code>
|
||||
node tiddlywiki.js <options>
|
||||
</code><br />The command line options are processed sequentially from left to right. Processing pauses during long operations, like loading a <span data-tw-macro='link' data-tw-render-step='5' data-tw-render-tiddler='ReadMe'><a href='RecipeFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>recipe file</a></span> and all the subrecipes and <span data-tw-macro='link' data-tw-render-step='6' data-tw-render-tiddler='ReadMe'><a href='TiddlerFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>tiddlers</a></span> that it references. The following options are available:<br /><table class='twtable'><tbody><tr class='evenRow'><td align='left'><code>--recipe <filepath></code></td><td align='left'>Loads a specfied <code>.recipe</code> file</td></tr><tr class='oddRow'><td align='left'><code>--load <filepath></code></td><td align='left'>Load additional tiddlers from 2.x.x <span data-tw-macro='link' data-tw-render-step='7' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> files (<code>.html</code>), <code>.tiddler</code>, <code>.tid</code>, <code>.json</code> or other files</td></tr><tr class='evenRow'><td align='left'><code>--savewiki <dirpath></code></td><td align='left'>Saves all the loaded tiddlers as a single file <span data-tw-macro='link' data-tw-render-step='8' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> called <code>index.html</code> and an RSS feed called <code>index.xml</code> in a new directory of the specified name</td></tr><tr class='oddRow'><td align='left'><code>--savetiddler <title> <filename> [<type>]</code></td><td align='left'>Save an individual tiddler as a specified MIME type, defaults to <code>text/html</code></td></tr><tr class='evenRow'><td align='left'><code>--savetiddlers <outdir></code></td><td align='left'>Saves all the loaded tiddlers as <code>.tid</code> files in the specified directory</td></tr><tr class='oddRow'><td align='left'><code>--servewiki <port></code></td><td align='left'>Serve the cooked <span data-tw-macro='link' data-tw-render-step='9' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> over HTTP at <code>/</code></td></tr><tr class='evenRow'><td align='left'><code>--servetiddlers <port></code></td><td align='left'>Serve individual tiddlers over HTTP at <code>/tiddlertitle</code></td></tr><tr class='oddRow'><td align='left'><code>--wikitest <dir></code></td><td align='left'>Run wikification tests against the tiddlers in the given directory</td></tr><tr class='evenRow'><td align='left'><code>--dumpstore</code></td><td align='left'>Dump the <span data-tw-macro='link' data-tw-render-step='10' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> store in JSON format</td></tr><tr class='oddRow'><td align='left'><code>--dumprecipe</code></td><td align='left'>Dump the current recipe in JSON format</td></tr><tr class='evenRow'><td align='left'><code>--verbose</code></td><td align='left'>verbose output, useful for debugging</td></tr></tbody></table><h2> Examples</h2>This example loads the tiddlers from a <span data-tw-macro='link' data-tw-render-step='11' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> HTML file and makes them available over HTTP:<br /><code>
|
||||
</code><br>The command line options are processed sequentially from left to right. Processing pauses during long operations, like loading a <span data-tw-macro='link' data-tw-render-step='5'><a href='RecipeFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>recipe file</a></span> and all the subrecipes and <span data-tw-macro='link' data-tw-render-step='6'><a href='TiddlerFiles' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves'>tiddlers</a></span> that it references. The following options are available:<br><table class='twtable'><tbody><tr class='evenRow'><td align='left'><code>--recipe <filepath></code></td><td align='left'>Loads a specfied <code>.recipe</code> file</td></tr><tr class='oddRow'><td align='left'><code>--load <filepath></code></td><td align='left'>Load additional tiddlers from 2.x.x <span data-tw-macro='link' data-tw-render-step='7'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> files (<code>.html</code>), <code>.tiddler</code>, <code>.tid</code>, <code>.json</code> or other files</td></tr><tr class='evenRow'><td align='left'><code>--savewiki <dirpath></code></td><td align='left'>Saves all the loaded tiddlers as a single file <span data-tw-macro='link' data-tw-render-step='8'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> called <code>index.html</code> and an RSS feed called <code>index.xml</code> in a new directory of the specified name</td></tr><tr class='oddRow'><td align='left'><code>--savetiddler <title> <filename> [<type>]</code></td><td align='left'>Save an individual tiddler as a specified MIME type, defaults to <code>text/html</code></td></tr><tr class='evenRow'><td align='left'><code>--savetiddlers <outdir></code></td><td align='left'>Saves all the loaded tiddlers as <code>.tid</code> files in the specified directory</td></tr><tr class='oddRow'><td align='left'><code>--servewiki <port></code></td><td align='left'>Serve the cooked <span data-tw-macro='link' data-tw-render-step='9'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> over HTTP at <code>/</code></td></tr><tr class='evenRow'><td align='left'><code>--servetiddlers <port></code></td><td align='left'>Serve individual tiddlers over HTTP at <code>/tiddlertitle</code></td></tr><tr class='oddRow'><td align='left'><code>--wikitest <dir></code></td><td align='left'>Run wikification tests against the tiddlers in the given directory</td></tr><tr class='evenRow'><td align='left'><code>--dumpstore</code></td><td align='left'>Dump the <span data-tw-macro='link' data-tw-render-step='10'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> store in JSON format</td></tr><tr class='oddRow'><td align='left'><code>--dumprecipe</code></td><td align='left'>Dump the current recipe in JSON format</td></tr><tr class='evenRow'><td align='left'><code>--verbose</code></td><td align='left'>verbose output, useful for debugging</td></tr></tbody></table><h2> Examples</h2>This example loads the tiddlers from a <span data-tw-macro='link' data-tw-render-step='11'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> HTML file and makes them available over HTTP:<br><code>
|
||||
node tiddlywiki.js --load mywiki.html --servewiki 127.0.0.1:8000
|
||||
</code><br />This example cooks a <span data-tw-macro='link' data-tw-render-step='12' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> from a recipe:<br /><code>
|
||||
</code><br>This example cooks a <span data-tw-macro='link' data-tw-render-step='12'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> from a recipe:<br><code>
|
||||
node tiddlywiki.js --recipe tiddlywiki.com/index.recipe --savewiki tmp/
|
||||
</code><br />This example ginsus a <span data-tw-macro='link' data-tw-render-step='13' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> into its constituent tiddlers:<br /><code>
|
||||
</code><br>This example ginsus a <span data-tw-macro='link' data-tw-render-step='13'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> into its constituent tiddlers:<br><code>
|
||||
node tiddlywiki.js --load mywiki.html --savetiddlers tmp/tiddlers
|
||||
</code><br /><h2> Notes</h2><code>--servewiki</code> and <code>--servertiddlers</code> are for different purposes and should not be used together. The former is for <span data-tw-macro='link' data-tw-render-step='14' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> core developers who want to be able to edit the <span data-tw-macro='link' data-tw-render-step='15' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> source files in a text editor and view the results in the browser by clicking refresh; it is slow because it reloads all the <span data-tw-macro='link' data-tw-render-step='16' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> <span data-tw-macro='link' data-tw-render-step='17' data-tw-render-tiddler='ReadMe'><a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a></span> files each time the page is loaded. The latter is for experimenting with the new wikification engine.<br /><br /><code>--wikitest</code> looks for <code>*.tid</code> files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the <code>*.html</code> and <code>*.txt</code> files in the same directory.</div><br /><h1>Testing</h1><div data-tw-macro='tiddler' data-tw-render-step='4' data-tw-render-tiddler='ReadMe'><code>test.sh</code> contains a simple test script that cooks the main tiddlywiki.com recipe and compares it with the results of the old build process (ie, running cook.rb and then opening the file in a browser and performing a 'save changes' operation). It also runs a series of wikifications tests that work off the data in <code>test/wikitests/</code>.</div><br /><h1>Planned <span data-tw-macro='link' data-tw-render-step='5' data-tw-render-tiddler='ReadMe'><a href='WikiText' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiText</a></span> Features</h1><div data-tw-macro='tiddler' data-tw-render-step='6' data-tw-render-tiddler='ReadMe'>It is proposed to extend the existing <span data-tw-macro='link' data-tw-render-step='1' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> wikitext syntax with the following extensions<br /><br /><ol><li> Addition of <code>**bold**</code> character formatting</li><li> Addition of <code>`backtick for code`</code> character formatting</li><li> Addition of <span data-tw-macro='link' data-tw-render-step='2' data-tw-render-tiddler='ReadMe'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> forced line break, e.g. <code>force\\linebreak</code></li><li> Addition of <span data-tw-macro='link' data-tw-render-step='3' data-tw-render-tiddler='ReadMe'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> headings, e.g. <code>==Heading</code></li><li> Addition of <span data-tw-macro='link' data-tw-render-step='4' data-tw-render-tiddler='ReadMe'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> headings in tables, e.g. <code>|=|=table|=header|</code></li><li> Addition of white-listed HTML tags intermixed with wikitext</li><li> Addition of <span data-tw-macro='link' data-tw-render-step='5' data-tw-render-tiddler='ReadMe'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> pretty links, e.g. <code>[[description -> link]]</code></li><li> Addition of multiline macros, e.g.</li></ol><pre><<myMacro
|
||||
</code><br><h2> Notes</h2><code>--servewiki</code> and <code>--servertiddlers</code> are for different purposes and should not be used together. The former is for <span data-tw-macro='link' data-tw-render-step='14'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> core developers who want to be able to edit the <span data-tw-macro='link' data-tw-render-step='15'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> source files in a text editor and view the results in the browser by clicking refresh; it is slow because it reloads all the <span data-tw-macro='link' data-tw-render-step='16'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> <span data-tw-macro='link' data-tw-render-step='17'><a href='JavaScript' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>JavaScript</a></span> files each time the page is loaded. The latter is for experimenting with the new wikification engine.<br><br><code>--wikitest</code> looks for <code>*.tid</code> files in the specified folder. It then wikifies the tiddlers to both "text/plain" and "text/html" format and checks the results against the content of the <code>*.html</code> and <code>*.txt</code> files in the same directory.</div></div><br><h1>Testing</h1><div data-tw-macro='tiddler' data-tw-render-step='4'><div data-tw-render-tiddler='Testing' data-tw-render-as='ReadMe'><code>test.sh</code> contains a simple test script that cooks the main tiddlywiki.com recipe and compares it with the results of the old build process (ie, running cook.rb and then opening the file in a browser and performing a 'save changes' operation). It also runs a series of wikifications tests that work off the data in <code>test/wikitests/</code>.</div></div><br><h1>Planned <span data-tw-macro='link' data-tw-render-step='5'><a href='WikiText' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiText</a></span> Features</h1><div data-tw-macro='tiddler' data-tw-render-step='6'><div data-tw-render-tiddler='NewWikiTextFeatures' data-tw-render-as='ReadMe'>It is proposed to extend the existing <span data-tw-macro='link' data-tw-render-step='1'><a href='TiddlyWiki' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki</a></span> wikitext syntax with the following extensions<br><br><ol><li> Addition of <code>**bold**</code> character formatting</li><li> Addition of <code>`backtick for code`</code> character formatting</li><li> Addition of <span data-tw-macro='link' data-tw-render-step='2'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> forced line break, e.g. <code>force\\linebreak</code></li><li> Addition of <span data-tw-macro='link' data-tw-render-step='3'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> headings, e.g. <code>==Heading</code></li><li> Addition of <span data-tw-macro='link' data-tw-render-step='4'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> headings in tables, e.g. <code>|=|=table|=header|</code></li><li> Addition of white-listed HTML tags intermixed with wikitext</li><li> Addition of <span data-tw-macro='link' data-tw-render-step='5'><a href='WikiCreole-style' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>WikiCreole-style</a></span> pretty links, e.g. <code>[[description -> link]]</code></li><li> Addition of multiline macros, e.g.</li></ol><pre><<myMacro
|
||||
param1: Parameter value
|
||||
param2: value
|
||||
"unnamed parameter"
|
||||
@ -15,4 +15,4 @@ A multiline parameter that can go on for as long as it likes
|
||||
and contain linebreaks.
|
||||
))
|
||||
>>
|
||||
</pre></div><br /><br /><em>This <code>readme</code> file was automatically generated by <span data-tw-macro='link' data-tw-render-step='7' data-tw-render-tiddler='ReadMe'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span></em><br />
|
||||
</pre></div></div><br><br><em>This <code>readme</code> file was automatically generated by <span data-tw-macro='link' data-tw-render-step='7'><a href='TiddlyWiki5' class='tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing'>TiddlyWiki5</a></span></em><br></div>
|
Loading…
Reference in New Issue
Block a user