|''URL:''|http://tiddlywiki.abego-software.de/|
Collection of experimental software for TiddlyWiki
HelloThere\n[[Tiddler Alias Example]]
This TiddlyWiki ([[based onTiddlyWiki 2.1.0 beta 7|http://www.tiddlywiki.com/beta]]) contains experimental software, provided by [[abego Software|http://www.abego-software.de]].\n\n|!Name|!Description|\n|TiddlerAliasPlugin|Reference a tiddler through an alias (or even through many aliases). E.g. a tiddler "William Shakespeare" may also be referenced as {{{[[Shaxper]]}}}.<<br>><<br>>When editing a tiddler you may enter alternative names for the tiddler in the "Alias" field (below the tags field), similar to the way you enter tags. You may even specify multiple alias names, separated by spaces. Alias names containing spaces must be written as {{{[[...]]}}}|\n\nSee also [[abego Extensions|http://tiddlywiki.abego-software.de]]
HelloThere\n\n[[abego Software|http://www.abego-software.de]]
experimental software for your TiddlyWiki
abegoExtension BetaZone
Using the [[TiddlerAliasPlugin]] you may refer to a tiddler using various names. \n\nIn this example the tiddler "William Shakespeare" also defines the alias "Shaxper". I.e. you may write code like this\n{{{\nRead more about [[William Shakespeare]], also known as [[Shaxper]]\n}}}\n''Result:''\nRead more about [[William Shakespeare]], also known as [[Shaxper]]\n\nIn addition the "Auto ~Non-Space Alias" feature will automatically create aliases: for tiddlers with titles containing whitespaces an alias is automatically created that has every whitespace replaced by a dash ("-"). E.g. a tiddler called [[Tiddler with no alias defined]] can also be referenced by [[Tiddler-with-no-alias-defined]].\n
Just an example tiddler
/***\n|''Name:''|TiddlerAliasPlugin|\n|''Version:''|1.0.0 BETA 4 (2009-03-30)|\n|''Source:''|http://tiddlywiki.abego-software.de/Beta.html#TiddlerAliasPlugin|\n|''Author:''|UdoBorkowski (ub [at] abego-software [dot] de)|\n|''Licence:''|[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]|\n|''Copyright:''|&copy; 2009 [[abego Software|http://www.abego-software.de]]|\n|''~CoreVersion:''|2.1.0|\n|''Browser:''|Firefox 1.5.0.7 or better; InternetExplorer 6.0|\n!Description\n\nReference a tiddler through an alias (or even through many aliases). E.g. a tiddler "William Shakespeare" may also be referenced as {{{[[Shaxper]]}}}.\n\nWhen editing a tiddler you may enter alternative names for the tiddler in the "Alias" field (below the tags field), similar to the way you enter tags. You may even specify multiple alias names, separated by spaces. Alias names containing spaces must be written as {{{[[...]]}}}\n\nAlso this plugin implements the "Auto Non-Space Alias" feature: for tiddlers with titles containing whitespaces an alias is automatically created that has every whitespace replaced by a dash ("-"). E.g. a tiddler called [[Tiddler with no alias defined]] can also be referenced by [[Tiddler-with-no-alias-defined]].\n\n!Revision history\n* v1.0.0 Beta 4 (2009-03-30)\n** Bugfix: ToggleLinks does not work when TiddlerAliasPlugin is installed (Thanks to Jonnan West for reporting the bug)\n* v1.0.0 Beta 3 (2006-09-23)\n** Support "Auto Non-Space Alias" feature: For tiddler with titles containing whitespaces an alias is automatically created that has every whitespace replaced by a dash ("-")\n* v1.0.0 Beta 2 (2006-09-22)\n** Bugfix: Tiddler is displayed more than once when opened both through title and alias (Thanks to KenGirard for reporting)\n* v1.0.0 Beta 1 (2006-09-21)\n** Beta 1 release\n!Code\n***/\n//{{{\n \n//============================================================================\n//============================================================================\n// TiddlerAliasPlugin\n//============================================================================\n//============================================================================\n\n// Only install once\nif (!version.extensions.TiddlerAliasPlugin) {\n\nversion.extensions.TiddlerAliasPlugin = {\n major: 1, minor: 0, revision: 0, beta: 4,\n date: new Date(2009,2,30), \n source: "http://tiddlywiki.abego-software.de/Beta.html#TiddlerAliasPlugin",\n licence: "[[BSD open source license (abego Software)|http://www.abego-software.de/legal/apl-v10.html]]",\n copyright: "Copyright (c) abego Software GmbH, 2005-2009 (www.abego-software.de)"\n};\n\n(function() {\n\nwindow.abegoTiddlerAlias = {\n lingo: {\n aliasPrompt: "Type alias names (i.e. alternative names for this tiddler) separated with spaces, [[use double square brackets]] if necessary"\n }, \n \n editTemplateExtension: "<div class='editor' macro='edit alias'></div><div class='editorFooter'><span macro='message abegoTiddlerAlias.lingo.aliasPrompt'></span></div>"\n};\n\nvar oldFetchTiddler;\nvar oldSaveTiddler;\nvar oldDisplayTiddler;\n\nvar fWithAutoNonSpaceAlias = true;\n\nfunction withAutoNonSpaceAlias() {\n return fWithAutoNonSpaceAlias;\n}\n\nfunction addNonSpaceAlias(map, title) {\n var s = title.replace(/\ss/g,"-");\n if (s != title)\n map[s] = title;\n}\n\nfunction calcAliases() {\n var result = {};\n store.forEachTiddler(function(title,tiddler) {\n var s = store.getValue(tiddler,"alias");\n if (s) {\n var p = s.parseParams("list",null,false,true);\n for(var i=1; i<p.length; i++)\n result[p[i].value] = title;\n }\n if (withAutoNonSpaceAlias())\n addNonSpaceAlias(result,title);\n });\n return result;\n}\n\n// Returns a map that maps an alias name to the title of the tiddler\nabegoTiddlerAlias.getAliases = function() {\n if (!store.aliases)\n store.aliases = calcAliases();\n return store.aliases;\n}\n\n// Returns the title of the tiddler for the given alias.\n// When no such alias is defined but a tiddler with that name exists the alias is returned.\n// Otherwise null is returned.\nabegoTiddlerAlias.getAliasTitle = function(alias) {\n var t = abegoTiddlerAlias.getAliases()[alias];\n return t ? t : (store.fetchTiddler(alias) ? alias : null)\n}\n\nfunction hasEditTemplateExtension(s) {\n return s.indexOf(abegoTiddlerAlias.editTemplateExtension) >= 0;\n}\n\nfunction addEditTemplateExtension(s) {\n if (s && !hasEditTemplateExtension(s)) {\n var i = s.lastIndexOf("</div>");\n if (i >= 0)\n return s.slice(0,i+6)+"\sn"+abegoTiddlerAlias.editTemplateExtension+s.slice(i+6);\n }\n return null;\n}\n\nfunction hijackFetchTiddler() {\n oldFetchTiddler = store.fetchTiddler;\n\n store.fetchTiddler = function(title) {\n var result = oldFetchTiddler.apply(this, arguments);\n if (!result && title) {\n title = abegoTiddlerAlias.getAliases()[title];\n if (title)\n result = oldFetchTiddler.apply(this, [title])\n }\n return result; \n };\n}\n\nfunction hijackSaveTiddler() {\n oldSaveTiddler = TiddlyWiki.prototype.saveTiddler;\n TiddlyWiki.prototype.saveTiddler = function() {\n var result = oldSaveTiddler.apply(this, arguments);\n delete store.aliases; \n return result; \n }\n}\n\n\nfunction hijackDisplayTiddler() {\n oldDisplayTiddler = Story.prototype.displayTiddler;\n Story.prototype.displayTiddler = function(srcElement,title,template,animate,slowly,customFields,toggle,animationSrc) {\n // Ensure that a tiddler is always opened with its "original" title (not an alias)\n var tiddler = store.fetchTiddler(title);\n if (tiddler) \n title = tiddler.title;\n return oldDisplayTiddler.apply(this, [srcElement,title,template,animate,slowly,customFields,toggle,animationSrc]);\n }\n}\n \n\nfunction modifyEditTemplate() {\n // The shadow tiddler\n var s = addEditTemplateExtension(config.shadowTiddlers["EditTemplate"]);\n if (s) \n config.shadowTiddlers["EditTemplate"] = s;\n \n // The "real" tiddler (if defined)\n var t = store.getTiddler("EditTemplate");\n if (t && !hasEditTemplateExtension(t.text))\n t.set(null,addEditTemplateExtension(t.text)); \n}\n\n// Requires store is defined.\nfunction doHijacking() {\n hijackFetchTiddler();\n hijackSaveTiddler();\n hijackDisplayTiddler();\n modifyEditTemplate();\n}\n\n// for debugging the plugin is not loaded through the systemConfig mechanism but via a script tag. \n// At that point in the "store" is not yet defined. In that case hijackFetchTiddler through the restart function.\n// Otherwise hijack now.\nif (!store) {\n var oldRestartFunc = restart;\n window.restart = function() {\n doHijacking();\n oldRestartFunc.apply(this,arguments);\n };\n} else\n doHijacking();\n\n// To support the access through the "message" macro\nconfig.abegoTiddlerAlias = abegoTiddlerAlias;\n})();\n} // of "install only once"\n\n\n/***\n!Licence and Copyright\nCopyright (c) abego Software ~GmbH, 2005 ([[www.abego-software.de|http://www.abego-software.de]])\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n\nRedistributions of source code must retain the above copyright notice, this\nlist of conditions and the following disclaimer.\n\nRedistributions in binary form must reproduce the above copyright notice, this\nlist of conditions and the following disclaimer in the documentation and/or other\nmaterials provided with the distribution.\n\nNeither the name of abego Software nor the names of its contributors may be\nused to endorse or promote products derived from this software without specific\nprior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY\nEXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES\nOF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT\nSHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED\nTO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR\nBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\nANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n***/\n\n//}}}\n
<!--{{{-->\n<div class='toolbar' macro='toolbar closeTiddler closeOthers +editTiddler permalink references jump'></div>\n<div class='title' macro='view title'></div>\n<div class='tagged' macro='tags'></div>\n<div class='viewer' macro='view text wikified'></div>\n<div class='tagClear'></div>\n<!--}}}-->
Some wise words ...\n