mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-28 02:50:27 +00:00
Renamed 'handler' member of macros
Used to be called "code". And associated documentation changes
This commit is contained in:
parent
58bd8744e9
commit
e2a0955ced
@ -104,7 +104,7 @@ WikiTextParseTree.prototype.compileMacroCall = function(type,name,params) {
|
||||
"type": "StringLiteral",
|
||||
"value": name},
|
||||
"type": "PropertyAccess"},
|
||||
"name": "code",
|
||||
"name": "handler",
|
||||
"type": "PropertyAccess"},
|
||||
"arguments": [ {
|
||||
"type": "StringLiteral",
|
||||
|
@ -15,7 +15,7 @@ exports.macro = {
|
||||
params: {
|
||||
text: {byPos: 0, type: "text", optional: false}
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
if(type === "text/html") {
|
||||
return utils.htmlEncode(params.text);
|
||||
} else {
|
||||
|
@ -14,7 +14,7 @@ exports.macro = {
|
||||
types: ["text/html","text/plain"],
|
||||
params: {
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
var encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;},
|
||||
parseTree = store.parseTiddler(tiddler.fields.title);
|
||||
if(parseTree) {
|
||||
|
@ -41,7 +41,7 @@ exports.macro = {
|
||||
template: {byName: true, type: "tiddler", optional: true},
|
||||
emptyMessage: {byName: true, type: "text", optional: true}
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
var templateType = "text/x-tiddlywiki",
|
||||
templateText = "<<view title link>>",
|
||||
template = params.template ? store.getTiddler(params.template) : null,
|
||||
|
@ -16,7 +16,7 @@ exports.macro = {
|
||||
story: {byName: "default", type: "text", optional: false},
|
||||
template: {byName: true, type: "text", optional: true}
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
var tiddlers = store.getTiddlerText(params.story).split("\n"),
|
||||
t,
|
||||
output = [];
|
||||
|
@ -17,7 +17,7 @@ exports.macro = {
|
||||
target: {byName: "default", type: "tiddler", optional: false},
|
||||
"with": {byName: true, type: "text", optional: true, dependentAll: true}
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
if(params["with"]) {
|
||||
// Parameterised transclusion
|
||||
var targetTiddler = store.getTiddler(params.target),
|
||||
|
@ -14,7 +14,7 @@ exports.macro = {
|
||||
types: ["text/html","text/plain"],
|
||||
params: {
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
return "5.0.0";
|
||||
}
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ exports.macro = {
|
||||
format: {byPos: 1, type: "text", optional: true},
|
||||
template: {byPos: 2, type: "text", optional: true}
|
||||
},
|
||||
code: function(type,tiddler,store,params) {
|
||||
handler: function(type,tiddler,store,params) {
|
||||
var v = tiddler.fields[params.field],
|
||||
encoder = type === "text/html" ? utils.htmlEncode : function(x) {return x;};
|
||||
if(v) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
<h1>Welcome to <a href="TiddlyWiki5" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki5</a></h1><div data-tw-macro='tiddler' data-tw-params='{"target":{"type":"string","value":"HelloThere"}}'>Welcome to <a href="TiddlyWiki5" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki5</a>, an interactive wiki <a href="ThisIsAlpha" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">under development</a> in <a href="JavaScript" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">JavaScript</a> to run in the browser or under node.js. It is a reboot of <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a>, the now venerable, reusable non-linear personal web notebook first released in 2004.<br /><br />Over the years, <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> has earned an enduring role as a tool that people <a href="Raves" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">love using</a> for its rich, interactive interface to <a href="TiddlyWikiConcepts" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">manipulate complex data</a> with structure that doesn't easily fit into conventional tools like spreadsheets and wordprocessors. Because people can use it without needing any complicated server infrastructure, and because it is <a href="OpenSourceLicense" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">open source</a>, it has bought unprecedented freedom to people to keep their precious information under their own control. <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> was originally created by <a href="JeremyRuston" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">JeremyRuston</a> and is now a thriving <a href="OpenSourceLicense" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">open source</a> project with a busy <a href="Community" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">Community</a> of independent developers.<br /></div><br /><h1>Usage</h1><div data-tw-macro='tiddler' data-tw-params='{"target":{"type":"string","value":"CommandLineInterface"}}'><a href="TiddlyWiki5" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki5</a> can be used on the command line to perform an extensive set of operations based on <a href="RecipeFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">RecipeFiles</a>, <a href="TiddlerFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">TiddlerFiles</a> and <a href="TiddlyWikiFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWikiFiles</a>.<br /><br />Usage:<br /><pre>node tiddlywiki.js <options>
|
||||
</pre>The command line options are processed sequentially from left to right. Processing pauses during long operations, like loading a <a href="RecipeFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">recipe file</a> and all the subrecipes and <a href="TiddlerFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">tiddlers</a> that it references. The following options are available:<br /><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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> called <code>index.html</code> and an RSS feed called <code>index.xml</code></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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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><br /><h2> Examples</h2>This example loads the tiddlers from a <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> HTML file and makes them available over HTTP:<br /><pre>node tiddlywiki.js --load mywiki.html --servewiki 127.0.0.1:8000
|
||||
</pre>The command line options are processed sequentially from left to right. Processing pauses during long operations, like loading a <a href="RecipeFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">recipe file</a> and all the subrecipes and <a href="TiddlerFiles" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-resolves">tiddlers</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> called <code>index.html</code> and an RSS feed called <code>index.xml</code></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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> 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 <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> HTML file and makes them available over HTTP:<br /><pre>node tiddlywiki.js --load mywiki.html --servewiki 127.0.0.1:8000
|
||||
</pre>This example cooks a <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> from a recipe:<br /><pre>node tiddlywiki.js --recipe tiddlywiki.com/index.recipe --savewiki tmp/
|
||||
</pre>This example ginsus a <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> into its constituent tiddlers:<br /><pre>node tiddlywiki.js --load mywiki.html --savetiddlers tmp/tiddlers
|
||||
</pre><h2> Notes</h2><code>--servewiki</code> and <code>--servertiddlers</code> are for different purposes and should not be used together. The former is for <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> core developers who want to be able to edit the <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> source files in a text editor and view the results in the browser by clicking refresh; it is slow because it reloads all the <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> <a href="JavaScript" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">JavaScript</a> 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-params='{"target":{"type":"string","value":"Testing"}}'><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 <a href="WikiText" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">WikiText</a> Features</h1><div data-tw-macro='tiddler' data-tw-params='{"target":{"type":"string","value":"NewWikiTextFeatures"}}'>It is proposed to extend the existing <a href="TiddlyWiki" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">TiddlyWiki</a> wikitext syntax with the following extensions<br /><br />1. Addition of <code>**bold**</code> character formatting<br />2. Addition of <code>`backtick for code`</code> character formatting<br />4. Addition of <a href="WikiCreole-style" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">WikiCreole-style</a> forced line break, e.g. <code>force\\linebreak</code><br />3. Addition of <a href="WikiCreole-style" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">WikiCreole-style</a> headings, e.g. <code>==Heading</code><br />5. Addition of <a href="WikiCreole-style" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">WikiCreole-style</a> headings in tables, e.g. <code>|=|=table|=header|</code><br />6. Addition of white-listed HTML tags intermixed with wikitext<br />7. Addition of <a href="WikiCreole-style" class="tw-tiddlylink tw-tiddlylink-internal tw-tiddlylink-missing">WikiCreole-style</a> pretty links, e.g. <code>[[description -> link]]</code><br />8. Addition of multiline macros, e.g.<br /><pre><<myMacro
|
||||
|
@ -8,7 +8,6 @@ Usage:
|
||||
node tiddlywiki.js <options>
|
||||
}}}
|
||||
The command line options are processed sequentially from left to right. Processing pauses during long operations, like loading a [[recipe file|RecipeFiles]] and all the subrecipes and [[tiddlers|TiddlerFiles]] that it references. The following options are available:
|
||||
|
||||
|{{{--recipe <filepath>}}} |Loads a specfied `.recipe` file |
|
||||
|{{{--load <filepath>}}} |Load additional tiddlers from TiddlyWiki files ({{{.html}}}), {{{.tiddler}}}, {{{.tid}}}, {{{.json}}} or other files |
|
||||
|{{{--savewiki <dirpath>}}} |Saves all the loaded tiddlers as a single file TiddlyWiki called {{{index.html}}} and an RSS feed called {{{index.xml}}} |
|
||||
@ -20,7 +19,6 @@ The command line options are processed sequentially from left to right. Processi
|
||||
|{{{--dumpstore}}} |Dump the TiddlyWiki store in JSON format |
|
||||
|{{{--dumprecipe}}} |Dump the current recipe in JSON format |
|
||||
|{{{--verbose}}} |verbose output, useful for debugging |
|
||||
|
||||
!! Examples
|
||||
This example loads the tiddlers from a TiddlyWiki HTML file and makes them available over HTTP:
|
||||
{{{
|
||||
|
@ -6,7 +6,7 @@ Macros are conventional JavaScript modules that export a single variable called
|
||||
|`name` |The name of the macro |
|
||||
|`types` |An array of the MIME types that the macro can render |
|
||||
|`params` |A hashmap of the parameters accepted by the macro (see below) |
|
||||
|`code` |The macro rendering function (see below) |
|
||||
|`handler` |The macro rendering function (see below) |
|
||||
|
||||
The `params` hashmap provides the following fields about each parameter:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user