diff --git a/editions/tw5.com/tiddlers/$__config_RelinkOnRename.tid b/editions/tw5.com/tiddlers/$__config_RelinkOnRename.tid index de70dbe65..1ada4d712 100644 --- a/editions/tw5.com/tiddlers/$__config_RelinkOnRename.tid +++ b/editions/tw5.com/tiddlers/$__config_RelinkOnRename.tid @@ -1,6 +1,6 @@ created: 20240208143409196 -modified: 20240208152306199 +modified: 20240826163400275 title: $:/config/RelinkOnRename type: text/vnd.tiddlywiki -no \ No newline at end of file +yes \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/$__config_flibbles_relink_fields_import-compound.tid b/editions/tw5.com/tiddlers/$__config_flibbles_relink_fields_import-compound.tid new file mode 100644 index 000000000..38b4321ba --- /dev/null +++ b/editions/tw5.com/tiddlers/$__config_flibbles_relink_fields_import-compound.tid @@ -0,0 +1,4 @@ +title: $:/config/flibbles/relink/fields/import-compound +type: text/vnd.tiddlywiki + +title \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json b/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json new file mode 100644 index 000000000..d44b7fc7d --- /dev/null +++ b/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json @@ -0,0 +1 @@ +{"tiddlers":{"$:/plugins/flibbles/relink/js/bulkops.js":{"text":"/*\\\nmodule-type: startup\n\nReplaces the relinkTiddler defined in $:/core/modules/wiki-bulkops.js\n\nThis is a startup instead of a wikimethods module-type because it's the only\nway to ensure this runs after the old relinkTiddler method is applied.\n\n\\*/\n(function(){\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils.js\");\n\nexports.name = \"redefine-relinkTiddler\";\nexports.synchronous = true;\n// load-modules is when wikimethods are applied in\n// ``$:/core/modules/startup/load-modules.js``\nexports.after = ['load-modules'];\n// We come before commands because they may do renaming, or jasmine testing\nexports.before = ['commands'];\n\nexports.startup = function() {\n\t$tw.Wiki.prototype.relinkTiddler = relinkTiddler;\n};\n\n/** Walks through all relinkable tiddlers and relinks them.\n * This replaces the existing function in core Tiddlywiki.\n */\nfunction relinkTiddler(fromTitle, toTitle, options) {\n\toptions = options || {};\n\tvar failures = [];\n\tvar indexer = utils.getIndexer(this);\n\tvar records = indexer.relinkLookup(fromTitle, toTitle, options);\n\tvar changedTitles = Object.create(null);\n\tfor (var title in records) {\n\t\tvar entries = records[title],\n\t\t\tchanges = Object.create(null),\n\t\t\tupdate = false,\n\t\t\tfails = false;\n\t\tfor (var field in entries) {\n\t\t\tvar entry = entries[field];\n\t\t\tfails = fails || entry.impossible;\n\t\t\tif (entry.output !== undefined) {\n\t\t\t\tchanges[field] = entry.output;\n\t\t\t\tupdate = true;\n\t\t\t}\n\t\t}\n\t\tif (fails) {\n\t\t\tfailures.push(title);\n\t\t}\n\t\t// If any fields changed, update tiddler\n\t\tif (update) {\n\t\t\tconsole.log(\"Renaming '\"+fromTitle+\"' to '\"+toTitle+\"' in '\" + title + \"'\");\n\n\t\t\tvar tiddler = this.getTiddler(title);\n\t\t\tvar modifyField = utils.touchModifyField(this) ? this.getModificationFields() : undefined;\n\t\t\tvar newTiddler = new $tw.Tiddler(tiddler,changes,modifyField)\n\t\t\tnewTiddler = $tw.hooks.invokeHook(\"th-relinking-tiddler\",newTiddler,tiddler);\n\t\t\tthis.addTiddler(newTiddler);\n\t\t\t// If the title changed, we need to perform a nested rename\n\t\t\tif (newTiddler.fields.title !== title) {\n\t\t\t\tchangedTitles[title] = newTiddler.fields.title;\n\t\t\t}\n\t\t}\n\t};\n\t// Now that the rename is complete, we must now rename any tiddlers that\n\t// changed their titles, and thus repeat the process.\n\tfor (var title in changedTitles) {\n\t\tthis.deleteTiddler(title);\n\t\tthis.relinkTiddler(title, changedTitles[title], options);\n\t}\n\tif (failures.length > 0) {\n\t\tvar options = $tw.utils.extend(\n\t\t\t{ variables: {to: toTitle, from: fromTitle},\n\t\t\t wiki: this},\n\t\t\toptions );\n\t\tlanguage.reportFailures(failures, options);\n\t}\n};\n\n})();\n","module-type":"startup","title":"$:/plugins/flibbles/relink/js/bulkops.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/indexer.js":{"text":"/*\\\nmodule-type: indexer\n\nIndexes results from tiddler reference reports so we don't have to call them\nso much.\n\n\\*/\n\n\"use strict\";\n\nvar utils = require(\"./utils.js\");\nvar TiddlerContext = utils.getContext('tiddler');\n\nfunction Indexer(wiki) {\n\tthis.wiki = wiki;\n};\n\nIndexer.prototype.init = function() {\n\tthis.rebuild();\n};\n\nIndexer.prototype.rebuild = function() {\n\tthis.index = null;\n\tthis.backIndex = null;\n\tthis.contexts = Object.create(null);\n\tthis.changedTiddlers = undefined;\n\tthis.lastRelinks = Object.create(null);\n};\n\nIndexer.prototype.update = function(updateDescriptor) {\n\tif (!this.index) {\n\t\treturn;\n\t}\n\tvar title;\n\tif (!this.changedTiddlers) {\n\t\tthis.changedTiddlers = Object.create(null);\n\t}\n\tif (updateDescriptor.old.exists) {\n\t\ttitle = updateDescriptor.old.tiddler.fields.title;\n\t\tthis.changedTiddlers[title] = {deleted: true};\n\t\tthis._purge(title);\n\t}\n\tif (updateDescriptor['new'].exists) {\n\t\t// If its the same tiddler as old, this overrides the 'deleted' entry\n\t\ttitle = updateDescriptor['new'].tiddler.fields.title;\n\t\tthis.changedTiddlers[title] = {modified: true};\n\t}\n};\n\nIndexer.prototype.lookup = function(title) {\n\tthis._upkeep();\n\treturn this.index[title];\n};\n\nIndexer.prototype.reverseLookup = function(title) {\n\tthis._upkeep();\n\treturn this.backIndex[title] || Object.create(null);\n};\n\nIndexer.prototype.relinkLookup = function(fromTitle, toTitle, options) {\n\tthis._upkeep();\n\tvar shortlist = undefined;\n\tvar lastRelink = this.lastRelinks[fromTitle];\n\tif (lastRelink) {\n\t\tif (lastRelink.to === toTitle) {\n\t\t\t// We need to reintroduce the relink cache, where temporary info\n\t\t\t// was stored.\n\t\t\toptions.cache = lastRelink.cache;\n\t\t\treturn lastRelink.results;\n\t\t}\n\t\tshortlist = buildShortlist(lastRelink);\n\t}\n\tvar results = utils.getRelinkResults(this.wiki, fromTitle, toTitle, this.context, shortlist, options);\n\tif (Object.keys(this.lastRelinks).length > 3) {\n\t\t// The cache got a little large. wipe it clean.\n\t\tthis.lastRelinks = Object.create(null);\n\t}\n\tthis.lastRelinks[fromTitle] = {\n\t\tfrom: fromTitle,\n\t\tresults: results,\n\t\tto: toTitle,\n\t\tcache: options.cache,\n\t\tmaybeRelevant: Object.create(null)};\n\treturn results;\n};\n\n// Returns all tiddlers that don't have anything referencing it.\nIndexer.prototype.orphans = function(options) {\n\tthis._upkeep();\n\tvar results = [];\n\tvar ignoreList = (options && options.ignore) || [];\n\tvar ignoreMap = Object.create(null);\n\tfor (var i = 0; i < ignoreList.length; i++) {\n\t\tignoreMap[ignoreList[i]] = true;\n\t}\n\tfor (var title in this.index) {\n\t\tvar index = this.backIndex[title];\n\t\tvar owned = false;\n\t\tif (index) {\n\t\t\tfor (var key in index) {\n\t\t\t\tif (!ignoreMap[key]) {\n\t\t\t\t\towned = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!owned) {\n\t\t\tresults.push(title);\n\t\t}\n\t}\n\treturn results;\n};\n\nIndexer.prototype._upkeep = function() {\n\tvar title;\n\tif (this.changedTiddlers && (this.context.changed(this.changedTiddlers) || this.context.parent.changed(this.changedTiddlers))) {\n\t\t// If global macro context or whitelist context changed, wipe all\n\t\tthis.rebuild();\n\t}\n\tif (!this.index) {\n\t\tthis.index = Object.create(null);\n\t\tthis.backIndex = Object.create(null);\n\t\tthis.context = utils.getWikiContext(this.wiki);\n\t\tvar titles = this.wiki.getRelinkableTitles();\n\t\tfor (var i = 0; i < titles.length; i++) {\n\t\t\tthis._populate(titles[i]);\n\t\t};\n\t} else if (this.changedTiddlers) {\n\t\t// If there are cached changes, we apply them now.\n\t\tfor (title in this.contexts) {\n\t\t\tvar tiddlerContext = this.contexts[title];\n\t\t\tif (tiddlerContext.changed(this.changedTiddlers)) {\n\t\t\t\tthis._purge(title);\n\t\t\t\tthis._populate(title);\n\t\t\t\tthis._decacheRelink(title);\n\t\t\t\t// Wipe this change, so we don't risk updating it twice.\n\t\t\t\tthis.changedTiddlers[title] = undefined;\n\t\t\t}\n\t\t}\n\t\tfor (title in this.changedTiddlers) {\n\t\t\tvar change = this.changedTiddlers[title];\n\t\t\tif (change && change.modified) {\n\t\t\t\tthis._purge(title);\n\t\t\t\tthis._populate(title);\n\t\t\t\tthis._decacheRelink(title);\n\t\t\t}\n\t\t}\n\t\tthis.changedTiddlers = undefined;\n\t}\n};\n\nIndexer.prototype._purge = function(title) {\n\tfor (var entry in this.index[title]) {\n\t\tdelete this.backIndex[entry][title];\n\t}\n\tdelete this.contexts[title];\n\tdelete this.index[title];\n};\n\n// This drops the cached relink results if unsanctioned tiddlers were changed\nIndexer.prototype._decacheRelink = function(title) {\n\tvar tiddler = this.wiki.getTiddler(title);\n\tfor (var from in this.lastRelinks) {\n\t\tvar lastRelink = this.lastRelinks[from];\n\t\tif (title !== from\n\t\t&& title !== lastRelink.to\n\t\t&& (!tiddler\n\t\t|| !$tw.utils.hop(tiddler.fields, 'draft.of') // is a draft\n\t\t|| tiddler.fields['draft.of'] !== from// draft of target\n\t\t|| references(this.index[title], from))) { // draft references target\n\t\t\t// This is not the draft of the last relinked title,\n\t\t\t// so our cached results should be wiped.\n\t\t\tlastRelink.maybeRelevant[title] = true;\n\t\t\t// Force this cached relink to partially refresh when it comes time\n\t\t\tlastRelink.to = undefined;\n\t\t}\n\t}\n};\n\nfunction references(list, item) {\n\treturn list !== undefined && list[item];\n};\n\n// Compiles a short list of tiddlers we need to check for a rename.\n// This list will be much faster to relink again.\nfunction buildShortlist(lastRelink) {\n\tvar shortlist = Object.keys(lastRelink.results);\n\tfor (var title in lastRelink.maybeRelevant) {\n\t\tif (lastRelink.results[title] === undefined) {\n\t\t\tshortlist.push(title);\n\t\t}\n\t}\n\treturn shortlist;\n};\n\nIndexer.prototype._populate = function(title) {\n\t// Fetch the report for a title, and populate the indexes with result\n\tvar tiddlerContext = new TiddlerContext(this.wiki, this.context, title);\n\tvar references = utils.getTiddlerRelinkReferences(this.wiki, title, tiddlerContext);\n\tthis.index[title] = references;\n\tif (tiddlerContext.hasImports()) {\n\t\tthis.contexts[title] = tiddlerContext;\n\t}\n\tfor (var ref in references) {\n\t\tthis.backIndex[ref] = this.backIndex[ref] || Object.create(null);\n\t\tthis.backIndex[ref][title] = references[ref];\n\t}\n};\n\nexports.RelinkIndexer = Indexer;\n","module-type":"indexer","title":"$:/plugins/flibbles/relink/js/indexer.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/language.js":{"text":"/*\\\nmodule-type: library\n\nThis handles all logging and alerts Relink emits.\n\n\\*/\n\nexports.getString = function(outputType, title, options) {\n\ttitle = \"$:/plugins/flibbles/relink/language/\" + title;\n\treturn options.wiki.renderTiddler(outputType, title, options);\n};\n\nvar logger;\n\nexports.warn = function(string, options) {\n\tif (!logger) {\n\t\tlogger = new $tw.utils.Logger(\"Relinker\");\n\t}\n\tlogger.alert(string);\n};\n\nexports.reportFailures = function(failureList, options) {\n\tvar alertString = this.getString(\"text/html\", \"Error/ReportFailedRelinks\", options)\n\tvar alreadyReported = Object.create(null);\n\tvar reportList = [];\n\t$tw.utils.each(failureList, function(f) {\n\t\tif (!alreadyReported[f]) {\n\t\t\tif ($tw.browser) {\n\t\t\t\t// This might not make the link if the title is complicated.\n\t\t\t\t// Whatever.\n\t\t\t\treportList.push(\"\\n* [[\" + f + \"]]\");\n\t\t\t} else {\n\t\t\t\treportList.push(\"\\n* \" + f);\n\t\t\t}\n\t\t\talreadyReported[f] = true;\n\t\t}\n\t});\n\tthis.warn(alertString + \"\\n\" + reportList.join(\"\"));\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/language.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/mangler.js":{"text":"/*\\\nmodule-type: widget\n\nCreates a mangler widget for field validation. This isn't meant to be used\nby the user. It's only used in Relink configuration.\n\n\\*/\n\nvar Widget = require(\"$:/core/modules/widgets/widget.js\").widget;\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nvar RelinkManglerWidget = function(parseTreeNode,options) {\n\tthis.initialise(parseTreeNode,options);\n\tthis.addEventListeners([\n\t\t{type: \"relink-add-field\", handler: \"handleAddFieldEvent\"},\n\t\t{type: \"relink-add-operator\", handler: \"handleAddOperatorEvent\"},\n\t\t{type: \"relink-add-parameter\", handler: \"handleAddParameterEvent\"},\n\t\t{type: \"relink-add-attribute\", handler: \"handleAddAttributeEvent\"}\n\t]);\n};\n\nexports.relinkmangler = RelinkManglerWidget;\n\nRelinkManglerWidget.prototype = new Widget();\n\n// This wraps alert so it can be monkeypatched during testing.\nRelinkManglerWidget.prototype.alert = function(message) {\n\talert(message);\n};\n\nRelinkManglerWidget.prototype.handleAddFieldEvent = function(event) {\n\tvar param = event.paramObject;\n\tif (typeof param !== \"object\" || !param.field) {\n\t\t// Can't handle it.\n\t\treturn true;\n\t}\n\tvar trimmedName = param.field.trim();\n\tif (!trimmedName) {\n\t\t// Still can't handle it, but don't warn.\n\t\treturn true;\n\t}\n\tif(!$tw.utils.isValidFieldName(trimmedName)) {\n\t\tthis.alert($tw.language.getString(\n\t\t\t\"InvalidFieldName\",\n\t\t\t{variables:\n\t\t\t\t{fieldName: trimmedName}\n\t\t\t}\n\t\t));\n\t} else {\n\t\tadd(this.wiki, \"fields\", trimmedName);\n\t}\n\treturn true;\n};\n\n/**Not much validation, even though there are definitely illegal\n * operator names. If you input on, Relink won't relink it, but it\n * won't choke on it either. Tiddlywiki will...\n */\nRelinkManglerWidget.prototype.handleAddOperatorEvent = function(event) {\n\tvar param = event.paramObject;\n\tif (param) {\n\t\tadd(this.wiki, \"operators\", param.operator);\n\t}\n\treturn true;\n};\n\nRelinkManglerWidget.prototype.handleAddParameterEvent = function(event) {\n\tvar param = event.paramObject;\n\tif (param && param.macro && param.parameter) {\n\t\tif (/\\s/.test(param.macro.trim())) {\n\t\t\tthis.alert(language.getString(\n\t\t\t\t\"text/plain\",\n\t\t\t\t\"Error/InvalidMacroName\",\n\t\t\t\t{ variables: {macroName: param.macro},\n\t\t\t\t wiki: this.wiki\n\t\t\t\t}\n\t\t\t));\n\t\t} else if (/[ \\/]/.test(param.parameter.trim())) {\n\t\t\tthis.alert(language.getString(\n\t\t\t\t\"text/plain\",\n\t\t\t\t\"Error/InvalidParameterName\",\n\t\t\t\t{ variables: {parameterName: param.parameter},\n\t\t\t\t wiki: this.wiki\n\t\t\t\t}\n\t\t\t));\n\t\t} else {\n\t\t\tadd(this.wiki, \"macros\", param.macro, param.parameter);\n\t\t}\n\t}\n\treturn true;\n};\n\nRelinkManglerWidget.prototype.handleAddAttributeEvent = function(event) {\n\tvar param = event.paramObject;\n\tif (param && param.element && param.attribute) {\n\t\tif (/[ \\/]/.test(param.element.trim())) {\n\t\t\tthis.alert(language.getString(\n\t\t\t\t\"text/plain\",\n\t\t\t\t\"Error/InvalidElementName\",\n\t\t\t\t{ variables: {elementName: param.element},\n\t\t\t\t wiki: this.wiki\n\t\t\t\t}\n\t\t\t));\n\t\t} else if (/[ \\/]/.test(param.attribute.trim())) {\n\t\t\tthis.alert(language.getString(\n\t\t\t\t\"text/plain\",\n\t\t\t\t\"Error/InvalidAttributeName\",\n\t\t\t\t{ variables: {attributeName: param.attribute},\n\t\t\t\t wiki: this.wiki\n\t\t\t\t}\n\t\t\t));\n\t\t} else {\n\t\t\tadd(this.wiki, \"attributes\", param.element, param.attribute);\n\t\t}\n\t}\n\treturn true;\n};\n\nfunction add(wiki, category/*, path parts*/) {\n\tvar path = \"$:/config/flibbles/relink/\" + category;\n\tfor (var x = 2; x < arguments.length; x++) {\n\t\tvar part = arguments[x];\n\t\t// Abort if it's falsy, or only whitespace. Also, trim spaces\n\t\tif (!part || !(part = part.trim())) {\n\t\t\treturn;\n\t\t}\n\t\tpath = path + \"/\" + part;\n\t}\n\tvar def = utils.getDefaultType(wiki);\n\twiki.addTiddler({title: path, text: def});\n};\n","module-type":"widget","title":"$:/plugins/flibbles/relink/js/mangler.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings.js":{"text":"/*\\\nmodule-type: library\n\nThis handles the fetching and distribution of relink settings.\n\n\\*/\n\nvar utils = require('./utils');\n\n///// Legacy. You used to be able to access the type from utils.\nexports.getType = utils.getType;\n/////\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/settings.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils.js":{"text":"/*\\\nmodule-type: library\n\nUtility methods for relink.\n\n\\*/\n\nvar macroFilter = \"[[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]] [all[shadows+tiddlers]tag[$:/tags/Global]!has[draft.of]]\";\n\n/**This works nearly identically to $tw.modules.getModulesByTypeAsHashmap\n * except that this also takes care of migrating V1 relink modules.\n */\nexports.getModulesByTypeAsHashmap = function(moduleType, nameField) {\n\tvar results = Object.create(null);\n\t$tw.modules.forEachModuleOfType(moduleType, function(title, module) {\n\t\tvar key = module[nameField];\n\t\tif (key !== undefined) {\n\t\t\tresults[key] = module;\n\t\t} else {\n\t\t\tfor (var entry in module) {\n\t\t\t\tresults[entry] = {\n\t\t\t\t\trelink: module[entry],\n\t\t\t\t\treport: function() {}};\n\t\t\t\tresults[entry][nameField] = entry;\n\t\t\t}\n\t\t}\n\t});\n\t// We've got to sort these so that behavior is consistent across different\n\t// versions of TiddlyMap, whose module return order depends on version...\n\treturn sortModules(results);\n};\n\nfunction sortModules(moduleMap) {\n\tvar keys = Object.keys(moduleMap);\n\tvar sortedResults = Object.create(null);\n\tkeys.sort();\n\tfor (var i = 0; i < keys.length; i++) {\n\t\tvar key = keys[i];\n\t\tif (moduleMap[key].after\n\t\t&& moduleMap[key].after.some(function(requirement) { return !sortedResults[requirement]})) {\n\t\t\t// Not all requirements have been met yet.\n\t\t\t$tw.utils.pushTop(keys, key);\n\t\t\ti--;\n\t\t} else {\n\t\t\tsortedResults[key] = moduleMap[key];\n\t\t}\n\t}\n\treturn sortedResults;\n};\n\nexports.getTiddlerRelinkReferences = function(wiki, title, context) {\n\tvar tiddler = wiki.getTiddler(title),\n\t\treferences = Object.create(null),\n\t\toptions = {settings: context, wiki: wiki};\n\tif (tiddler) {\n\t\ttry {\n\t\t\tfor (var relinker in getRelinkOperators()) {\n\t\t\t\tgetRelinkOperators()[relinker].report(tiddler, function(title, blurb, style) {\n\t\t\t\t\treferences[title] = references[title] || [];\n\t\t\t\t\treferences[title].push($tw.utils.extend({blurb: blurb || ''}, style));\n\t\t\t\t}, options);\n\t\t\t}\n\t\t} catch (e) {\n\t\t\tif (e.message) {\n\t\t\t\te.message = e.message + \"\\nWhen reporting '\" + title + \"' Relink references\";\n\t\t\t}\n\t\t\tthrow e;\n\t\t}\n\t}\n\treturn references;\n};\n\n/** Returns a pair like this,\n * { title: {field: entry, ... }, ... }\n */\nexports.getRelinkResults = function(wiki, fromTitle, toTitle, context, tiddlerList, options) {\n\toptions = options || {};\n\toptions.wiki = options.wiki || wiki;\n\tfromTitle = (fromTitle || \"\").trim();\n\ttoTitle = (toTitle || \"\").trim();\n\tvar changeList = Object.create(null);\n\tif(fromTitle && toTitle !== undefined) {\n\t\tif (tiddlerList === undefined) {\n\t\t\ttiddlerList = wiki.getRelinkableTitles();\n\t\t}\n\t\tfor (var i = 0; i < tiddlerList.length; i++) {\n\t\t\tvar title = tiddlerList[i];\n\t\t\tvar tiddler = wiki.getTiddler(title);\n\t\t\tif(tiddler) {\n\t\t\t\ttry {\n\t\t\t\t\tvar entries = Object.create(null),\n\t\t\t\t\t\toperators = getRelinkOperators();\n\t\t\t\t\toptions.settings = new Contexts.tiddler(wiki, context, title);\n\t\t\t\t\tfor (var operation in operators) {\n\t\t\t\t\t\toperators[operation].relink(tiddler, fromTitle, toTitle, entries, options);\n\t\t\t\t\t}\n\t\t\t\t\tfor (var field in entries) {\n\t\t\t\t\t\t// So long as there is one key,\n\t\t\t\t\t\t// add it to the change list.\n\t\t\t\t\t\tif (tiddler.fields[\"plugin-type\"]) {\n\t\t\t\t\t\t\t// We never change plugins, even if they have links\n\t\t\t\t\t\t\tchangeList[title] = {};\n\t\t\t\t\t\t\tchangeList[title][field] = {impossible: true};\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tchangeList[title] = entries;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} catch (e) {\n\t\t\t\t\t// Should we test for instanceof Error instead?: yes\n\t\t\t\t\t// Does that work in the testing environment?: no\n\t\t\t\t\tif (e.message) {\n\t\t\t\t\t\te.message = e.message + \"\\nWhen relinking '\" + title + \"'\";\n\t\t\t\t\t}\n\t\t\t\t\tthrow e;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn changeList;\n};\n\nvar Contexts = $tw.modules.applyMethods('relinkcontext');\n\nexports.getContext = function(name) {\n\treturn Contexts[name];\n};\n\nexports.getWikiContext = function(wiki) {\n\t// This gives a fresh context every time. It is up to the indexer or\n\t// the cache to preserve those contexts for as long as needed.\n\tvar whitelist = new Contexts.whitelist(wiki);\n\treturn new Contexts.import(wiki, whitelist, macroFilter);\n};\n\n/** Returns the Relink indexer, or a dummy object which pretends to be one.\n */\nexports.getIndexer = function(wiki) {\n\tif (!wiki._relink_indexer) {\n\t\twiki._relink_indexer = (wiki.getIndexer && wiki.getIndexer(\"RelinkIndexer\")) || new (require('$:/plugins/flibbles/relink/js/utils/backupIndexer.js'))(wiki);\n\t}\n\treturn wiki._relink_indexer;\n};\n\n/**Relinking supports a cache that persists throughout a whole relink op.\n * This is because the Tiddlywiki caches may get wiped multiple times\n * throughout the course of a relink.\n */\nexports.getCacheForRun = function(options, cacheName, initializer) {\n\toptions.cache = options.cache || Object.create(null);\n\tif (!$tw.utils.hop(options.cache, cacheName)) {\n\t\toptions.cache[cacheName] = initializer();\n\t}\n\treturn options.cache[cacheName];\n};\n\n/**Returns a specific relinker.\n * This is useful for wikitext rules which need to parse a filter or a list\n */\nexports.getType = function(name) {\n\tvar Handler = getFieldTypes()[name];\n\treturn Handler ? new Handler() : undefined;\n};\n\nexports.getTypes = function() {\n\t// We don't return fieldTypes, because we don't want it modified,\n\t// and we need to filter out legacy names.\n\tvar rtn = Object.create(null);\n\tfor (var type in getFieldTypes()) {\n\t\tvar typeObject = getFieldTypes()[type];\n\t\trtn[typeObject.typeName] = typeObject;\n\t}\n\treturn rtn;\n};\n\nexports.getDefaultType = function(wiki) {\n\tvar tiddler = wiki.getTiddler(\"$:/config/flibbles/relink/settings/default-type\");\n\tvar defaultType = tiddler && tiddler.fields.text;\n\t// make sure the default actually exists, otherwise default\n\treturn fieldTypes[defaultType] ? defaultType : \"title\";\n};\n\nexports.abridgeString = function(string, maxLength, truncLength) {\n\tif (typeof string === \"string\") {\n\t\tmaxLength = maxLength || 3;\n\t\tif (truncLength === undefined) {\n\t\t\ttruncLength = maxLength-3;\n\t\t}\n\t\tstring = string.replace(/\\s+/g, \" \").trim();\n\t\treturn (string.length > maxLength)? string.substr(0, truncLength) + \"...\" : string;\n\t}\n\treturn string;\n};\n\nexports.touchModifyField = function(wiki) {\n\tvar tiddler = wiki.getTiddler(\"$:/config/flibbles/relink/touch-modify\");\n\treturn tiddler && tiddler.fields.text.trim() === \"yes\";\n};\n\n/**Given some text, and a param or attribute within that text, this returns\n * what type of quotation that attribute is using.\n *\n * param: An object in the form {end:, ...}\n */\nexports.determineQuote = function(text, param) {\n\tvar pos = param.end-1;\n\tif (text[pos] === \"'\") {\n\t\treturn \"'\";\n\t}\n\tif (text[pos] === '\"') {\n\t\tif (text.substr(pos-2, 3) === '\"\"\"') {\n\t\t\treturn '\"\"\"';\n\t\t} else {\n\t\t\treturn '\"';\n\t\t}\n\t}\n\tif (text.substr(pos-1,2) === ']]' && text.substr((pos-param.value.length)-3, 2) === '[[') {\n\t\treturn \"[[\";\n\t}\n\treturn '';\n};\n\nvar fieldTypes;\n\nfunction getFieldTypes() {\n\tif (!fieldTypes) {\n\t\tfieldTypes = Object.create(null);\n\t\t$tw.modules.forEachModuleOfType(\"relinkfieldtype\", function(title, exports) {\n\t\t\tfunction NewType() {};\n\t\t\tNewType.prototype = exports;\n\t\t\tNewType.typeName = exports.name;\n\t\t\tfieldTypes[exports.name] = NewType;\n\t\t\t// For legacy, if the NewType doesn't have a report method, we add one\n\t\t\tif (!exports.report) {\n\t\t\t\texports.report = function() {};\n\t\t\t}\n\t\t\t// Also for legacy, some of the field types can go by other names\n\t\t\tif (exports.aliases) {\n\t\t\t\t$tw.utils.each(exports.aliases, function(alias) {\n\t\t\t\t\tfieldTypes[alias] = NewType;\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t}\n\treturn fieldTypes;\n}\n\nvar relinkOperators;\n\nfunction getRelinkOperators() {\n\tif (!relinkOperators) {\n\t\trelinkOperators = exports.getModulesByTypeAsHashmap('relinkoperator', 'name');\n\t}\n\treturn relinkOperators;\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/utils.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/wikimethods.js":{"text":"/*\\\nmodule-type: wikimethod\n\nIntroduces some utility methods used by Relink.\n\n\\*/\n\nvar utils = require(\"./utils.js\");\n\nexports.getTiddlerRelinkReferences = function(title, options) {\n\tvar refs = utils.getIndexer(this).lookup(title);\n\treturn refs && blurbs(refs, options && options.hard);\n};\n\nexports.getTiddlerRelinkBackreferences = function(title) {\n\tvar refs = utils.getIndexer(this).reverseLookup(title);\n\t// For now, I don't have the equivalent \"hard\" option because I'm not\n\t// sure it has any value. May change this later.\n\treturn blurbs(refs);\n};\n\nexports.getRelinkableTitles = function() {\n\tvar toUpdate = \"$:/config/flibbles/relink/to-update\";\n\tvar wiki = this;\n\treturn this.getCacheForTiddler(toUpdate, \"relink-toUpdate\", function() {\n\t\tvar tiddler = wiki.getTiddler(toUpdate);\n\t\tif (tiddler) {\n\t\t\treturn wiki.compileFilter(tiddler.fields.text);\n\t\t} else {\n\t\t\treturn wiki.allTitles;\n\t\t}\n\t})();\n};\n\nexports.getRelinkOrphans = function(options) {\n\treturn utils.getIndexer(this).orphans(options);\n};\n\nfunction blurbs(refs, hardOnly) {\n\tvar blurbsOnly = Object.create(null);\n\tfor (var title in refs) {\n\t\tfor (var i = 0; i < refs[title].length; i++) {\n\t\t\tvar record = refs[title][i];\n\t\t\tif (!hardOnly || !record.soft) {\n\t\t\t\tblurbsOnly[title] = blurbsOnly[title] || [];\n\t\t\t\tblurbsOnly[title].push(record.blurb);\n\t\t\t}\n\t\t}\n\t}\n\treturn blurbsOnly;\n};\n","module-type":"wikimethod","title":"$:/plugins/flibbles/relink/js/wikimethods.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/all_relinkable.js":{"text":"/*\\\nmodule-type: allfilteroperator\n\nFilter function for [all[relinkable]].\nReturns all tiddlers subject to relinking.\n\n\\*/\n\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.relinkable = function(source,prefix,options) {\n\treturn options.wiki.getRelinkableTitles();\n};\n\n})();\n","module-type":"allfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/all_relinkable.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/orphans.js":{"text":"/*\\\nmodule-type: relinkfilteroperator\n\nFilter function for [relink:orphans[]].\nReturns all tiddlers which are not referenced in any way\n\n\\*/\n\n(function() {\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.orphans = function(source,prefix,options) {\n\treturn options.wiki.getRelinkOrphans({ignore: ['$:/StoryList']});\n};\n\n})();\n","module-type":"relinkfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/orphans.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/references.js":{"text":"/*\\\nmodule-type: relinkfilteroperator\n\nGiven a title as an operand, returns all non-shadow tiddlers that have any\nsort of updatable reference to it.\n\n`relink:backreferences[]]`\n`relink:references[]]`\n\nReturns all tiddlers that reference `fromTiddler` somewhere inside them.\n\nInput is ignored. Maybe it shouldn't do this.\n\\*/\n\nvar LinkedList = $tw.utils.LinkedList;\n\nif (!LinkedList) {\n\t/* If the linked list isn't available, make a quick crappy version. */\n\tLinkedList = function() {this.array=[];};\n\n\tLinkedList.prototype.pushTop = function(array) {\n\t\t$tw.utils.pushTop(this.array, array);\n\t};\n\n\tLinkedList.prototype.toArray = function() {\n\t\treturn this.array;\n\t};\n};\n\nexports.backreferences = function(source,operator,options) {\n\tvar results = new LinkedList();\n\tsource(function(tiddler,title) {\n\t\tresults.pushTop(Object.keys(options.wiki.getTiddlerRelinkBackreferences(title,options)));\n\t});\n\treturn results.toArray();\n};\n\nexports.references = function(source,operator,options) {\n\tvar results = new LinkedList();\n\tif (operator.suffix === 'hard') {\n\t\toptions = Object.create(options);\n\t\toptions.hard = true;\n\t}\n\tsource(function(tiddler,title) {\n\t\tvar refs = options.wiki.getTiddlerRelinkReferences(title,options);\n\t\tif (refs) {\n\t\t\tresults.pushTop(Object.keys(refs));\n\t\t}\n\t});\n\treturn results.toArray();\n};\n","module-type":"relinkfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/references.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/relink.js":{"text":"/*\\\nmodule-type: filteroperator\n\nThis filter acts as a namespace for several small, simple filters, such as\n\n`[relink:impossible[]]`\n\n\\*/\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\n\nvar relinkFilterOperators;\n\nfunction getRelinkFilterOperators() {\n\tif(!relinkFilterOperators) {\n\t\trelinkFilterOperators = {};\n\t\t$tw.modules.applyMethods(\"relinkfilteroperator\",\n\t\t relinkFilterOperators);\n\t}\n\treturn relinkFilterOperators;\n}\n\nexports.relink = function(source,operator,options) {\n\tvar suffixPair = parseSuffix(operator.suffix);\n\tvar relinkFilterOperator = getRelinkFilterOperators()[suffixPair[0]];\n\tif (relinkFilterOperator) {\n\t\tvar newOperator = $tw.utils.extend({}, operator);\n\t\tnewOperator.suffix = suffixPair[1];\n\t\treturn relinkFilterOperator(source, newOperator, options);\n\t} else {\n\t\treturn [language.getString(\"text/plain\", \"Error/RelinkFilterOperator\", options)];\n\t}\n};\n\nfunction parseSuffix(suffix) {\n\tvar index = suffix? suffix.indexOf(\":\"): -1;\n\tif (index >= 0) {\n\t\treturn [suffix.substr(0, index), suffix.substr(index+1)];\n\t} else {\n\t\treturn [suffix];\n\t}\n}\n","module-type":"filteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/relink.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/report.js":{"text":"/*\\\nmodule-type: relinkfilteroperator\n\nGiven a title as an operand, returns a string for each occurrence of that title\nwithin each input title.\n\n[[title]] +[relink:report[fromTiddler]]`\n\nReturns string representation of fromTiddler occurrences in title.\n\\*/\n\nexports.report = function(source,operator,options) {\n\tvar fromTitle = operator.operand,\n\t\tresults = [];\n\tif (fromTitle) {\n\t\tvar blurbs = options.wiki.getTiddlerRelinkBackreferences(fromTitle);\n\t\tsource(function(tiddler, title) {\n\t\t\tif (blurbs[title]) {\n\t\t\t\tresults = results.concat(blurbs[title]);\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n","module-type":"relinkfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/report.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/signatures.js":{"text":"/*\\\nmodule-type: relinkfilteroperator\n\nThis filter returns all input tiddlers which are a source of\nrelink configuration.\n\n`[all[tiddlers+system]relink:source[macros]]`\n\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nexports.signatures = function(source,operator,options) {\n\tvar plugin = operator.operand || null;\n\tvar set = getSet(options);\n\tif (plugin === \"$:/core\") {\n\t\t// Core doesn't actually have any settings. We mean Relink\n\t\tplugin = \"$:/plugins/flibbles/relink\";\n\t}\n\tvar signatures = [];\n\tfor (var signature in set) {\n\t\tvar source = set[signature].source;\n\t\tif (options.wiki.getShadowSource(source) === plugin) {\n\t\t\tsignatures.push(signature);\n\t\t}\n\t}\n\treturn signatures;\n};\n\nexports.type = function(source,operator,options) {\n\tvar results = [];\n\tvar set = getSet(options);\n\tsource(function(tiddler, signature) {\n\t\tif (set[signature]) {\n\t\t\tresults.push(set[signature].name);\n\t\t}\n\t});\n\treturn results;\n};\n\nexports.types = function(source,operator,options) {\n\tvar def = utils.getDefaultType(options.wiki);\n\tvar types = Object.keys(utils.getTypes());\n\ttypes.sort();\n\t// move default to front\n\ttypes.sort(function(x,y) { return x === def ? -1 : y === def ? 1 : 0; });\n\treturn types;\n};\n\nexports.source = function(source,operator,options) {\n\tvar results = [];\n\tvar category = operator.suffix;\n\tvar set = getSet(options);\n\tsource(function(tiddler, signature) {\n\t\tif (set[signature]) {\n\t\t\tresults.push(set[signature].source);\n\t\t}\n\t});\n\treturn results;\n};\n\nfunction getSet(options) {\n\treturn options.wiki.getGlobalCache(\"relink-signatures\", function() {\n\t\tvar config = utils.getWikiContext(options.wiki);\n\t\tvar set = Object.create(null);\n\t\tvar categories = {\n\t\t\tattributes: config.getAttributes(),\n\t\t\tfields: config.getFields(),\n\t\t\tmacros: config.getMacros(),\n\t\t\toperators: config.getOperators()};\n\t\t$tw.utils.each(categories, function(list, category) {\n\t\t\t$tw.utils.each(list, function(item, key) {\n\t\t\t\tset[category + \"/\" + key] = item;\n\t\t\t});\n\t\t});\n\t\treturn set;\n\t});\n};\n","module-type":"relinkfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/signatures.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/filteroperators/splitafter.js":{"text":"/*\\\ntitle: $:/core/modules/filters/splitbefore.js\ntype: application/javascript\nmodule-type: relinkfilteroperator\n\nFilter operator that splits each result on the last occurance of the specified separator and returns the last bit.\n\nWhat does this have to do with relink? Nothing. I need this so I can render\nthe configuration menu. I //could// use [splitregexp[]], but then I'd be\nlimited to Tiddlywiki v5.1.20 or later.\n\n\\*/\n(function(){\n\n/*jslint node: true, browser: true */\n/*global $tw: false */\n\"use strict\";\n\n/*\nExport our filter function\n*/\nexports.splitafter = function(source,operator,options) {\n\tvar results = [];\n\tsource(function(tiddler,title) {\n\t\tvar index = title.lastIndexOf(operator.operand);\n\t\tif(index < 0) {\n\t\t\t$tw.utils.pushTop(results,title);\n\t\t} else {\n\t\t\t$tw.utils.pushTop(results,title.substr(index+1));\n\t\t}\n\t});\n\treturn results;\n};\n\n})();\n\n","title":"$:/plugins/flibbles/relink/js/filteroperators/splitafter.js","type":"application/javascript","module-type":"relinkfilteroperator"},"$:/plugins/flibbles/relink/js/filteroperators/wouldchange.js":{"text":"/*\\\nmodule-type: relinkfilteroperator\n\nwouldchange: Generator.\n\nGiven each input title, it returns all the tiddlers that would be changed if the currentTiddler were to be renamed to the operand.\n\nimpossible: filters all source titles for ones that encounter errors on failure.\n\nTHESE ARE INTERNAL FILTER OPERATOR AND ARE NOT INTENDED TO BE USED BY USERS.\n\n\\*/\n\nvar language = require(\"$:/plugins/flibbles/relink/js/language.js\");\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils.js\");\n\nexports.wouldchange = function(source,operator,options) {\n\tvar from = options.widget && options.widget.getVariable(\"currentTiddler\"),\n\t\tto = operator.operand,\n\t\tindexer = utils.getIndexer(options.wiki);\n\tif (from !== to) {\n\t\tvar records = indexer.relinkLookup(from, to, options);\n\t\treturn Object.keys(records);\n\t} else {\n\t\treturn [];\n\t}\n};\n\nexports.impossible = function(source,operator,options) {\n\tvar from = options.widget && options.widget.getVariable(\"currentTiddler\"),\n\t\tto = operator.operand,\n\t\tresults = [];\n\tif (to && from !== to) {\n\t\tvar indexer = utils.getIndexer(options.wiki),\n\t\t\trecords = indexer.relinkLookup(from, to, options);\n\t\tsource(function(tiddler, title) {\n\t\t\tvar fields = records[title];\n\t\t\tif (fields) {\n\t\t\t\tfor (var field in fields) {\n\t\t\t\t\tif (fields[field].impossible) {\n\t\t\t\t\t\tresults.push(title);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\treturn results;\n};\n","module-type":"relinkfilteroperator","title":"$:/plugins/flibbles/relink/js/filteroperators/wouldchange.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/attributes.js":{"text":"/*\\\n\nFactory method for creating the attributes whitelist cache.\n\n\\*/\n\nvar utils = require('../utils');\n\nexports.name = \"attributes\";\n\nexports.generate = function(attributes, tiddler, key) {\n\tvar data = utils.getType(tiddler.fields.text.trim());\n\tif (data) {\n\t\tdata.source = tiddler.fields.title;\n\t\tvar elem = root(key);\n\t\tvar attr = key.substr(elem.length+1);\n\t\tattributes[elem] = attributes[elem] || Object.create(null);\n\t\tattributes[elem][attr] = data;\n\t}\n};\n\n/* Returns first bit of a path. path/to/tiddler -> path\n */\nfunction root(string) {\n\tvar index = string.indexOf('/');\n\tif (index >= 0) {\n\t\treturn string.substr(0, index);\n\t}\n};\n\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/attributes.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/exceptions.js":{"text":"/*\\\n\nFactory method for specifying system tiddlers which should not be treated\nas text/vnd.tiddlywiki types, but for whatever reason, they don't specify\nthe type they really are. Sort of like how $:/DefaultTiddlers is actually\na filter.\n\n\\*/\n\nexports.name = \"exceptions\";\n\nexports.generate = function(exceptions, tiddler, title) {\n\tvar tiddlerType = tiddler.fields.text.trim();\n\tif (tiddlerType) {\n\t\texceptions[title] = tiddlerType;\n\t}\n};\n","the type they really are. Sort of like how $":"/DefaultTiddlers is actually","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/exceptions.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/fields.js":{"text":"/*\\\n\nFactory method for creating the fields whitelist cache.\n\n\\*/\n\nvar utils = require('../utils');\n\nexports.name = \"fields\";\n\nexports.generate = function(fields, tiddler, name) {\n\tvar data = utils.getType(tiddler.fields.text.trim());\n\tif (data) {\n\t\tdata.source = tiddler.fields.title;\n\t\tfields[name] = data;\n\t}\n};\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/fields.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/fieldwidgets.js":{"text":"/*\\\n\nFactory method for creating the fieldattributes regexp cache.\n\n\\*/\n\nexports.name = \"fieldattributes\";\n\nexports.generate = function(fieldattributes, tiddler, key) {\n\tfieldattributes[key] = new RegExp(tiddler.fields.text.trim());\n};\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/fieldwidgets.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/macros.js":{"text":"/*\\\n\nFactory method for creating the macros whitelist cache.\n\n\\*/\n\nvar utils = require('../utils');\n\nexports.name = \"macros\";\n\nexports.generate = function(macros, tiddler, key) {\n\tvar data = utils.getType(tiddler.fields.text.trim());\n\tif (data) {\n\t\tdata.source = tiddler.fields.title;\n\t\t// We take the last index, not the first, because macro\n\t\t// parameters can't have slashes, but macroNames can.\n\t\tvar name = dir(key);\n\t\tvar arg = key.substr(name.length+1);\n\t\tmacros[name] = macros[name] || Object.create(null);\n\t\tmacros[name][arg] = data;\n\t}\n};\n\n/* Returns all but the last bit of a path. path/to/tiddler -> path/to\n */\nfunction dir(string) {\n\tvar index = string.lastIndexOf('/');\n\tif (index >= 0) {\n\t\treturn string.substr(0, index);\n\t}\n}\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/macros.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/messages.js":{"text":"/*\\\n\nFactory method for creating the message regexp cache.\n\n\\*/\n\nexports.name = \"messages\";\n\nexports.generate = function(messages, tiddler, key) {\n\tmessages[key] = new RegExp(tiddler.fields.text.trim());\n};\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/messages.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/settings/operators.js":{"text":"/*\\\n\nFactory method for creating the operators whitelist cache.\n\n\\*/\n\nvar utils = require('../utils');\n\nexports.name = \"operators\";\n\nexports.generate = function(operators, tiddler, key) {\n\tvar data = utils.getType(tiddler.fields.text.trim());\n\tif (data) {\n\t\tdata.source = tiddler.fields.title;\n\t\tvar pair = key.split('/');\n\t\tvar name = pair[0];\n\t\tdata.key = key;\n\t\toperators[name] = operators[name] || Object.create(null);\n\t\toperators[name][pair[1] || 1] = data;\n\t}\n};\n","module-type":"relinksetting","title":"$:/plugins/flibbles/relink/js/settings/operators.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/filter.js":{"text":"/*\\\n\nThis specifies logic for updating filters to reflect title changes.\n\n\\*/\n\nvar refHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/reference\");\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar filterRelinkers = utils.getModulesByTypeAsHashmap('relinkfilter', 'name');\n\nexports.name = \"filter\";\n\nexports.report = function(filter, callback, options) {\n\tif (filter) {\n\t\ttry {\n\t\t\tvar parseTree = options.wiki.parseFilter(filter);\n\t\t} catch (e) {\n\t\t\t// It must have been malformed. Return without doing anything.\n\t\t\treturn;\n\t\t}\n\t\tfor (var module in filterRelinkers) {\n\t\t\tfilterRelinkers[module].report(parseTree, callback, options);\n\t\t}\n\t}\n};\n\n/**Returns undefined if no change was made.\n */\nexports.relink = function(filter, fromTitle, toTitle, options) {\n\tvar changed = false;\n\tvar results = {};\n\tvar parseTree;\n\tif (filter) {\n\t\ttry {\n\t\t\tparseTree = options.wiki.parseFilter(filter);\n\t\t} catch (e) {\n\t\t\t// It must have been malformed. Return without doing anything.\n\t\t\treturn;\n\t\t}\n\t\tfor (var module in filterRelinkers) {\n\t\t\tvar entry = filterRelinkers[module].relink(parseTree, fromTitle, toTitle, options);\n\t\t\tif (entry) {\n\t\t\t\tif (entry.changed) {\n\t\t\t\t\tchanged = true;\n\t\t\t\t}\n\t\t\t\tif (entry.impossible) {\n\t\t\t\t\tresults.impossible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (changed) {\n\t\tvar builder = assembleFilterString(parseTree, filter, options);\n\t\tresults.output = builder.results();\n\t\tresults.impossible = results.impossible || builder.impossible;\n\t\treturn results;\n\t}\n\tif (results.impossible) {\n\t\treturn results;\n\t}\n\treturn undefined\n};\n\nfunction assembleFilterString(parseTree, oldFilter, options) {\n\tvar relinker = new Rebuilder(oldFilter),\n\t\twordBarrierRequired = false,\n\t\tp = 0;\n\tfor (var i = 0; i < parseTree.length; i++) {\n\t\tvar start = $tw.utils.skipWhiteSpace(oldFilter, p);\n\t\tif (start !== p) {\n\t\t\t// There's some breathing room between this run and the last.\n\t\t\t// We'll never need to insert space.\n\t\t\twordBarrierRequired = false;\n\t\t\tp = start;\n\t\t}\n\t\tvar run = parseTree[i];\n\t\tif (run.prefix) {\n\t\t\tif (wordBarrierRequired) {\n\t\t\t\trelinker.add(' ', p, p);\n\t\t\t\twordBarrierRequired = false;\n\t\t\t}\n\t\t\tp += run.prefix.length;\n\t\t}\n\t\tif (oldFilter[p] !== '['\n\t\t|| (oldFilter[p+1] === '[' && run.operators.length === 1)) {\n\t\t\t// It's a string title\n\t\t\tvar text = run.operators[0].operands[0].text,\n\t\t\t\tend,\n\t\t\t\told;\n\t\t\tswitch (oldFilter[p]) {\n\t\t\tcase \"'\":\n\t\t\tcase '\"':\n\t\t\t\t// p + 1 to skip the first quote\n\t\t\t\t// indexOf() + 1 to skip the last\n\t\t\t\tend = oldFilter.indexOf(oldFilter[p], p+1) + 1;\n\t\t\t\told = oldFilter.substring(p+1, end-1);\n\t\t\t\tbreak;\n\t\t\tcase '[':\n\t\t\t\tend = oldFilter.indexOf(']', p);\n\t\t\t\told = oldFilter.substring(p+2, end);\n\t\t\t\t// +2 to get past the ']]'\n\t\t\t\tend += 2;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tend = skipWord(oldFilter, p);\n\t\t\t\told = oldFilter.substring(p, end);\n\t\t\t}\n\t\t\tif (old !== text) {\n\t\t\t\tvar wrapped = wrapTitle(text, oldFilter[p] !== \"[\" ? oldFilter[p] : '', options);\n\t\t\t\tif (wrapped !== undefined) {\n\t\t\t\t\t// This is a no-quote title. If breathing room is required,\n\t\t\t\t\t// add it. Also, we may need breathing room after it.\n\t\t\t\t\tif (wordBarrierRequired && wrapped[0] !== \"[\") {\n\t\t\t\t\t\trelinker.add(' ', p, p);\n\t\t\t\t\t}\n\t\t\t\t\trelinker.add(wrapped, p, end);\n\t\t\t\t\twordBarrierRequired = wrapped === text;\n\t\t\t\t} else {\n\t\t\t\t\trelinker.impossible = true;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (wordBarrierRequired && oldFilter[p] !== \"[\") {\n\t\t\t\t\trelinker.add(' ', p, p);\n\t\t\t\t}\n\t\t\t\twordBarrierRequired = oldFilter.indexOf(text) === p;\n\t\t\t}\n\t\t\tp = end;\n\t\t} else {\n\t\t\twordBarrierRequired = false;\n\t\t\tp++;\n\t\t\tfor (var j = 0; j < run.operators.length; j++) {\n\t\t\t\tvar operator = run.operators[j];\n\t\t\t\tvar start = p;\n\t\t\t\tfor (var index = 0; index < operator.operands.length; index++) {\n\t\t\t\t\tvar operand = operator.operands[index],\n\t\t\t\t\t\tskip = false;\n\t\t\t\t\t\tend,\n\t\t\t\t\t\twrapped;\n\t\t\t\t\tif (operand.indirect) {\n\t\t\t\t\t\tp = oldFilter.indexOf('{', p);\n\t\t\t\t\t\tend = oldFilter.indexOf('}', p+1);\n\t\t\t\t\t\twrapped = '{' + operand.text + '}';\n\t\t\t\t\t} else if (operand.variable) {\n\t\t\t\t\t\tp = oldFilter.indexOf('<', p);\n\t\t\t\t\t\tend = oldFilter.indexOf('>', p+1);\n\t\t\t\t\t\twrapped = '<' + operand.text + '>';\n\t\t\t\t\t} else if (operator.regexp) {\n\t\t\t\t\t\tp = oldFilter.indexOf('/', p);\n\t\t\t\t\t\tend = oldFilter.indexOf('/', p+1);\n\t\t\t\t\t\tskip = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tp = oldFilter.indexOf('[', p);\n\t\t\t\t\t\tend = oldFilter.indexOf(']', p+1);\n\t\t\t\t\t\tif (!canBePrettyOperand(operand.text) || (options.inBraces && operand.text.indexOf('}}}') >= 0)) {\n\t\t\t\t\t\t\tskip = true;\n\t\t\t\t\t\t\trelinker.impossible = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twrapped = '[' + operand.text + ']';\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tend++; // skip the closing brace\n\t\t\t\t\tif (index === 0) {\n\t\t\t\t\t\t// If this is the first operand, let's first recreate the operator signature in case it was changed at all.\n\t\t\t\t\t\trelinker.add(operatorSignature(operator, oldFilter, start), start, p);\n\t\t\t\t\t}\n\t\t\t\t\tif (!skip) {\n\t\t\t\t\t\trelinker.add(wrapped, p, end);\n\t\t\t\t\t}\n\t\t\t\t\tp = end;\n\t\t\t\t}\n\t\t\t}\n\t\t\tp++; // Skip the closing brace;\n\t\t}\n\t}\n\treturn relinker;\n};\n\nfunction operatorSignature(operator, oldText, start) {\n\t// If it's a title operand, try to determine if it was a shorthand.\n\tvar prefix = operator.prefix || '';\n\tvar signature = prefix + ((operator.operator === 'title' && oldText[start + prefix.length] !== 't')? '': operator.operator);\n\tif (operator.suffix) {\n\t\tsignature += ':' + operator.suffix;\n\t}\n\treturn signature;\n}\n\nfunction skipWord(source,pos) {\n\tvar c;\n\twhile(true) {\n\t\tc = source.charAt(pos);\n\t\tif((c !== \"\") && (c !== \" \") && (c !== \"\\f\") && (c !== \"\\n\")\n\t\t&& (c !== \"\\r\") && (c !== \"\\t\")\n\t\t&& (c !== \"\\v\")&& (c !== \"\\u00a0\") // Ignores obscure unicode spaces\n\t\t&& (c !== \"[\") && (c !== \"]\")) { // Ignore brackets\n\t\t\tpos++;\n\t\t} else {\n\t\t\treturn pos;\n\t\t}\n\t}\n};\n\n/* Same as this.relink, except this has the added constraint that the return\n * value must be able to be wrapped in curly braces. (i.e. '{{{...}}}')\n */\nexports.relinkInBraces = function(filter, fromTitle, toTitle, options) {\n\tvar braceOptions = $tw.utils.extend({inBraces: true}, options);\n\tvar entry = this.relink(filter, fromTitle, toTitle, braceOptions);\n\tif (entry && entry.output && !canBeInBraces(entry.output)) {\n\t\t// It was possible, but it won't fit in braces, so we must give up\n\t\tdelete entry.output;\n\t\tentry.impossible = true;\n\t}\n\treturn entry;\n};\n\nfunction wrapTitle(value, preference, options) {\n\tvar choices = {\n\t\t\"\": function(v) {return /^[^\\s\\[\\]\\}\\+\\-\\~\\=\\:][^\\s\\[\\]]*[^\\s\\[\\]\\}]$/.test(v); },\n\t\t\"[\": canBePrettyOperand,\n\t\t\"'\": function(v) {return v.indexOf(\"'\") < 0; },\n\t\t'\"': function(v) {return v.indexOf('\"') < 0; }\n\t};\n\tvar wrappers = {\n\t\t\"\": function(v) {return v; },\n\t\t\"[\": function(v) {return \"[[\"+v+\"]]\"; },\n\t\t\"'\": function(v) {return \"'\"+v+\"'\"; },\n\t\t'\"': function(v) {return '\"'+v+'\"'; }\n\t};\n\tif (options.inBraces && value.indexOf('}}}') >= 0) {\n\t\t// In this particular case, it can't be wrapped in this filter,\n\t\t// even if it would have worked within the context of the filter itself\n\t\treturn undefined;\n\t}\n\tif (!choices[preference]) {\n\t\tpreference = '';\n\t}\n\tif (choices[preference](value)) {\n\t\treturn wrappers[preference](value);\n\t}\n\tfor (var quote in choices) {\n\t\tif (choices[quote](value)) {\n\t\t\treturn wrappers[quote](value);\n\t\t}\n\t}\n\t// No quotes will work on this\n\treturn undefined;\n}\n\nfunction canBePrettyOperand(value) {\n\treturn value.indexOf(']') < 0;\n};\n\nfunction canBeInBraces(value) {\n\treturn value.indexOf(\"}}}\") < 0 && value.substr(value.length-2) !== '}}';\n};\n","module-type":"relinkfieldtype","title":"$:/plugins/flibbles/relink/js/fieldtypes/filter.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/list.js":{"text":"/*\\\nThis manages replacing titles that occur within stringLists, like,\n\nTiddlerA [[Tiddler with spaces]] [[Another Title]]\n\\*/\n\nvar titleRelinker = require('./title.js');\n\nexports.name = \"list\";\n\nexports.report = function(value, callback, options) {\n\tvar list = $tw.utils.parseStringArray(value);\n\tfor (var i = 0; i < list.length; i++) {\n\t\ttitleRelinker.report(list[i], callback, options);\n\t}\n};\n\n/**Returns undefined if no change was made.\n * Parameter: value can literally be a list. This can happen for builtin\n * types 'list' and 'tag'. In those cases, we also return list.\n */\nexports.relink = function(value, fromTitle, toTitle, options) {\n\tvar isModified = false,\n\t\timpossible = false,\n\t\tactualList = false,\n\t\tentry,\n\t\tlist;\n\tif (typeof value !== \"string\") {\n\t\t// Not a string. Must be a list.\n\t\t// clone it, since we may make changes to this possibly\n\t\t// frozen list.\n\t\tlist = (value || []).slice(0);\n\t\tactualList = true;\n\t} else {\n\t\tlist = $tw.utils.parseStringArray(value || \"\");\n\t}\n\t$tw.utils.each(list,function (title,index) {\n\t\tvar titleEntry = titleRelinker.relink(title, fromTitle, toTitle, options);\n\t\tif (titleEntry) {\n\t\t\tif (titleEntry.output) {\n\t\t\t\tlist[index] = titleEntry.output;\n\t\t\t\tisModified = true;\n\t\t\t}\n\t\t\tif (titleEntry.impossible) {\n\t\t\t\timpossible = true;\n\t\t\t}\n\t\t}\n\t});\n\tif (isModified || impossible) {\n\t\tentry = {name: \"list\", impossible: impossible};\n\t\t// It doesn't parse correctly alone, it won't\n\t\t// parse correctly in any list.\n\t\tif (!canBeListItem(toTitle)) {\n\t\t\tentry.impossible = true;\n\t\t} else if (actualList) {\n\t\t\tentry.output = list;\n\t\t} else if (isModified) {\n\t\t\tentry.output = $tw.utils.stringifyList(list);\n\t\t}\n\t}\n\treturn entry;\n};\n\nfunction canBeListItem(value) {\n\tvar regexp = /\\]\\][^\\S\\xA0]/m;\n\treturn !regexp.test(value);\n};\n","module-type":"relinkfieldtype","title":"$:/plugins/flibbles/relink/js/fieldtypes/list.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/reference.js":{"text":"/*\\\nThis manages replacing titles that occur inside text references,\n\ntiddlerTitle\ntiddlerTitle!!field\n!!field\ntiddlerTitle##propertyIndex\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar referenceOperators = utils.getModulesByTypeAsHashmap('relinkreference', 'name');\n\nexports.name = \"reference\";\n\nexports.report = function(value, callback, options) {\n\tif (value) {\n\t\tvar reference = $tw.utils.parseTextReference(value);\n\t\tfor (var operator in referenceOperators) {\n\t\t\treferenceOperators[operator].report(reference, callback, options);\n\t\t}\n\t}\n};\n\nexports.relink = function(value, fromTitle, toTitle, options) {\n\tvar entry;\n\tif (value) {\n\t\tvar impossible = false;\n\t\tvar modified = false;\n\t\tvar reference = $tw.utils.parseTextReference(value);\n\t\tfor (var operator in referenceOperators) {\n\t\t\tvar result = referenceOperators[operator].relink(reference, fromTitle, toTitle, options);\n\t\t\tif (result) {\n\t\t\t\tif (result.impossible) {\n\t\t\t\t\timpossible = true;\n\t\t\t\t}\n\t\t\t\tif (result.output) {\n\t\t\t\t\tmodified = true;\n\t\t\t\t\treference = result.output;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (modified) {\n\t\t\tif (exports.canBePretty(reference.title)) {\n\t\t\t\tentry = {output: exports.toString(reference)};\n\t\t\t} else {\n\t\t\t\timpossible = true;\n\t\t\t}\n\t\t}\n\t\tif (impossible) {\n\t\t\tentry = entry || {};\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\n/* Same as this.relink, except this has the added constraint that the return\n * value must be able to be wrapped in curly braces.\n */\nexports.relinkInBraces = function(value, fromTitle, toTitle, options) {\n\tvar log = this.relink(value, fromTitle, toTitle, options);\n\tif (log && log.output && log.output.indexOf(\"}\") >= 0) {\n\t\tdelete log.output;\n\t\tlog.impossible = true;\n\t}\n\treturn log;\n};\n\nexports.toString = function(textReference) {\n\tvar title = textReference.title || '';\n\tif (textReference.field) {\n\t\treturn title + \"!!\" + textReference.field;\n\t} else if (textReference.index) {\n\t\treturn title + \"##\" + textReference.index;\n\t}\n\treturn title;\n};\n\nexports.canBePretty = function(title) {\n\treturn !title || (title.indexOf(\"!!\") < 0 && title.indexOf(\"##\") < 0);\n};\n","module-type":"relinkfieldtype","title":"$:/plugins/flibbles/relink/js/fieldtypes/reference.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/title.js":{"text":"/*\\\nThis specifies logic for replacing a single-tiddler field. This is the\nsimplest kind of field type. One title swaps out for the other.\n\\*/\n\n// NOTE TO MODDERS: If you're making your own field types, the name must be\n// alpha characters only.\nexports.name = 'title';\n\nexports.report = function(value, callback, options) {\n\tif (value && !containsPlaceholder(value, options)) {\n\t\tcallback(value);\n\t}\n};\n\n/**Returns undefined if no change was made.\n */\nexports.relink = function(value, fromTitle, toTitle, options) {\n\tif (value !== fromTitle || containsPlaceholder(value, options)) {\n\t\treturn undefined;\n\t} else if (containsPlaceholder(toTitle, options)) {\n\t\treturn {impossible: true};\n\t} else {\n\t\treturn {output: toTitle};\n\t}\n};\n\nfunction containsPlaceholder(value, options) {\n\tvar dollar = value.indexOf('$');\n\t// Quick test. If no dollar signs. No placeholders.\n\tif (dollar >= 0 && value.indexOf('$', dollar+1)) {\n\t\t// We potentially have a placeholder\n\t\tvar placeholders = options.settings.getPlaceholderList();\n\t\tif (placeholders) {\n\t\t\tif (value.search(/\\$\\([^$\\)]+\\)\\$/) >= 0) {\n\t\t\t\t// A global placeholder exists\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tfor (var name in placeholders) {\n\t\t\t\tif (value.indexOf('$' + name + '$') >= 0) {\n\t\t\t\t\t// Oops. This contains a placeholder.\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\n// This is legacy support for when 'title' was known as 'field'\nexports.aliases = ['field', 'yes'];\n","module-type":"relinkfieldtype","title":"$:/plugins/flibbles/relink/js/fieldtypes/title.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/wikitext.js":{"text":"/*\\\nThis specifies logic for updating filters to reflect title changes.\n\\*/\n\nexports.name = \"wikitext\";\n\nvar type = 'text/vnd.tiddlywiki';\n\nvar WikiParser = require(\"$:/core/modules/parsers/wikiparser/wikiparser.js\")[type];\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder.js\");\nvar utils = require('$:/plugins/flibbles/relink/js/utils');\nvar WikitextContext = utils.getContext('wikitext');\n\nfunction collectRules() {\n\tvar rules = Object.create(null);\n\t$tw.modules.forEachModuleOfType(\"relinkwikitextrule\", function(title, exports) {\n\t\tvar names = exports.name;\n\t\tif (typeof names === \"string\") {\n\t\t\tnames = [names];\n\t\t}\n\t\tif (names !== undefined) {\n\t\t\tfor (var i = 0; i < names.length; i++) {\n\t\t\t\trules[names[i]] = exports;\n\t\t\t}\n\t\t}\n\t});\n\treturn rules;\n}\n\nfunction WikiWalker(type, text, options) {\n\tthis.options = options;\n\tif (!this.relinkMethodsInjected) {\n\t\tvar rules = collectRules();\n\t\t$tw.utils.each([this.pragmaRuleClasses, this.blockRuleClasses, this.inlineRuleClasses], function(classList) {\n\t\t\tfor (var name in classList) {\n\t\t\t\tif (rules[name]) {\n\t\t\t\t\tdelete rules[name].name;\n\t\t\t\t\t$tw.utils.extend(classList[name].prototype, rules[name]);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tWikiWalker.prototype.relinkMethodsInjected = true;\n\t}\n\tthis.context = new WikitextContext(options.settings);\n\tWikiParser.call(this, type, text, options);\n};\n\nWikiWalker.prototype = Object.create(WikiParser.prototype);\n\nWikiWalker.prototype.parsePragmas = function() {\n\tvar entries = this.tree;\n\twhile (true) {\n\t\tthis.skipWhitespace();\n\t\tif (this.pos >= this.sourceLength) {\n\t\t\tbreak;\n\t\t}\n\t\tvar nextMatch = this.findNextMatch(this.pragmaRules, this.pos);\n\t\tif (!nextMatch || nextMatch.matchIndex !== this.pos) {\n\t\t\tbreak;\n\t\t}\n\t\tentries.push.apply(entries, this.handleRule(nextMatch));\n\t}\n\treturn entries;\n};\n\nWikiWalker.prototype.parseInlineRunUnterminated = function(options) {\n\tvar entries = [];\n\tvar nextMatch = this.findNextMatch(this.inlineRules, this.pos);\n\twhile (this.pos < this.sourceLength && nextMatch) {\n\t\tif (nextMatch.matchIndex > this.pos) {\n\t\t\tthis.pos = nextMatch.matchIndex;\n\t\t}\n\t\tentries.push.apply(entries, this.handleRule(nextMatch));\n\t\tnextMatch = this.findNextMatch(this.inlineRules, this.pos);\n\t}\n\tthis.pos = this.sourceLength;\n\treturn entries;\n};\n\nWikiWalker.prototype.parseInlineRunTerminated = function(terminatorRegExp,options) {\n return this.parseInlineRunTerminatedExtended(terminatorRegExp,options).tree;\n};\n\nWikiWalker.prototype.parseInlineRunTerminatedExtended = function(terminatorRegExp,options) {\n\tvar entries = [];\n\toptions = options || {};\n\tterminatorRegExp.lastIndex = this.pos;\n\tvar terminatorMatch = terminatorRegExp.exec(this.source);\n\tvar inlineRuleMatch = this.findNextMatch(this.inlineRules,this.pos);\n\twhile(this.pos < this.sourceLength && (terminatorMatch || inlineRuleMatch)) {\n\t\tif (terminatorMatch) {\n\t\t\tif (!inlineRuleMatch || inlineRuleMatch.matchIndex >= terminatorMatch.index) {\n\t\t\t\tthis.pos = terminatorMatch.index;\n\t\t\t\tif (options.eatTerminator) {\n\t\t\t\t\tthis.pos += terminatorMatch[0].length;\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tmatch: terminatorMatch,\n\t\t\t\t\ttree: entries\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\tif (inlineRuleMatch) {\n\t\t\tif (inlineRuleMatch.matchIndex > this.pos) {\n\t\t\t\tthis.pos = inlineRuleMatch.matchIndex;\n\t\t\t}\n\t\t\tentries.push.apply(entries, this.handleRule(inlineRuleMatch));\n\t\t\tinlineRuleMatch = this.findNextMatch(this.inlineRules, this.pos);\n\t\t\tterminatorRegExp.lastIndex = this.pos;\n\t\t\tterminatorMatch = terminatorRegExp.exec(this.source);\n\t\t}\n\t}\n\tthis.pos = this.sourceLength;\n\treturn {tree: entries};\n\n};\n\nWikiWalker.prototype.parseBlock = function(terminatorRegExpString) {\n\tvar terminatorRegExp = terminatorRegExpString ? new RegExp(\"(\" + terminatorRegExpString + \"|\\\\r?\\\\n\\\\r?\\\\n)\",\"mg\") : /(\\r?\\n\\r?\\n)/mg;\n\tthis.skipWhitespace();\n\tif (this.pos >= this.sourceLength) {\n\t\treturn [];\n\t}\n\tvar nextMatch = this.findNextMatch(this.blockRules, this.pos);\n\tif(nextMatch && nextMatch.matchIndex === this.pos) {\n\t\treturn this.handleRule(nextMatch);\n\t}\n\treturn this.parseInlineRun(terminatorRegExp);\n};\n\nWikiWalker.prototype.amendRules = function(type, names) {\n\tvar only;\n\tWikiParser.prototype.amendRules.call(this, type, names);\n\tif (type === \"only\") {\n\t\tonly = true;\n\t} else if (type === \"except\") {\n\t\tonly = false;\n\t} else {\n\t\treturn;\n\t}\n\tif (only !== (names.indexOf(\"html\") >= 0)) {\n\t\tthis.context.allowWidgets = disabled;\n\t}\n\tif (only !== (names.indexOf(\"prettylink\") >= 0)) {\n\t\tthis.context.allowPrettylinks = disabled;\n\t}\n};\n\nfunction disabled() { return false; };\n\n/// Reporter\n\nfunction WikiReporter(type, text, callback, options) {\n\tthis.callback = callback;\n\tWikiWalker.call(this, type, text, options);\n};\n\nWikiReporter.prototype = Object.create(WikiWalker.prototype);\n\nWikiReporter.prototype.handleRule = function(ruleInfo) {\n\tif (ruleInfo.rule.report) {\n\t\truleInfo.rule.report(this.source, this.callback, this.options);\n\t} else {\n\t\tif (ruleInfo.rule.matchRegExp !== undefined) {\n\t\t\tthis.pos = ruleInfo.rule.matchRegExp.lastIndex;\n\t\t} else {\n\t\t\t// We can't easily determine the end of this\n\t\t\t// rule match. We'll \"parse\" it so that\n\t\t\t// parser.pos gets updated, but we throw away\n\t\t\t// the results.\n\t\t\truleInfo.rule.parse();\n\t\t}\n\t}\n};\n\nexports.report = function(wikitext, callback, options) {\n\t// Unfortunately it's the side-effect of creating this that reports.\n\tnew WikiReporter(options.type, wikitext, callback, options);\n};\n\n/// Relinker\n\nfunction WikiRelinker(type, text, fromTitle, toTitle, options) {\n\tthis.fromTitle = fromTitle;\n\tthis.toTitle = toTitle;\n\tWikiWalker.call(this, type, text, options);\n};\n\nWikiRelinker.prototype = Object.create(WikiWalker.prototype);\n\nWikiRelinker.prototype.handleRule = function(ruleInfo) {\n\tif (ruleInfo.rule.relink) {\n\t\tvar start = ruleInfo.matchIndex;\n\t\tvar newEntry = ruleInfo.rule.relink(this.source, this.fromTitle, this.toTitle, this.options);\n\t\tif (newEntry !== undefined) {\n\t\t\tif (newEntry.output) {\n\t\t\t\tnewEntry.start = start;\n\t\t\t\tnewEntry.end = this.pos;\n\t\t\t}\n\t\t\treturn [newEntry];\n\t\t}\n\t} else {\n\t\tif (ruleInfo.rule.matchRegExp !== undefined) {\n\t\t\tthis.pos = ruleInfo.rule.matchRegExp.lastIndex;\n\t\t} else {\n\t\t\t// We can't easily determine the end of this\n\t\t\t// rule match. We'll \"parse\" it so that\n\t\t\t// parser.pos gets updated, but we throw away\n\t\t\t// the results.\n\t\t\truleInfo.rule.parse();\n\t\t}\n\t}\n\treturn [];\n};\n\nexports.relink = function(wikitext, fromTitle, toTitle, options) {\n\tvar parser = new WikiRelinker(options.type, wikitext, fromTitle, toTitle, options),\n\t\twikiEntry = undefined;\n\t// Now that we have an array of entries, let's produce the wikiText entry\n\t// containing them all.\n\tif (parser.tree.length > 0) {\n\t\tvar builder = new Rebuilder(wikitext);\n\t\twikiEntry = {};\n\t\tfor (var i = 0; i < parser.tree.length; i++) {\n\t\t\tvar entry = parser.tree[i];\n\t\t\tif (entry.impossible) {\n\t\t\t\twikiEntry.impossible = true;\n\t\t\t}\n\t\t\tif (entry.output) {\n\t\t\t\tbuilder.add(entry.output, entry.start, entry.end);\n\t\t\t}\n\t\t}\n\t\twikiEntry.output = builder.results();\n\t}\n\treturn wikiEntry;\n};\n","module-type":"relinkfieldtype","title":"$:/plugins/flibbles/relink/js/fieldtypes/wikitext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/filter/function.js":{"text":"/*\\\n\nHandles reporting of [function[]] operators.\n\n\\*/\n\nexports.name = \"function\";\n\nexports.report = function(filterParseTree, callback, options) {\n\tforEachOperand(filterParseTree, options, function(name, operand, handler, index) {\n\t\thandler.report(operand.text, function(title, blurb, style) {\n\t\t\tcallback(title, '[function[' + name + ']' + ','.repeat(index) + '[' + (blurb || '') + ']]', style);\n\t\t}, options);\n\t});\n};\n\nexports.relink = function(filterParseTree, fromTitle, toTitle, options) {\n\tvar output = {};\n\tforEachOperand(filterParseTree, options, function(name, operand, handler, index) {\n\t\tvar entry = handler.relink(operand.text, fromTitle, toTitle, options);\n\t\tif (entry) {\n\t\t\tif (entry.output) {\n\t\t\t\toutput.changed = true;\n\t\t\t\toperand.text = entry.output;\n\t\t\t}\n\t\t\tif (entry.impossible) {\n\t\t\t\toutput.impossible = true;\n\t\t\t}\n\t\t}\n\t});\n\treturn output;\n};\n\n// Calls the callback for every applicable operand of a function operator\nfunction forEachOperand(filterParseTree, options, callback) {\n\tfor (var i = 0; i < filterParseTree.length; i++) {\n\t\tvar run = filterParseTree[i];\n\t\tfor (var j = 0; j < run.operators.length; j++) {\n\t\t\tvar operator = run.operators[j];\n\t\t\tvar titleOp = operator.operands[0];\n\t\t\tif (operator.operator === \"function\"\n\t\t\t&& !titleOp.variable && !titleOp.indirect\n\t\t\t&& titleOp.text) {\n\t\t\t\tvar funcName = titleOp.text;\n\t\t\t\tvar managedMacro = options.settings.getMacro(funcName);\n\t\t\t\tif (managedMacro) {\n\t\t\t\t\tvar def = options.settings.getMacroDefinition(funcName);\n\t\t\t\t\tif (def && def.isFunctionDefinition) {\n\t\t\t\t\t\tfor (var index = 1; index < operator.operands.length; index++) {\n\t\t\t\t\t\t\tvar operand = operator.operands[index];\n\t\t\t\t\t\t\tif (!operand.variable && !operand.indirect\n\t\t\t\t\t\t\t&& def.params.length >= index) {\n\t\t\t\t\t\t\t\tvar paramName = def.params[index-1].name;\n\t\t\t\t\t\t\t\tvar handler = managedMacro[paramName];\n\t\t\t\t\t\t\t\tif (handler) {\n\t\t\t\t\t\t\t\t\tcallback(funcName, operand, handler, index);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n","module-type":"relinkfilter","title":"$:/plugins/flibbles/relink/js/fieldtypes/filter/function.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/filter/operators.js":{"text":"/*\\\n\nHandles reporting of filter operators.\n\n\\*/\n\nvar refHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/reference\");\nvar titleHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/title\");\nvar macrocall = require(\"$:/plugins/flibbles/relink/js/utils/macrocall.js\");\n\nexports.name = \"operators\";\n\nexports.report = function(filterParseTree, callback, options) {\n\tfor (var i = 0; i < filterParseTree.length; i++) {\n\t\tvar run = filterParseTree[i];\n\t\tfor (var j = 0; j < run.operators.length; j++) {\n\t\t\tvar operator = run.operators[j];\n\t\t\tfor (var index = 1; index <= operator.operands.length; index++) {\n\t\t\t\tvar operand = operator.operands[index-1];\n\t\t\t\tvar display = makeDisplay(operator);\n\t\t\t\t// Now add any commas if this is a later operand\n\t\t\t\tfor (var x = 1; x < index; x++) {\n\t\t\t\t\tdisplay += ',';\n\t\t\t\t}\n\t\t\t\tif (operand.indirect) {\n\t\t\t\t\trefHandler.report(operand.text, function(title, blurb, style) {\n\t\t\t\t\t\tcallback(title, (run.prefix || '') + '[' + display + '{' + (blurb || '') + '}]', style);\n\t\t\t\t\t}, options);\n\t\t\t\t} else if (operand.variable) {\n\t\t\t\t\tvar macro = $tw.utils.parseMacroInvocation(\"<<\"+operand.text+\">>\", 0);\n\t\t\t\t\tif (macro) {\n\t\t\t\t\t\tmacrocall.report(options.settings, macro, function(title, blurb, style) {\n\t\t\t\t\t\t\tcallback(title, (run.prefix || '') + '[' + display + '<' + blurb + '>]', style);\n\t\t\t\t\t\t}, options);\n\t\t\t\t\t}\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (operand.text) {\n\t\t\t\t\tvar handler = fieldType(options.settings, operator, index, options)\n\t\t\t\t\tif (handler) {\n\t\t\t\t\t\thandler.report(operand.text, function(title, blurb, style) {\n\t\t\t\t\t\t\tif (!isTitleRun(operator) || blurb) {\n\t\t\t\t\t\t\t\tcallback(title, (run.prefix || '') + '[' + display + '[' + (blurb || '') + ']]', style);\n\t\t\t\t\t\t\t} else if (j === run.operators.length-1) {\n\t\t\t\t\t\t\t\t// index will always be 1, meaning single operator run,\n\t\t\t\t\t\t\t\t// unless the user is weird. [title[]] ignores\n\t\t\t\t\t\t\t\t// input, so why would it ever not be 1?\n\t\t\t\t\t\t\t\tcallback(title, run.prefix, style);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Special case: It's a title operator that's\n\t\t\t\t\t\t\t\t// leading a run\n\t\t\t\t\t\t\t\tcallback(title, (run.prefix || '') + '[[]' + makeDisplay(run.operators[j+1]) + '...]', style);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexports.relink = function(filterParseTree, fromTitle, toTitle, options) {\n\tvar output = {};\n\tfor (var i = 0; i < filterParseTree.length; i++) {\n\t\tvar run = filterParseTree[i];\n\t\tfor (var j = 0; j < run.operators.length; j++) {\n\t\t\tvar operator = run.operators[j];\n\t\t\tfor (var index = 1; index <= operator.operands.length; index++) {\n\t\t\t\tvar operand = operator.operands[index-1],\n\t\t\t\t\tentry = undefined;\n\t\t\t\tif (operand.indirect) {\n\t\t\t\t\tentry = refHandler.relinkInBraces(operand.text, fromTitle, toTitle, options);\n\t\t\t\t} else if (operand.variable) {\n\t\t\t\t\tentry = relinkMacro(options.settings, operand.text, fromTitle, toTitle, options);\n\t\t\t\t} else if (operand.text) {\n\t\t\t\t\tvar handler = fieldType(options.settings, operator, index, options)\n\t\t\t\t\tif (handler) {\n\t\t\t\t\t\tentry = handler.relink(operand.text, fromTitle, toTitle, options);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (entry) {\n\t\t\t\t\tif (entry.output) {\n\t\t\t\t\t\toutput.changed = true;\n\t\t\t\t\t\toperand.text = entry.output;\n\t\t\t\t\t}\n\t\t\t\t\tif (entry.impossible) {\n\t\t\t\t\t\toutput.impossible = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn output;\n};\n\n// Returns the relinker needed for a given operator, or returns undefined.\n// This method should really be broken into three modules called relinkfilteroperator\nfunction fieldType(context, operator, index, options) {\n\tvar op = operator.operator,\n\t\tsuffix = operator.suffix,\n\t\trtn = (suffix && context.getOperator(op + ':' + suffix, index))\n\t\t || context.getOperator(op, index);\n\tif (!rtn && op === 'contains' && index == 1) {\n\t\t// The 'contains' operator gets special handling\n\t\tsuffix = suffix || 'list';\n\t\tvar handler = context.getFields()[suffix];\n\t\tif (handler && (handler.name === 'list' || handler.name === 'filter')) {\n\t\t\t// Contains uses the title handler, but only if it's\n\t\t\t// searching a 'list' or 'filter' field.\n\t\t\treturn titleHandler;\n\t\t}\n\n\t}\n\tif (!rtn && index == 1) {\n\t\t// maybe it's a field operator?\n\t\trtn = (op === 'field' && context.getFields()[suffix])\n\t\t || (!suffix && !options.wiki.getFilterOperators()[op] && context.getFields()[op]);\n\t}\n\treturn rtn;\n};\n\nfunction makeDisplay(operator) {\n\treturn (operator.prefix || '') + (operator.operator === 'title'? '': operator.operator) + (operator.suffix? ':' + operator.suffix: '');\n};\n\nfunction isTitleRun(operator) {\n\treturn operator.operator === 'title'\n\t\t&& !operator.prefix\n\t\t&& !operator.suffix;\n};\n\n// Takes care of relinking a macro, as well as putting it back together.\nfunction relinkMacro(context, text, fromTitle, toTitle, options) {\n\ttext = \"<<\" + text + \">>\";\n\tvar macro = $tw.utils.parseMacroInvocation(text, 0);\n\tvar entry;\n\tif (macro) {\n\t\tentry = macrocall.relink(context, macro, text, fromTitle, toTitle, false, options);\n\t}\n\tif (entry && entry.output) {\n\t\tvar string = macrocall.reassemble(entry, text, options);\n\t\tif (string !== undefined) {\n\t\t\t// We remove the surrounding brackets.\n\t\t\tstring = string.substring(2, string.length-2);\n\t\t\t// And we make sure that no brackets remain\n\t\t\tif (string.indexOf(\">\") < 0) {\n\t\t\t\tentry.output = string;\n\t\t\t\treturn entry;\n\t\t\t}\n\t\t}\n\t\tdelete entry.output;\n\t\tentry.impossible = true;\n\t}\n\treturn entry;\n};\n","module-type":"relinkfilter","title":"$:/plugins/flibbles/relink/js/fieldtypes/filter/operators.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/fieldtypes/reference/title.js":{"text":"/*\\\n\nThis handles the title inside of references.\n\n\\*/\n\nvar titleRelinker = require('../title.js');\n\nexports.name = 'title';\n\nexports.report = function(reference, callback, options) {\n\tvar title = reference.title;\n\ttitleRelinker.report(reference.title, function(title, blurb, style) {\n\t\tif (reference.field) {\n\t\t\tcallback(title, '!!' + reference.field);\n\t\t} else if (reference.index) {\n\t\t\tcallback(title, '##' + reference.index);\n\t\t} else {\n\t\t\tcallback(title);\n\t\t}\n\t}, options);\n};\n\nexports.relink = function(reference, fromTitle, toTitle, options) {\n\tvar entry = titleRelinker.relink($tw.utils.trim(reference.title), fromTitle, toTitle, options);\n\tif (entry && entry.output) {\n\t\t// preserve user's whitespace\n\t\treference.title = reference.title.replace(fromTitle, entry.output);\n\t\tentry.output = reference;\n\t}\n\treturn entry;\n};\n","module-type":"relinkreference","title":"$:/plugins/flibbles/relink/js/fieldtypes/reference/title.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/fields.js":{"text":"/*\\\n\nHandles all fields specified in the plugin configuration. Currently, this\nonly supports single-value fields.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = 'fields';\n\nexports.report = function(tiddler, callback, options) {\n\tvar fields = options.settings.getFields();\n\t$tw.utils.each(fields, function(handler, field) {\n\t\tvar input = tiddler.fields[field];\n\t\tif (input) {\n\t\t\tif (field === 'list' && tiddler.fields['plugin-type']) {\n\t\t\t\t// We have a built-in exception here. plugins use their list\n\t\t\t\t// field differently. There's a whole mechanism for what\n\t\t\t\t// they actually point to, but let's not bother with that now\n\t\t\t\treturn;\n\t\t\t}\n\t\t\thandler.report(input, function(title, blurb, style) {\n\t\t\t\tif (blurb) {\n\t\t\t\t\tcallback(title, field + ': ' + blurb, style);\n\t\t\t\t} else {\n\t\t\t\t\tcallback(title, field, style);\n\t\t\t\t}\n\t\t\t}, options);\n\t\t}\n\t});\n};\n\nexports.relink = function(tiddler, fromTitle, toTitle, changes, options) {\n\tvar fields = options.settings.getFields();\n\t$tw.utils.each(fields, function(handler, field) {\n\t\tvar input = tiddler.fields[field];\n\t\tif (input) {\n\t\t\tif (field === 'list' && tiddler.fields['plugin-type']) {\n\t\t\t\t// Same deal as above. Skip.\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tvar entry = handler.relink(input, fromTitle, toTitle, options);\n\t\t\tif (entry !== undefined) {\n\t\t\t\tchanges[field] = entry;\n\t\t\t}\n\t\t}\n\t});\n};\n","module-type":"relinkoperator","title":"$:/plugins/flibbles/relink/js/relinkoperations/fields.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text.js":{"text":"/*\\\n\nDepending on the tiddler type, this will apply textOperators which may\nrelink titles within the body.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nexports.name = 'text';\n\nvar textOperators = utils.getModulesByTypeAsHashmap('relinktext', 'type');\n\n// Set up any aliases, mostly for backward-compatibility\n$tw.utils.each(Object.keys(textOperators), function(type) {\n\tvar operator = textOperators[type];\n\tif(operator.aliases) {\n\t\tfor(var index = 0; index < operator.aliases.length; index++) {\n\t\t\ttextOperators[operator.aliases[index]] = operator;\n\t\t}\n\t}\n});\n\n// These are deprecated. Don't use them.\nvar oldTextOperators = utils.getModulesByTypeAsHashmap('relinktextoperator', 'type');\n\nexports.report = function(tiddler, callback, options) {\n\tif (tiddler.fields.text) {\n\t\tvar type = getType(tiddler, options);\n\t\tif (textOperators[type]) {\n\t\t\ttextOperators[type].report(tiddler.fields.text, callback, options);\n\t\t} else if (oldTextOperators[type]) {\n\t\t\t// For the deprecated text operators\n\t\t\toldTextOperators[type].report(tiddler, callback, options);\n\t\t}\n\t}\n};\n\nexports.relink = function(tiddler, fromTitle, toTitle, changes, options) {\n\tif (tiddler.fields.text) {\n\t\tvar type = getType(tiddler, options),\n\t\t\tentry;\n\t\tif (textOperators[type]) {\n\t\t\tentry = textOperators[type].relink(tiddler.fields.text, fromTitle, toTitle, options);\n\t\t} else if (oldTextOperators[type]) {\n\t\t\t// For the deprecated text operators\n\t\t\tentry = oldTextOperators[type].relink(tiddler, fromTitle, toTitle, options);\n\t\t}\n\t\tif (entry) {\n\t\t\tchanges.text = entry;\n\t\t}\n\t}\n};\n\n/* The type of the tiddler is determined based on:\n * 1. Whether there's an exception specified on it.\n * 2. The type the tiddler says it is.\n * 3. Or the default vnd.tiddlywiki type if not specified.\n */\nfunction getType(tiddler, options) {\n\treturn options.settings.getException(tiddler.fields.title)\n\t\t|| tiddler.fields.type\n\t\t|| \"text/vnd.tiddlywiki\";\n};\n","module-type":"relinkoperator","title":"$:/plugins/flibbles/relink/js/relinkoperations/text.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/filtertext.js":{"text":"/*\\\n\nThis relinks tiddlers which contain filters in their body, as oppose to\nwikitext.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar filterHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('filter');\n\nexports.type = 'application/x-tiddler-filter';\n\nexports.aliases = ['text/x-tiddler-filter'];\n\nexports.report = filterHandler.report;\nexports.relink = filterHandler.relink;\n","module-type":"relinktext","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/filtertext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/listtext.js":{"text":"/*\\\n\nThis relinks tiddlers which contain a tiddler list as their body.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar listHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('list');\n\nexports.type = 'application/x-tiddler-list';\n\nexports.aliases = ['text/x-tiddler-list'];\n\nexports.report = listHandler.report;\nexports.relink = listHandler.relink;\n","module-type":"relinktext","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/listtext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/referencetext.js":{"text":"/*\\\n\nThis relinks tiddlers which contain a tiddler reference as their body.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar refHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('reference');\n\nexports.type = 'application/x-tiddler-reference';\n\nexports.aliases = ['text/x-tiddler-reference'];\n\nexports.report = refHandler.report;\nexports.relink = refHandler.relink;\n","module-type":"relinktext","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/referencetext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/titletext.js":{"text":"/*\\\n\nThis relinks tiddlers which contain a single title as their body.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar titleHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('title');\n\nexports.type = 'application/x-tiddler-title';\n\nexports.aliases = ['text/x-tiddler-title'];\n\nexports.report = titleHandler.report;\nexports.relink = titleHandler.relink;\n","module-type":"relinktext","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/titletext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext.js":{"text":"/*\\\n\nChecks for fromTitle in text. If found, sees if it's relevant,\nand tries to swap it out if it is.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar wikitextHandler = require('$:/plugins/flibbles/relink/js/utils.js').getType('wikitext');\n\nexports.type = 'text/vnd.tiddlywiki';\n\nexports.report = wikitextHandler.report;\nexports.relink = wikitextHandler.relink;\n","module-type":"relinktext","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/code.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles code blocks. Or rather //doesn't// handle them, since we should\nignore their contents.\n\n\"`` [[Renamed Title]] ``\" will remain unchanged.\n\n\\*/\n\nexports.name = [\"codeinline\", \"codeblock\"];\n\nexports.relink = function(text) {\n\tvar reEnd;\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// I'm lazy. This relink method works for both codeblock and codeinline\n\tif (this.match[0].length > 2) {\n\t\t// Must be a codeblock\n\t\treEnd = /\\r?\\n```$/mg;\n\t} else {\n\t\t// Must be a codeinline\n\t\treEnd = new RegExp(this.match[1], \"mg\");\n\t}\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(text);\n\tif (match) {\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\treturn undefined;\n};\n\n// Same thing. Just skip the pos ahead.\nexports.report = exports.relink;\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/code.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/comment.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles comment blocks. Or rather //doesn't// handle them, since we should\nignore their contents.\n\n\"\" will remain unchanged.\n\n\\*/\n\nexports.name = [\"commentinline\", \"commentblock\"];\n\nexports.relink = function(text) {\n\tthis.parser.pos = this.endMatchRegExp.lastIndex;\n\treturn undefined;\n};\n\nexports.report = exports.relink;\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/comment.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/conditional.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement of conditionals\n\n<%if Tiddler %>\n\n<%elseif TiddlerB %>\n\n\\*/\n\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils.js\");\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar filterRelinker = utils.getType('filter');\n\nexports.name = \"conditional\";\n\nexports.report = function(text, callback, options) {\n\tvar match = this.match;\n\tvar keyword = '<%if ';\n\tvar reEndString = \"\\\\<\\\\%\\\\s*(endif)\\\\s*\\\\%\\\\>|\\\\<\\\\%\\\\s*(else)\\\\s*\\\\%\\\\>|\\\\<\\\\%\\\\s*(elseif)\\\\s+([\\\\s\\\\S]+?)\\\\%\\\\>\";\n\tthis.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;\n\tvar ex;\n\tvar filter = this.parser.source.substring(match.index + match[0].length, this.terminateIfMatch.index);\n\twhile (true) {\n\t\tif (filter) {\n\t\t\tfilterRelinker.report(filter, function(title, blurb, style) {\n\t\t\t\tif (blurb) {\n\t\t\t\t\tblurb = keyword + blurb + ' %>';\n\t\t\t\t} else {\n\t\t\t\t\tblurb = keyword + '%>';\n\t\t\t\t}\n\t\t\t\tcallback(title, blurb, style);\n\t\t\t}, options);\n\t\t}\n\t\tvar hasLineBreak = doubleLineBreakAtPos(this.parser);\n\t\t// Parse the body looking for else or endif\n\t\tif (hasLineBreak) {\n\t\t\tex = this.parser.parseBlocksTerminatedExtended(reEndString);\n\t\t} else {\n\t\t\tvar reEnd = new RegExp(reEndString,\"mg\");\n\t\t\tex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});\n\t\t}\n\t\tif (ex.match) {\n\t\t\tmatch = ex.match;\n\t\t\tif (ex.match[3] === \"elseif\") {\n\t\t\t\tkeyword = '<%elseif ';\n\t\t\t\tfilter = ex.match[4];\n\t\t\t\tcontinue;\n\t\t\t} else if (ex.match[2] === \"else\") {\n\t\t\t\treEndString = \"\\\\<\\\\%\\\\s*(endif)\\\\s*\\\\%\\\\>\";\n\t\t\t\tfilter = null;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar conditionEntry = {};\n\tvar builder = new Rebuilder(text, this.match.index);\n\tvar reEndString = \"\\\\<\\\\%\\\\s*(endif)\\\\s*\\\\%\\\\>|\\\\<\\\\%\\\\s*(else)\\\\s*\\\\%\\\\>|\\\\<\\\\%\\\\s*(elseif)\\\\s+([\\\\s\\\\S]+?)\\\\%\\\\>\";\n\tthis.parser.pos = this.terminateIfMatch.index + this.terminateIfMatch[0].length;\n\tvar ex;\n\tvar filter = this.parser.source.substring(this.match.index + this.match[0].length, this.terminateIfMatch.index);\n\tvar endOfFilter = this.terminateIfMatch.index;\n\twhile (true) {\n\t\tif (filter) {\n\t\t\tvar entry = filterRelinker.relink(filter, fromTitle, toTitle, options);\n\t\t\tif (entry) {\n\t\t\t\tif (entry.output) {\n\t\t\t\t\tif (entry.output.indexOf('%>') > 0) {\n\t\t\t\t\t\tbuilder.impossible = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuilder.add(entry.output, endOfFilter - filter.length, endOfFilter);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (entry.impossible) {\n\t\t\t\t\tbuilder.impossible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar hasLineBreak = doubleLineBreakAtPos(this.parser);\n\t\t// Parse the body looking for else or endif\n\t\tif (hasLineBreak) {\n\t\t\tex = this.parser.parseBlocksTerminatedExtended(reEndString);\n\t\t} else {\n\t\t\tvar reEnd = new RegExp(reEndString,\"mg\");\n\t\t\tex = this.parser.parseInlineRunTerminatedExtended(reEnd,{eatTerminator: true});\n\t\t}\n\t\tfor (var i = 0; i < ex.tree.length; i++) {\n\t\t\tvar child = ex.tree[i];\n\t\t\tif (child.output) {\n\t\t\t\tbuilder.add(child.output, child.start, child.end);\n\t\t\t}\n\t\t\tif (child.impossible) {\n\t\t\t\tbuilder.impossible = true;\n\t\t\t}\n\t\t}\n\t\tif (ex.match) {\n\t\t\tif (ex.match[3] === \"elseif\") {\n\t\t\t\tfilter = ex.match[4];\n\t\t\t\tendOfFilter = ex.match.index + ex.match[0].length - 2;\n\t\t\t\tcontinue;\n\t\t\t} else if (ex.match[2] === \"else\") {\n\t\t\t\tfilter = null;\n\t\t\t\treEndString = \"\\\\<\\\\%\\\\s*(endif)\\\\s*\\\\%\\\\>\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n\tif (builder.changed() || builder.impossible) {\n\t\tconditionEntry = {\n\t\t\toutput: builder.results(this.parser.pos),\n\t\t\timpossible: builder.impossible };\n\t}\n\treturn conditionEntry;\n};\n\nfunction doubleLineBreakAtPos(parser) {\n\treturn !!$tw.utils.parseTokenRegExp(parser.source, parser.pos, /([^\\S\\n\\r]*\\r?\\n(?:[^\\S\\n\\r]*\\r?\\n|$))/g);\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/conditional.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def.js":{"text":"/*\\\nmodule-type: library\n\nThis is a generic def rule that manages both fnprocdef and macrodef.\n\n\\*/\n\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils\");\nvar VariableContext = utils.getContext('variable');\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar defOperators = utils.getModulesByTypeAsHashmap('relinkdef', 'name');\n\nexports.report = function(text, callback, options) {\n\t// fnprocdef and macrodef have their own implementations of createDefinition\n\t// They create a modifiable object from the respective rule matches.\n\tvar definition = this.createDefinition();\n\tvar setParseTreeNode = this.parse();\n\tvar context = this.parser.context = new VariableContext(this.parser.context, setParseTreeNode[0]);\n\t// Parse set the pos pointer, but we don't want to skip the macro body.\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar endMatch = getBodyMatch(this.parser.source, this.parser.pos, definition);\n\tif (endMatch) {\n\t\tdefinition.body = endMatch[2];\n\t\toptions.settings = context\n\t\tfor (var operator in defOperators) {\n\t\t\tdefOperators[operator].report(definition, callback, options);\n\t\t}\n\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t}\n\tcontext.parameterFocus = false;\n\tcontext.placeholderList = undefined;\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\t// fnprocdef and macrodef have their own implementations of createDefinition\n\t// They create a modifiable object from the respective rule matches.\n\tvar definition = this.createDefinition();\n\tvar setParseTreeNode = this.parse(),\n\t\tentry,\n\t\tcontext = this.parser.context = new VariableContext(this.parser.context, setParseTreeNode[0]);\n\t// Parse set the pos pointer, but we don't want to skip the macro body.\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar endMatch = getBodyMatch(this.parser.source, this.parser.pos, definition);\n\tif (endMatch) {\n\t\tdefinition.body = endMatch[2];\n\t\toptions.settings = context;\n\t\tfor (var operator in defOperators) {\n\t\t\tvar result = defOperators[operator].relink(definition, fromTitle, toTitle, options);\n\t\t\tif (result) {\n\t\t\t\tentry = entry || {};\n\t\t\t\tif (result.output) {\n\t\t\t\t\tentry.output = true;\n\t\t\t\t}\n\t\t\t\tif (result.impossible) {\n\t\t\t\t\tentry.impossible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tthis.parser.pos = endMatch.index + endMatch[0].length;\n\t\tif (entry && entry.output) {\n\t\t\tentry.output = reassembleSignature(definition, this.match[0]) + endMatch[1] + definition.body + endMatch[0];\n\t\t}\n\t}\n\tcontext.parameterFocus = false;\n\tcontext.placeholderList = undefined;\n\treturn entry;\n};\n\nfunction reassembleSignature(definition, text) {\n\t// Reconstruct the definition. Might be tricky because we need to preserve whitespace within the parameters.\n\tvar builder = new Rebuilder(text);\n\tbuilder.add(definition.type, 1, text.search(/[^\\w\\\\]/));\n\tvar pos = builder.index;\n\tbuilder.add(definition.name, skipWhitespace(text, pos), text.indexOf('(', pos));\n\tpos = builder.index;\n\tif (definition.parameters) {\n\t\tbuilder.add(definition.parameters, skipWhitespace(text, pos+1), text.indexOf(')'));\n\t}\n\treturn builder.results();\n};\n\nfunction skipWhitespace(text, pos) {\n\treturn text.substr(pos).search(/\\S/)+pos;\n};\n\n// Return another match for the body, but tooled uniquely\n// m[1] = whitespace before body\n// m[2] = body\n// m.index + m[0].length -> end of match\nfunction getBodyMatch(text, pos, definition) {\n\tvar whitespace,\n\t\tvalueRegExp;\n\tif (definition.multiline) {\n\t\tvalueRegExp = new RegExp(\"\\\\r?\\\\n[^\\\\S\\\\n\\\\r]*\\\\\\\\end[^\\\\S\\\\n\\\\r]*(?:\" + $tw.utils.escapeRegExp(definition.name) + \")?(?:\\\\r?\\\\n|$)\", \"mg\");\n\t\twhitespace = '';\n\t} else {\n\t\tvalueRegExp = /(?:\\r?\\n|$)/mg;\n\t\tvar newPos = $tw.utils.skipWhiteSpace(text, pos);\n\t\twhitespace = text.substring(pos, newPos);\n\t\tpos = newPos;\n\t}\n\tvalueRegExp.lastIndex = pos;\n\tvar match = valueRegExp.exec(text);\n\tif (match) {\n\t\tmatch[1] = whitespace;\n\t\tmatch[2] = text.substring(pos, match.index);\n\t}\n\treturn match;\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/filteredtransclude.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement of filtered transclusions in wiki text like,\n\n{{{ [tag[docs]] }}}\n{{{ [tag[docs]] |tooltip}}}\n{{{ [tag[docs]] ||TemplateTitle}}}\n{{{ [tag[docs]] |tooltip||TemplateTitle}}}\n{{{ [tag[docs]] }}width:40;height:50;}.class.class\n\nThis renames both the list and the template field.\n\n\\*/\n\nexports.name = ['filteredtranscludeinline', 'filteredtranscludeblock'];\n\nvar filterHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('filter');\nvar utils = require(\"./utils.js\");\n\nexports.report = function(text, callback, options) {\n\tvar m = this.match,\n\t\tfilter = m[1],\n\t\ttemplate = $tw.utils.trim(m[3]),\n\t\tappend = template ? '||' + template + '}}}' : '}}}';\n\tvar nestedOptions = Object.create(options);\n\tnestedOptions.settings = this.parser.context;\n\tfilterHandler.report(filter, function(title, blurb, style) {\n\t\tcallback(title, '{{{' + blurb + append, style);\n\t}, nestedOptions);\n\tif (template) {\n\t\tcallback(template, '{{{' + $tw.utils.trim(filter).replace(/\\r?\\n/mg, ' ') + '||}}}');\n\t}\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar m = this.match,\n\t\tfilter = m[1],\n\t\ttooltip = m[2],\n\t\ttemplate = m[3],\n\t\tstyle = m[4],\n\t\tclasses = m[5],\n\t\tparser = this.parser,\n\t\tentry = {};\n\tparser.pos = this.matchRegExp.lastIndex;\n\tvar modified = false;\n\tvar nestedOptions = Object.create(options);\n\tnestedOptions.settings = this.parser.context;\n\tvar filterEntry = filterHandler.relink(filter, fromTitle, toTitle, nestedOptions);\n\tif (filterEntry !== undefined) {\n\t\tif (filterEntry.output) {\n\t\t\tfilter = filterEntry.output;\n\t\t\tmodified = true;\n\t\t}\n\t\tif (filterEntry.impossible) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\n\tif ($tw.utils.trim(template) === fromTitle) {\n\t\t// preserves user-inputted whitespace\n\t\ttemplate = template.replace(fromTitle, toTitle);\n\t\tmodified = true;\n\t}\n\tif (!modified) {\n\t\tif (!entry.impossible) {\n\t\t\treturn undefined;\n\t\t}\n\t} else {\n\t\tvar output = this.makeFilteredtransclude(this.parser, filter, tooltip, template, style, classes);\n\t\tif (output === undefined) {\n\t\t\tentry.impossible = true;\n\t\t} else {\n\t\t\t// By copying over the ending newline of the original\n\t\t\t// text if present, thisrelink method thus works for\n\t\t\t// both the inline and block rule\n\t\t\tentry.output = output + utils.getEndingNewline(m[0]);\n\t\t}\n\t}\n\treturn entry;\n};\n\nexports.makeFilteredtransclude = function(parser, filter, tooltip, template, style, classes) {\n\tif (canBePretty(filter) && canBePrettyTemplate(template)) {\n\t\treturn prettyList(filter, tooltip, template, style, classes);\n\t}\n\tif (classes !== undefined) {\n\t\tclasses = classes.split('.').join(' ');\n\t}\n\treturn utils.makeWidget(parser, '$list', {\n\t\tfilter: filter,\n\t\ttooltip: tooltip,\n\t\ttemplate: template,\n\t\tstyle: style || undefined,\n\t\titemClass: classes});\n};\n\nfunction prettyList(filter, tooltip, template, style, classes) {\n\tif (tooltip === undefined) {\n\t\ttooltip = '';\n\t} else {\n\t\ttooltip = \"|\" + tooltip;\n\t}\n\tif (template === undefined) {\n\t\ttemplate = '';\n\t} else {\n\t\ttemplate = \"||\" + template;\n\t}\n\tif (classes === undefined) {\n\t\tclasses = '';\n\t} else {\n\t\tclasses = \".\" + classes;\n\t}\n\tstyle = style || '';\n\treturn \"{{{\"+filter+tooltip+template+\"}}\"+style+\"}\"+classes;\n};\n\nfunction canBePretty(filter) {\n\treturn filter.indexOf('|') < 0 && filter.indexOf('}}') < 0;\n};\n\nfunction canBePrettyTemplate(template) {\n\treturn !template || (\n\t\ttemplate.indexOf('|') < 0\n\t\t&& template.indexOf('{') < 0\n\t\t&& template.indexOf('}') < 0);\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/filteredtransclude.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/fnprocdef.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles pragma function/procedure/widget definitions.\n\n\\*/\n\n// We inherit from DefRule\nvar DefRule = require('./def.js');\n$tw.utils.extend(exports, DefRule);\n\nexports.name = \"fnprocdef\";\n\nexports.createDefinition = function() {\n\tvar m = this.match;\n\treturn {\n\t\ttype: m[1],\n\t\tname: m[2],\n\t\tparameters: m[4],\n\t\tmultiline: m[5]};\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/fnprocdef.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement in attributes of widgets and html elements\nThis is configurable to select exactly which attributes of which elements\nshould be changed.\n\n<$link to=\"TiddlerTitle\" />\n\n\\*/\n\nvar utils = require(\"./utils.js\");\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar htmlOperators = relinkUtils.getModulesByTypeAsHashmap('relinkhtml', 'name');\n\nexports.name = \"html\";\n\nexports.report = function(text, callback, options) {\n\tvar element = this.nextTag.tag;\n\tvar nestedOptions = Object.create(options);\n\tnestedOptions.settings = this.parser.context;\n\tfor (var operator in htmlOperators) {\n\t\thtmlOperators[operator].report(this.nextTag, this.parser, function(title, blurb, style) {\n\t\t\tcallback(title, '<' + blurb + ' />', style);\n\t\t}, nestedOptions);\n\t}\n\tthis.parse();\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar widgetEntry = {};\n\twidgetEntry.attributes = Object.create(null);\n\twidgetEntry.element = this.nextTag.tag;\n\tvar elem = this.nextTag;\n\tvar originalTag = elem.tag;\n\tvar changed = false;\n\tvar nestedOptions = Object.create(options);\n\tnestedOptions.settings = this.parser.context;\n\tfor (var operator in htmlOperators) {\n\t\tvar entry = htmlOperators[operator].relink(elem, this.parser, fromTitle, toTitle, nestedOptions);\n\t\tif (entry) {\n\t\t\tif (entry.output) {\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tif (entry.impossible) {\n\t\t\t\twidgetEntry.impossible = true;\n\t\t\t}\n\t\t}\n\t}\n\t// We swap in the original tag in case it changed. We need the old tag\n\t// to find the proper closing tag. Parsing must come after the htmlmodules\n\t// because those might change the context for the inner body.\n\tvar newTag = elem.tag;\n\telem.tag = originalTag;\n\tvar tag = this.parse()[0];\n\tif (tag.children) {\n\t\tfor (var i = 0; i < tag.children.length; i++) {\n\t\t\tvar child = tag.children[i];\n\t\t\tif (child.output) {\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tif (child.impossible) {\n\t\t\t\twidgetEntry.impossible = true;\n\t\t\t}\n\t\t}\n\t}\n\tif (changed) {\n\t\tvar builder = new Rebuilder(text, elem.start);\n\t\tbuilder.add(newTag, elem.start+1, getEndOfTag(elem, text));\n\t\tfor (var attributeName in elem.attributes) {\n\t\t\tvar attr = elem.attributes[attributeName];\n\t\t\tvar quotedValue;\n\t\t\tswitch (attr.type) {\n\t\t\tcase 'string':\n\t\t\t\tif (attr.valueless) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tvar quote = relinkUtils.determineQuote(text, attr);\n\t\t\t\tquotedValue = utils.wrapAttributeValue(attr.value, quote)\n\t\t\t\tif (quotedValue === undefined) {\n\t\t\t\t\twidgetEntry.impossible = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 'indirect':\n\t\t\t\tquotedValue = \"{{\" + attr.textReference + \"}}\";\n\t\t\t\tbreak;\n\t\t\tcase 'filtered':\n\t\t\t\tquotedValue = \"{{{\" + attr.filter + \"}}}\";\n\t\t\t\tbreak;\n\t\t\tcase 'macro':\n\t\t\t\tif (attr.output) {\n\t\t\t\t\tquotedValue = attr.output;\n\t\t\t\t} else {\n\t\t\t\t\tquotedValue = undefined;\n\t\t\t\t}\n\t\t\t\t// Else If output isn't set, this wasn't ever changed\n\t\t\t\tbreak;\n\t\t\tcase 'substituted':\n\t\t\t\tvar ticIndex = attr.rawValue.lastIndexOf(\"`\");\n\t\t\t\tif (ticIndex < 0) {\n\t\t\t\t\tquotedValue = \"`\" + attr.rawValue + \"`\";\n\t\t\t\t} else if (ticIndex < attr.rawValue.length-1\n\t\t\t\t\t\t&& attr.rawValue.indexOf(\"```\") < 0) {\n\t\t\t\t\tquotedValue = \"```\" + attr.rawValue + \"```\";\n\t\t\t\t} else {\n\t\t\t\t\t// We can't have a tic at the end; can't have triple tic.\n\t\t\t\t\twidgetEntry.impossible = true;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tvar ptr = attr.start;\n\t\t\tptr = $tw.utils.skipWhiteSpace(text, ptr);\n\t\t\tif (attributeName !== attr.name) {\n\t\t\t\t// Ooh, the attribute name changed\n\t\t\t\tbuilder.add(attr.name, ptr, ptr + attributeName.length);\n\t\t\t}\n\t\t\tif (quotedValue) {\n\t\t\t\t// We have a new attribute value\n\t\t\t\tptr += attributeName.length;\n\t\t\t\tptr = $tw.utils.skipWhiteSpace(text, ptr);\n\t\t\t\tptr++; // For the equals\n\t\t\t\tptr = $tw.utils.skipWhiteSpace(text, ptr);\n\t\t\t\tbuilder.add(quotedValue, ptr, attr.end);\n\t\t\t}\n\t\t}\n\t\tif (tag.children) {\n\t\t\tfor (var i = 0; i < tag.children.length; i++) {\n\t\t\t\tvar child = tag.children[i];\n\t\t\t\tif (child.output) {\n\t\t\t\t\tbuilder.add(child.output, child.start, child.end);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tvar closingTag = '';\n\t\tvar startClosingTag = this.parser.pos - closingTag.length;\n\t\tif (text.substring(startClosingTag, this.parser.pos) === closingTag) {\n\t\t\t// Replace the closing tag in case the tag changed.\n\t\t\tbuilder.add(newTag, startClosingTag + 2, this.parser.pos-1);\n\t\t}\n\t\twidgetEntry.output = builder.results(this.parser.pos);\n\t}\n\tif (widgetEntry.output || widgetEntry.impossible) {\n\t\treturn widgetEntry;\n\t}\n\treturn undefined;\n};\n\nfunction getEndOfTag(element, text) {\n\tvar regExp = /[^a-zA-Z\\-\\$\\.]/g;\n\tregExp.lastIndex = element.start+1;\n\tvar match = regExp.exec(text);\n\treturn match.index;\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/image.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement in wiki text inline rules, like,\n\n[img[tiddler.jpg]]\n\n[img width=23 height=24 [Description|tiddler.jpg]]\n\n\\*/\n\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar refHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/reference\");\nvar filterHandler = require(\"$:/plugins/flibbles/relink/js/utils\").getType('filter');\nvar macrocall = require(\"./macrocall.js\");\nvar utils = require(\"./utils.js\");\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nexports.name = \"image\";\n\nexports.report = function(text, callback, options) {\n\tvar ptr = this.nextImage.start + 4; //[img\n\tvar inSource = false;\n\tfor (var attributeName in this.nextImage.attributes) {\n\t\tvar attr = this.nextImage.attributes[attributeName];\n\t\tif (attributeName === \"source\" || attributeName === \"tooltip\") {\n\t\t\tif (inSource) {\n\t\t\t\tptr = text.indexOf('|', ptr);\n\t\t\t} else {\n\t\t\t\tptr = text.indexOf('[', ptr);\n\t\t\t\tinSource = true;\n\t\t\t}\n\t\t\tptr += 1;\n\t\t}\n\t\tif (attributeName === \"source\") {\n\t\t\tvar tooltip = this.nextImage.attributes.tooltip;\n\t\t\tvar blurb = '[img[' + (tooltip ? tooltip.value : '') + ']]';\n\t\t\tcallback(attr.value, blurb);\n\t\t\tptr = text.indexOf(attr.value, ptr);\n\t\t\tptr = text.indexOf(']]', ptr) + 2;\n\t\t} else if (attributeName !== \"tooltip\") {\n\t\t\tptr = reportAttribute(this.parser, attr, callback, options);\n\t\t}\n\t}\n\tthis.parser.pos = ptr;\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar ptr = this.nextImage.start,\n\t\tbuilder = new Rebuilder(text, ptr),\n\t\tmakeWidget = false,\n\t\tskipSource = false,\n\t\timageEntry;\n\tif (this.nextImage.attributes.source.value === fromTitle && !canBePretty(toTitle, this.nextImage.attributes.tooltip)) {\n\t\tif (this.parser.context.allowWidgets() && utils.wrapAttributeValue(toTitle)) {\n\t\t\tmakeWidget = true;\n\t\t\tbuilder.add(\"<$image\", ptr, ptr+4);\n\t\t} else {\n\t\t\t// We won't be able to make a wdget to replace\n\t\t\t// the source attribute. We check now so we don't\n\t\t\t// prematurely convert into a widget.\n\t\t\t// Keep going in case other attributes need replacing.\n\t\t\tskipSource = true;\n\t\t}\n\t}\n\tptr += 4; //[img\n\tvar inSource = false;\n\tfor (var attributeName in this.nextImage.attributes) {\n\t\tvar attr = this.nextImage.attributes[attributeName];\n\t\tif (attributeName === \"source\" || attributeName === \"tooltip\") {\n\t\t\tif (inSource) {\n\t\t\t\tptr = text.indexOf('|', ptr);\n\t\t\t} else {\n\t\t\t\tptr = text.indexOf('[', ptr);\n\t\t\t\tinSource = true;\n\t\t\t}\n\t\t\tif (makeWidget) {\n\t\t\t\tif (\" \\t\\n\".indexOf(text[ptr-1]) >= 0) {\n\t\t\t\t\tbuilder.add('', ptr, ptr+1);\n\t\t\t\t} else {\n\t\t\t\t\tbuilder.add(' ', ptr, ptr+1);\n\t\t\t\t}\n\t\t\t}\n\t\t\tptr += 1;\n\t\t}\n\t\tif (attributeName === \"source\") {\n\t\t\tptr = text.indexOf(attr.value, ptr);\n\t\t\tif (attr.value === fromTitle) {\n\t\t\t\tif (makeWidget) {\n\t\t\t\t\tvar quotedValue = utils.wrapAttributeValue(toTitle);\n\t\t\t\t\tif (quotedValue === undefined) {\n\t\t\t\t\t\tbuilder.impossible = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbuilder.add(\"source=\"+quotedValue, ptr, ptr+fromTitle.length);\n\t\t\t\t\t}\n\t\t\t\t} else if (!skipSource) {\n\t\t\t\t\tbuilder.add(toTitle, ptr, ptr+fromTitle.length);\n\t\t\t\t} else {\n\t\t\t\t\tbuilder.impossible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tptr = text.indexOf(']]', ptr);\n\t\t\tif (makeWidget) {\n\t\t\t\tbuilder.add(\"/>\", ptr, ptr+2);\n\t\t\t}\n\t\t\tptr += 2;\n\t\t} else if (attributeName === \"tooltip\") {\n\t\t\tif (makeWidget) {\n\t\t\t\tptr = text.indexOf(attr.value, ptr);\n\t\t\t\tvar quotedValue = utils.wrapAttributeValue(attr.value);\n\t\t\t\tbuilder.add(\"tooltip=\"+quotedValue, ptr, ptr+attr.value.length);\n\t\t\t}\n\t\t} else {\n\t\t\tptr = relinkAttribute(this.parser, attr, builder, fromTitle, toTitle, options);\n\t\t}\n\t}\n\tthis.parser.pos = ptr;\n\tif (builder.changed() || builder.impossible) {\n\t\timageEntry = {\n\t\t\toutput: builder.results(ptr),\n\t\t\timpossible: builder.impossible };\n\t}\n\treturn imageEntry;\n};\n\nfunction reportAttribute(parser, attribute, callback, options) {\n\tvar text = parser.source;\n\tvar ptr = text.indexOf(attribute.name, attribute.start);\n\tvar end;\n\tptr += attribute.name.length;\n\tptr = text.indexOf('=', ptr);\n\tif (attribute.type === \"string\") {\n\t\tptr = text.indexOf(attribute.value, ptr)\n\t\tvar quote = relinkUtils.determineQuote(text, attribute);\n\t\t// ignore first quote. We already passed it\n\t\tend = ptr + quote.length + attribute.value.length;\n\t} else if (attribute.type === \"indirect\") {\n\t\tptr = text.indexOf('{{', ptr);\n\t\tvar end = ptr + attribute.textReference.length + 4;\n\t\trefHandler.report(attribute.textReference, function(title, blurb, style) {\n\t\t\tcallback(title, '[img ' + attribute.name + '={{' + (blurb || '') + '}}]', style);\n\t\t}, options);\n\t} else if (attribute.type === \"filtered\") {\n\t\tptr = text.indexOf('{{{', ptr);\n\t\tvar end = ptr + attribute.filter.length + 6;\n\t\tfilterHandler.report(attribute.filter, function(title, blurb, style) {\n\t\t\tcallback(title, '[img ' + attribute.name + '={{{' + blurb + '}}}]', style);\n\t\t}, options);\n\t} else if (attribute.type === \"macro\") {\n\t\tptr = text.indexOf(\"<<\", ptr);\n\t\tvar end = attribute.value.end;\n\t\tvar macro = attribute.value;\n\t\tvar oldValue = attribute.value;\n\t\tmacrocall.reportAttribute(parser, macro, function(title, blurb, style) {\n\t\t\tcallback(title, '[img ' + attribute.name + '=' + blurb + ']', style);\n\t\t}, options);\n\t}\n\treturn end;\n};\n\nfunction relinkAttribute(parser, attribute, builder, fromTitle, toTitle, options) {\n\tvar text = builder.text;\n\tvar ptr = text.indexOf(attribute.name, attribute.start);\n\tvar end;\n\tptr += attribute.name.length;\n\tptr = text.indexOf('=', ptr);\n\tif (attribute.type === \"string\") {\n\t\tptr = text.indexOf(attribute.value, ptr)\n\t\tvar quote = relinkUtils.determineQuote(text, attribute);\n\t\t// ignore first quote. We already passed it\n\t\tend = ptr + quote.length + attribute.value.length;\n\t} else if (attribute.type === \"indirect\") {\n\t\tptr = text.indexOf('{{', ptr);\n\t\tvar end = ptr + attribute.textReference.length + 4;\n\t\tvar ref = refHandler.relinkInBraces(attribute.textReference, fromTitle, toTitle, options);\n\t\tif (ref) {\n\t\t\tif (ref.impossible) {\n\t\t\t\tbuilder.impossible = true;\n\t\t\t}\n\t\t\tif (ref.output) {\n\t\t\t\tbuilder.add(\"{{\"+ref.output+\"}}\", ptr, end);\n\t\t\t}\n\t\t}\n\t} else if (attribute.type === \"filtered\") {\n\t\tptr = text.indexOf('{{{', ptr);\n\t\tvar end = ptr + attribute.filter.length + 6;\n\t\tvar filter = filterHandler.relinkInBraces(attribute.filter, fromTitle, toTitle, options);\n\t\tif (filter !== undefined) {\n\t\t\tif (filter.impossible) {\n\t\t\t\tbuilder.impossible = true;\n\t\t\t}\n\t\t\tif (filter.output) {\n\t\t\t\tvar quoted = \"{{{\"+filter.output+\"}}}\";\n\t\t\t\tbuilder.add(quoted, ptr, end);\n\t\t\t}\n\t\t}\n\t} else if (attribute.type === \"macro\") {\n\t\tptr = text.indexOf(\"<<\", ptr);\n\t\tvar end = attribute.value.end;\n\t\tvar macro = attribute.value;\n\t\tvar oldValue = attribute.value;\n\t\tvar macroEntry = macrocall.relinkAttribute(parser, macro, text, fromTitle, toTitle, options);\n\t\tif (macroEntry !== undefined) {\n\t\t\tif (macroEntry.impossible) {\n\t\t\t\tbuilder.impossible = true;\n\t\t\t}\n\t\t\tif (macroEntry.output) {\n\t\t\t\tbuilder.add(macroEntry.output, ptr, end);\n\t\t\t}\n\t\t}\n\t}\n\treturn end;\n};\n\nfunction canBePretty(title, tooltip) {\n\treturn title.indexOf(']') < 0 && (tooltip || title.indexOf('|') < 0);\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/image.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/import.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles import pragmas\n\n\\import [tag[MyTiddler]]\n\\*/\n\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils.js\");\nvar filterRelinker = utils.getType('filter');\nvar ImportContext = utils.getContext('import');\n\nexports.name = \"import\";\n\nexports.report = function(text, callback, options) {\n\t// This moves the pos for us\n\tvar parseTree = this.parse();\n\tvar filter = parseTree[0].attributes.filter.value || '';\n\tfilterRelinker.report(filter, function(title, blurb, style) {\n\t\tif (blurb) {\n\t\t\tblurb = '\\\\import ' + blurb;\n\t\t} else {\n\t\t\tblurb = '\\\\import';\n\t\t}\n\t\tcallback(title, blurb, style);\n\t}, options);\n\t// Before we go, we need to actually import the variables\n\t// it's calling for, and any /relink pragma\n\toptions.settings = this.parser.context = new ImportContext(options.wiki, this.parser.context, filter);\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\t// In this one case, I'll let the parser parse out the filter and move\n\t// the ptr.\n\tvar start = this.matchRegExp.lastIndex,\n\t\tparseTree = this.parse(),\n\t\tfilter = parseTree[0].attributes.filter.value || '',\n\t\tentry = filterRelinker.relink(filter, fromTitle, toTitle, options);\n\tif (entry !== undefined && entry.output) {\n\t\tvar newline = text.substring(start+filter.length, this.parser.pos);\n\t\tfilter = entry.output;\n\t\tentry.output = \"\\\\import \" + filter + newline;\n\t}\n\n\t// Before we go, we need to actually import the variables\n\t// it's calling for, and any /relink pragma\n\toptions.settings = this.parser.context = new ImportContext(options.wiki, this.parser.context, filter);\n\n\treturn entry;\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/import.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/macrocall.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles macro calls.\n\n<>\n\n\\*/\n\nvar utils = require(\"./utils.js\");\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar macrocall = require('$:/plugins/flibbles/relink/js/utils/macrocall.js');\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar EntryNode = require('$:/plugins/flibbles/relink/js/utils/entry');\n\nexports.name = [\"macrocallinline\", \"macrocallblock\"];\n\nexports.report = function(text, callback, options) {\n\tvar macroInfo = getInfoFromRule(this);\n\tthis.parser.pos = macroInfo.end;\n\tthis.reportAttribute(this.parser, macroInfo, callback, options);\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar macroInfo = getInfoFromRule(this);\n\tthis.parser.pos = macroInfo.end;\n\tvar mayBeWidget = this.parser.context.allowWidgets();\n\tvar names = getParamNames(this.parser, macroInfo.name, macroInfo.params, options);\n\tif (names === undefined) {\n\t\t// Needed the definition, and couldn't find it. So if a single\n\t\t// parameter doesn't work, just fail.\n\t\tmayBeWidget = false;\n\t}\n\tvar entry = macrocall.relink(this.parser.context, macroInfo, text, fromTitle, toTitle, mayBeWidget, options);\n\tif (entry && entry.output) {\n\t\tentry.output = macroToString(entry, text, names, this.parser, options);\n\t\tif (entry.output === undefined) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\n/** Relinks macros that occur as attributes, like <$element attr=<<...>> />\n * Processes the same, except it can't downgrade into a widget if the title\n * is complicated.\n * Kept for backward compatibility reasons\n */\nexports.relinkAttribute = function(parser, macro, text, fromTitle, toTitle, options) {\n\tvar entry = macrocall.relink(parser.context, macro, text, fromTitle, toTitle, false, options);\n\tif (entry && entry.output) {\n\t\tentry.output = macrocall.reassemble(entry, text, options);\n\t}\n\treturn entry;\n};\n\n/** As in, report a macrocall invocation that is an html attribute.\n * Kept for backward compatibility reasons\n */\nexports.reportAttribute = function(parser, macro, callback, options) {\n\tmacrocall.report(parser.context, macro, function(title, blurb, style) {\n\t\tcallback(title, \"<<\" + blurb + \">>\", style);\n\t}, options);\n};\n\nfunction getInfoFromRule(rule) {\n\t// Get all the details of the match\n\tvar macroInfo = rule.nextCall;\n\tif (!macroInfo) {\n\t\t// rule.match is used \";\n};\n\nfunction getParamNames(parser, macroName, params, options) {\n\tvar used = Object.create(null);\n\tvar rtn = new Array(params.length);\n\tvar anonsExist = false;\n\tvar i;\n\tfor (i = 0; i < params.length; i++) {\n\t\tvar name = params[i].name;\n\t\tif (name) {\n\t\t\trtn[i] = name;\n\t\t\tused[name] = true;\n\t\t} else {\n\t\t\tanonsExist = true;\n\t\t}\n\t}\n\tif (anonsExist) {\n\t\tvar def = parser.context.getMacroDefinition(macroName);\n\t\tif (def === undefined) {\n\t\t\t// If there are anonymous parameters, and we can't\n\t\t\t// find the definition, then we can't hope to create\n\t\t\t// a widget.\n\t\t\treturn undefined;\n\t\t}\n\t\tvar defParams = def.params || [];\n\t\tvar defPtr = 0;\n\t\tfor (i = 0; i < params.length; i++) {\n\t\t\tif (rtn[i] === undefined) {\n\t\t\t\twhile(defPtr < defParams.length && used[defParams[defPtr].name]) {\n\t\t\t\t\tdefPtr++;\n\t\t\t\t}\n\t\t\t\tif (defPtr >= defParams.length) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\trtn[i] = defParams[defPtr].name;\n\t\t\t\tused[defParams[defPtr].name] = true;\n\t\t\t}\n\t\t}\n\t}\n\treturn rtn;\n};\n\nfunction parseParams(paramString, pos) {\n\tvar params = [],\n\t\treParam = /\\s*(?:([A-Za-z0-9\\-_]+)\\s*:)?(?:\\s*(?:\"\"\"([\\s\\S]*?)\"\"\"|\"([^\"]*)\"|'([^']*)'|\\[\\[([^\\]]*)\\]\\]|([^\"'\\s]+)))/mg,\n\t\tparamMatch = reParam.exec(paramString);\n\twhile(paramMatch) {\n\t\t// Process this parameter\n\t\tvar paramInfo = { };\n\t\t// We need to find the group match that isn't undefined.\n\t\tfor (var i = 2; i <= 6; i++) {\n\t\t\tif (paramMatch[i] !== undefined) {\n\t\t\t\tparamInfo.value = paramMatch[i];\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif(paramMatch[1]) {\n\t\t\tparamInfo.name = paramMatch[1];\n\t\t}\n\t\t//paramInfo.start = pos;\n\t\tparamInfo.end = reParam.lastIndex + pos;\n\t\tparams.push(paramInfo);\n\t\t// Find the next match\n\t\tparamMatch = reParam.exec(paramString);\n\t}\n\treturn params;\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/macrocall.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/macrodef.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles pragma macro definitions.\nWe may also update placeholder macros that we may have previously installed.\n\n\\define relink-?() Tough title\n\n\\*/\n\n// We inherit from DefRule\nvar DefRule = require('./def.js');\n$tw.utils.extend(exports, DefRule);\n\nexports.name = \"macrodef\";\n\nexports.createDefinition = function() {\n\tvar m = this.match;\n\treturn {\n\t\ttype: \"define\",\n\t\tname: m[1],\n\t\tparameters: m[2],\n\t\tmultiline: m[3]};\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/macrodef.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/parameters.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles parameters pragma.\n\n\\parameters(...)\n\n\\*/\n\nexports.name = \"parameters\";\n\nexports.report = function(text, callback, options) {\n\toperate(this, options);\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\toperate(this, options);\n};\n\nfunction operate(rule, options) {\n\tvar parser = rule.parser;\n\tvar parseTreeNode = rule.parse();\n\tvar attributes = parseTreeNode[0].orderedAttributes;\n\tfor (var i = 0; i < attributes.length; i++) {\n\t\tvar attribute = attributes[i].name;\n\t\tparser.context.addParameter(attribute);\n\t}\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/parameters.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/prettylink.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement in wiki text inline rules, like,\n\n[[Introduction]]\n\n[[link description|TiddlerTitle]]\n\n\\*/\n\nvar utils = require(\"./utils.js\");\n\nexports.name = \"prettylink\";\n\nexports.report = function(text, callback, options) {\n\tvar text = this.match[1],\n\t\tlink = this.match[2] || text;\n\tif (!$tw.utils.isLinkExternal(link)) {\n\t\tcallback(link, '[[' + text + ']]');\n\t}\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar caption, m = this.match;\n\tif (m[2] === fromTitle) {\n\t\t// format is [[caption|MyTiddler]]\n\t\tcaption = m[1];\n\t} else if (m[2] !== undefined || m[1] !== fromTitle) {\n\t\t// format is [[MyTiddler]], and it doesn't match\n\t\treturn undefined;\n\t}\n\tvar entry = { output: utils.makePrettylink(this.parser, toTitle, caption) };\n\tif (entry.output === undefined) {\n\t\tentry.impossible = true;\n\t}\n\treturn entry;\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/prettylink.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/quoteblock.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles the quote blocks, as in:\n\n<<<\n...\n<<<\n\n\\*/\n\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\n\nexports.name = \"quoteblock\";\n\nexports.type = {block: true};\n\nexports.report = function(text, callback, options) {\n\tvar reEndString = \"^\" + this.match[1] + \"(?!<)\";\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\tthis.parser.parseClasses();\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\n\t// Parse the optional cite\n\treportCite(this.parser, this.match[1]);\n\t// Now parse the body of the quote\n\tthis.parser.parseBlocks(reEndString);\n\tif (this.match) {\n\t\t// Now parse the closing cite\n\t\treportCite(this.parser, this.match[1]);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar reEndString = \"^\" + this.match[1] + \"(?!<)\";\n\tvar builder = new Rebuilder(text, this.parser.pos);\n\tvar entry;\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\n\tthis.parser.parseClasses();\n\tthis.parser.skipWhitespace({treatNewlinesAsNonWhitespace: true});\n\n\t// Parse the optional cite\n\tmergeRelinks(builder, this.parser.parseInlineRun(/(\\r?\\n)/mg));\n\t// Now parse the body of the quote\n\tmergeRelinks(builder, this.parser.parseBlocks(reEndString));\n\t// Now parse the closing cite\n\tmergeRelinks(builder, this.parser.parseInlineRun(/(\\r?\\n)/mg));\n\n\tif (builder.changed() || builder.impossible) {\n\t\tentry = {};\n\t\tentry.output = builder.results(this.parser.pos);\n\t\tif (builder.impossible) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\nfunction reportCite(parser, delimeter) {\n\tvar callback = parser.callback;\n\ttry {\n\t\tparser.callback = function(title, blurb, style) {\n\t\t\treturn callback(title, delimeter + \" \" + blurb, style);\n\t\t};\n\t\tparser.parseInlineRun(/(\\r?\\n)/mg);\n\t} finally {\n\t\tparser.callback = callback;\n\t}\n};\n\nfunction mergeRelinks(builder, output) {\n\tif (output.length > 0) {\n\t\tfor (var i = 0; i < output.length; i++) {\n\t\t\tvar o = output[i];\n\t\t\tif (o.output) {\n\t\t\t\tbuilder.add(o.output, o.start, o.end);\n\t\t\t}\n\t\t\tif (o.impossible) {\n\t\t\t\tbuilder.impossible = true;\n\t\t\t}\n\t\t}\n\t}\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/quoteblock.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/relink.js":{"text":"/*\\\nmodule-type: wikirule\n\nThis defines the \\relink inline pragma used to locally declare\nrelink rules for macros.\n\nIt takes care of providing its own relink and report rules.\n\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\nvar pragmaOperators = utils.getModulesByTypeAsHashmap('relinkpragma', 'name');\n\nexports.name = \"relink\";\nexports.types = {pragma: true};\n\nexports.init = function(parser) {\n\tthis.parser = parser;\n\tthis.matchRegExp = /^\\\\relink[^\\S\\r\\n]+([^(\\s]+)([^\\r\\n]*)(\\r?\\n)?/mg;\n};\n\n/**This makes the widget that the macro library will later parse to determine\n * new macro relink state.\n *\n * It's a <$set> widget so it can appear BEFORE \\define pragma and not\n * prevent that pragma from being scooped up by importvariables.\n * (importvariables stops scooping as soon as it sees something besides $set) */\nexports.parse = function() {\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tvar macroName;\n\tvar macroParams = Object.create(null);\n\tvar error = undefined;\n\tvar rtn = [];\n\tvar self = this;\n\tinterpretSettings(this, function(macro, parameter, type) {\n\t\tmacroName = macro;\n\t\tif (type && !utils.getType(type)) {\n\t\t\terror = language.getString(\"text/plain\", \"Error/UnrecognizedType\",\n\t\t\t\t{variables: {type: type}, wiki: self.parser.wiki});\n\t\t}\n\t\tmacroParams[parameter] = type;\n\t});\n\t// If no macroname. Return nothing, this rule will be ignored by parsers\n\tif (macroName) {\n\t\tvar relink = Object.create(null);\n\t\trelink[macroName] = macroParams;\n\t\trtn.push({\n\t\t\ttype: \"set\",\n\t\t\tattributes: {\n\t\t\t\tname: {type: \"string\", value: \"\"}\n\t\t\t},\n\t\t\tchildren: [],\n\t\t\tisRelinkDefinition: true,\n\t\t\tisMacroDefinition: true,\n\t\t\trelink: relink});\n\t}\n\tif (error) {\n\t\trtn.push({\n\t\t\ttype: \"element\", tag: \"span\", attributes: {\n\t\t\t\t\"class\": {\n\t\t\t\t\ttype: \"string\",\n\t\t\t\t\tvalue: \"tc-error tc-relink-error\"\n\t\t\t\t}\n\t\t\t}, children: [\n\t\t\t\t{type: \"text\", text: error}\n\t\t\t]});\n\t}\n\treturn rtn;\n};\n\nexports.report = function(text, callback, options) {\n\toperate(this, options);\n\tfor (var operator in pragmaOperators) {\n\t\tpragmaOperators[operator].report(this, callback, options);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\toperate(this, options);\n\tvar entry;\n\tfor (var operator in pragmaOperators) {\n\t\t// Yes, this only handles one thing for now. I haven't bothered\n\t\t// breaking up \\relink into a modifiable type.\n\t\tentry = pragmaOperators[operator].relink(this, fromTitle, toTitle, options);\n\t}\n\treturn entry;\n};\n\nfunction operate(rule, options) {\n\tvar parser = rule.parser;\n\tvar currentTiddler = parser.context.widget.variables.currentTiddler.value;\n\tparser.pos = rule.matchRegExp.lastIndex;\n\tinterpretSettings(rule, function(macro, parameter, type) {\n\t\toptions.settings.addSetting(parser.wiki, macro, parameter, type, currentTiddler);\n\t});\n\t// Return nothing, because this rule is ignored by the parser\n\treturn undefined;\n};\n\nfunction interpretSettings(rule, block) {\n\tvar paramString = rule.match[2];\n\tif (paramString !== \"\") {\n\t\tvar macro = rule.match[1];\n\t\tvar reParam = /\\s*([$A-Za-z0-9\\-_]+)(?:\\s*:\\s*([^\\s]+))?/mg;\n\t\tvar paramMatch = reParam.exec(paramString);\n\t\twhile (paramMatch) {\n\t\t\tvar parameter = paramMatch[1];\n\t\t\tvar type = paramMatch[2];\n\t\t\tblock(macro, parameter, type);\n\t\t\tparamMatch = reParam.exec(paramString);\n\t\t}\n\t}\n};\n","module-type":"wikirule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/relink.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/rules.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nParses and acknowledges any pragma rules a tiddler has.\n\n\\rules except html wikilink\n\n\\*/\n\nexports.name = \"rules\";\n\n/**This is all we have to do. The rules rule doesn't parse. It just amends\n * the rules, which is exactly what I want it to do too.\n * It also takes care of moving the pos pointer forward.\n */\nexports.relink = function() {\n\tthis.parse();\n\treturn undefined;\n};\n\n// Same deal\nexports.report = exports.relink;\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/rules.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/syslink.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles sys links\n\n$:/sys/link\n\nbut not:\n\n~$:/sys/link\n\n\\*/\n\nvar utils = require(\"./utils.js\");\n\nexports.name = \"syslink\";\n\nexports.report = function(text, callback, options) {\n\tvar title = this.match[0];\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tif (title[0] !== \"~\") {\n\t\tcallback(title, '~' + title);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar entry = undefined;\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tif (this.match[0] === fromTitle && this.match[0][0] !== \"~\") {\n\t\tentry = {output: this.makeSyslink(toTitle, options)};\n\t\tif (entry.output === undefined) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\nexports.makeSyslink = function(title, options) {\n\tvar match = title.match(this.matchRegExp);\n\tif (match && match[0] === title && title[0] !== \"~\") {\n\t\treturn title;\n\t} else {\n\t\treturn utils.makePrettylink(this.parser, title);\n\t}\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/syslink.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/table.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles tables. Or rather handles the cells inside the tables, since tables\nthemselves aren't relinked.\n\n\\*/\n\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\n\nexports.name = \"table\";\n\nexports.types = {block: true};\n\nexports.report = function(text, callback, options) {\n\tvar rowRegExp = /^\\|([^\\n]*)\\|([fhck]?)\\r?(?:\\n|$)/mg,\n\t\trowTermRegExp = /(\\|(?:[fhck]?)\\r?(?:\\n|$))/mg;\n\t// Match the row\n\trowRegExp.lastIndex = this.parser.pos;\n\tvar rowMatch = rowRegExp.exec(this.parser.source);\n\twhile(rowMatch && rowMatch.index === this.parser.pos) {\n\t\tvar rowType = rowMatch[2];\n\t\t// Check if it is a class assignment\n\t\tif(rowType === \"k\") {\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t} else if(rowType === \"c\") {\n\t\t\t// Is this a caption row?\n\t\t\t// If so, move past the opening `|` of the row\n\t\t\tthis.parser.pos++;\n\t\t\t// Parse the caption\n\t\t\tvar oldCallback = this.parser.callback;\n\t\t\tthis.parser.callback = function(title, blurb, style) {\n\t\t\t\tcallback(title, '|' + blurb + '|c', style);\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tthis.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});\n\t\t\t} finally {\n\t\t\t\tthis.parser.callback = oldCallback;\n\t\t\t}\n\t\t} else {\n\t\t\t// Process the row\n\t\t\tprocessRow.call(this, rowType, callback);\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t}\n\t\trowMatch = rowRegExp.exec(this.parser.source);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar rowRegExp = /^\\|([^\\n]*)\\|([fhck]?)\\r?(?:\\n|$)/mg,\n\t\trowTermRegExp = /(\\|(?:[fhck]?)\\r?(?:\\n|$))/mg,\n\t\tbuilder = new Rebuilder(text, this.parser.pos),\n\t\timpossible = false,\n\t\toutput,\n\t\tentry;\n\t// Match the row\n\trowRegExp.lastIndex = this.parser.pos;\n\tvar rowMatch = rowRegExp.exec(this.parser.source);\n\twhile(rowMatch && rowMatch.index === this.parser.pos) {\n\t\tvar rowType = rowMatch[2];\n\t\t// Check if it is a class assignment\n\t\tif(rowType === \"k\") {\n\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t} else {\n\t\t\t// Is this a caption row?\n\t\t\tif(rowType === \"c\") {\n\t\t\t\t// If so, move past the opening `|` of the row\n\t\t\t\tthis.parser.pos++;\n\t\t\t\t// Parse the caption\n\t\t\t\toutput = this.parser.parseInlineRun(rowTermRegExp,{eatTerminator: true});\n\t\t\t} else {\n\t\t\t\t// Process the row\n\t\t\t\toutput = processRow.call(this);\n\t\t\t\tthis.parser.pos = rowMatch.index + rowMatch[0].length;\n\t\t\t}\n\t\t\tif (output.length > 0) {\n\t\t\t\tfor (var i = 0; i < output.length; i++) {\n\t\t\t\t\tvar o = output[i];\n\t\t\t\t\tif (o.output) {\n\t\t\t\t\t\tbuilder.add(o.output, o.start, o.end);\n\t\t\t\t\t}\n\t\t\t\t\tif (o.impossible) {\n\t\t\t\t\t\timpossible = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\trowMatch = rowRegExp.exec(this.parser.source);\n\t}\n\tif (builder.changed() || impossible) {\n\t\tentry = {}\n\t\tentry.output = builder.results(this.parser.pos);\n\t\tif (impossible) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\nvar processRow = function(rowType, callback) {\n\tvar cellRegExp = /(?:\\|([^\\n\\|]*)\\|)|(\\|[fhck]?\\r?(?:\\n|$))/mg,\n\t\tcellTermRegExp = /((?:\\x20*)\\|)/mg,\n\t\tchildren = [];\n\t// Match a single cell\n\tcellRegExp.lastIndex = this.parser.pos;\n\tvar cellMatch = cellRegExp.exec(this.parser.source);\n\twhile(cellMatch && cellMatch.index === this.parser.pos) {\n\t\tif(cellMatch[2]) {\n\t\t\t// End of row\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t\tbreak;\n\t\t}\n\t\tswitch (cellMatch[1]) {\n\t\tcase '~':\n\t\tcase '>':\n\t\tcase '<':\n\t\t\t// Move to just before the `|` terminating the cell\n\t\t\tthis.parser.pos = cellRegExp.lastIndex - 1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t// For ordinary cells, step beyond the opening `|`\n\t\t\tthis.parser.pos++;\n\t\t\t// Look for a space at the start of the cell\n\t\t\tvar spaceLeft = false;\n\t\t\tvar prefix = '|';\n\t\t\tvar suffix = '|';\n\t\t\tif(this.parser.source.substr(this.parser.pos).search(/^\\^([^\\^]|\\^\\^)/) === 0) {\n\t\t\t\tprefix += '^';\n\t\t\t\tthis.parser.pos++;\n\t\t\t} else if(this.parser.source.substr(this.parser.pos).search(/^,([^,]|,,)/) === 0) {\n\t\t\t\tprefix += ',';\n\t\t\t\tthis.parser.pos++;\n\t\t\t}\n\t\t\tvar chr = this.parser.source.substr(this.parser.pos,1);\n\t\t\twhile(chr === \" \") {\n\t\t\t\tspaceLeft = true;\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tchr = this.parser.source.substr(this.parser.pos,1);\n\t\t\t}\n\t\t\tif (spaceLeft) {\n\t\t\t\tprefix += ' ';\n\t\t\t}\n\t\t\t// Check whether this is a heading cell\n\t\t\tif(chr === \"!\") {\n\t\t\t\tthis.parser.pos++;\n\t\t\t\tprefix += '!';\n\t\t\t}\n\t\t\t// Parse the cell\n\t\t\tvar oldCallback = this.parser.callback;\n\t\t\tvar reports = [];\n\t\t\tthis.parser.callback = function(title, blurb, style) {\n\t\t\t\treports.push(title, blurb, style);\n\t\t\t};\n\t\t\ttry {\n\t\t\t\tvar output = this.parser.parseInlineRun(cellTermRegExp,{eatTerminator: true});\n\t\t\t\tif (output.length > 0) {\n\t\t\t\t\tchildren.push(output[0]);\n\t\t\t\t}\n\t\t\t\tif(this.parser.source.substr(this.parser.pos - 2,1) === \" \") { // spaceRight\n\t\t\t\t\tsuffix = ' |';\n\t\t\t\t}\n\t\t\t\tfor (var i = 0; i < reports.length; i += 3) {\n\t\t\t\t\tcallback(reports[i], prefix + reports[i+1] + suffix + rowType, reports[i+2]);\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tthis.parser.callback = oldCallback;\n\t\t\t}\n\t\t\t// Move back to the closing `|`\n\t\t\tthis.parser.pos--;\n\t\t}\n\t\tcellRegExp.lastIndex = this.parser.pos;\n\t\tcellMatch = cellRegExp.exec(this.parser.source);\n\t}\n\treturn children;\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/table.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/transclude.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles replacement of transclusions in wiki text like,\n\n{{RenamedTiddler}}\n{{RenamedTiddler||TemplateTitle}}\n\nThis renames both the tiddler and the template field.\n\n\\*/\n\nvar refHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/reference\");\nvar titleHandler = require(\"$:/plugins/flibbles/relink/js/fieldtypes/title\");\nvar utils = require(\"./utils.js\");\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar referenceOperators = relinkUtils.getModulesByTypeAsHashmap('relinkreference', 'name');\n\nexports.name = ['transcludeinline', 'transcludeblock'];\n\nexports.report = function(text, callback, options) {\n\tvar m = this.match,\n\t\trefString = $tw.utils.trim(m[1]),\n\t\tref = parseTextReference(refString),\n\t\ttemplate = $tw.utils.trim(m[2]),\n\t\tparams = m[3];\n\tfor (var operator in referenceOperators) {\n\t\treferenceOperators[operator].report(ref, function(title, blurb, style) {\n\t\t\tblurb = blurb || \"\";\n\t\t\tif (template) {\n\t\t\t\tblurb += '||' + template;\n\t\t\t}\n\t\t\tif (params) {\n\t\t\t\tblurb += '|' + params;\n\t\t\t}\n\t\t\tcallback(title, \"{{\" + blurb + \"}}\", style);\n\t\t}, options);\n\t}\n\ttitleHandler.report(template, function(title, blurb, style) {\n\t\tvar templateBlurb = refString + '||';\n\t\tif (params) {\n\t\t\ttemplateBlurb += '|' + params;\n\t\t}\n\t\tcallback(template, '{{' + templateBlurb + '}}', style);\n\t}, options);\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar m = this.match,\n\t\treference = parseTextReference(m[1]),\n\t\ttemplate = m[2],\n\t\tparams = m[3],\n\t\tentry = undefined,\n\t\timpossible = false,\n\t\tmodified = false;\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tfor (var operator in referenceOperators) {\n\t\tvar result = referenceOperators[operator].relink(reference, fromTitle, toTitle, options);\n\t\tif (result !== undefined) {\n\t\t\tif (result.impossible) {\n\t\t\t\timpossible = true;\n\t\t\t}\n\t\t\tif (result.output) {\n\t\t\t\treference = result.output;\n\t\t\t\tmodified = true\n\t\t\t}\n\t\t}\n\t}\n\tvar templateEntry = titleHandler.relink($tw.utils.trim(template), fromTitle, toTitle, options);\n\tif (templateEntry) {\n\t\tif (templateEntry.impossible) {\n\t\t\timpossible = true;\n\t\t}\n\t\tif (templateEntry.output) {\n\t\t\ttemplate = template.replace(fromTitle, toTitle);\n\t\t\tmodified = true;\n\t\t}\n\t}\n\tif (modified) {\n\t\tvar output = this.makeTransclude(this.parser, reference, template, params);\n\t\tif (output) {\n\t\t\t// Adding any newline that might have existed is\n\t\t\t// what allows this relink method to work for both\n\t\t\t// the block and inline filter wikitext rule.\n\t\t\tentry = {output: output + utils.getEndingNewline(m[0])};\n\t\t} else {\n\t\t\timpossible = true;\n\t\t}\n\t}\n\tif (impossible) {\n\t\tentry = entry || {};\n\t\tentry.impossible = true;\n\t}\n\treturn entry;\n};\n\n// I have my own because the core one is deficient for my needs.\nfunction parseTextReference(textRef) {\n\t// Separate out the title, field name and/or JSON indices\n\tvar reTextRef = /^([\\w\\W]*?)(?:!!(\\S[\\w\\W]*)|##(\\S[\\w\\W]*))?$/g,\n\t\tmatch = reTextRef.exec(textRef),\n\t\tresult = {};\n\tif(match) {\n\t\t// Return the parts\n\t\tresult.title = match[1];\n\t\tresult.field = match[2];\n\t\tresult.index = match[3];\n\t} else {\n\t\t// If we couldn't parse it\n\t\tresult.title = textRef\n\t}\n\treturn result;\n};\n\n/** This converts a reference and a template into a string representation\n * of a transclude.\n */\nexports.makeTransclude = function(parser, reference, template, params) {\n\tvar rtn;\n\tif (!canBePrettyTemplate(template)) {\n\t\tvar widget = utils.makeWidget(parser, '$transclude', {\n\t\t\ttiddler: $tw.utils.trim(template),\n\t\t\tfield: reference.field,\n\t\t\tindex: reference.index});\n\t\tif (reference.title && widget !== undefined) {\n\t\t\trtn = utils.makeWidget(parser, '$tiddler', {tiddler: $tw.utils.trim(reference.title)}, widget);\n\t\t} else {\n\t\t\trtn = widget;\n\t\t}\n\t} else if (!canBePrettyTitle(reference.title) || !canBePrettyField(reference.field)) {\n\t\t// This block and the next account for the 1%...\n\t\tvar transclude;\n\t\tif (canBePrettyField(reference.field)) {\n\t\t\tvar reducedRef = {field: reference.field, index: reference.index};\n\t\t\ttransclude = prettyTransclude(reducedRef, template, params);\n\t\t} else {\n\t\t\ttransclude = utils.makeWidget(parser, \"$transclude\", {tiddler: $tw.utils.trim(reference.title), field: reference.field});\n\t\t}\n\t\trtn = utils.makeWidget(parser, '$tiddler', {tiddler: $tw.utils.trim(reference.title)}, transclude);\n\t} else {\n\t\t// This block takes care of 99% of all cases\n\t\trtn = prettyTransclude(reference, template, params);\n\t}\n\treturn rtn;\n};\n\nfunction canBePrettyTitle(value) {\n\treturn refHandler.canBePretty(value) && canBePrettyTemplate(value);\n};\n\nfunction canBePrettyField(value) {\n\treturn !/[\\|\\}\\{]/.test(value);\n};\n\nfunction canBePrettyTemplate(value) {\n\treturn !value || (value.indexOf('}') < 0 && value.indexOf('{') < 0 && value.indexOf('|') < 0);\n};\n\nfunction prettyTransclude(textReference, template, params) {\n\tif (typeof textReference !== \"string\") {\n\t\ttextReference = refHandler.toString(textReference);\n\t}\n\tif (!textReference) {\n\t\ttextReference = '';\n\t}\n\tif (template !== undefined) {\n\t\ttextReference += \"||\" + template;\n\t}\n\tif (params) {\n\t\ttextReference += \"|\" + params;\n\t}\n\treturn \"{{\"+textReference+\"}}\";\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/transclude.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/typedblock.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles the typeed blocks, as in:\n\n$$$text/vnd.tiddlywiki>text/html\n...\n$$$\n\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar language = require('$:/plugins/flibbles/relink/js/language.js');\n\nexports.name = \"typedblock\";\n\nexports.types = {block: true};\n\nvar textOperators;\nvar oldTextOperators;\n\nfunction getTextOperator(type, options) {\n\tvar operator;\n\tif (textOperators === undefined) {\n\t\ttextOperators = utils.getModulesByTypeAsHashmap('relinktext', 'type');\n\t\toldTextOperators = utils.getModulesByTypeAsHashmap('relinktextoperator', 'type');\n\t}\n\toperator = textOperators[type];\n\tif (operator) {\n\t\treturn operator;\n\t}\n\tvar info = $tw.utils.getFileExtensionInfo(type);\n\tif (info && textOperators[info.type]) {\n\t\treturn textOperators[info.type];\n\t}\n\tvar old = oldTextOperators[type] || (info && oldTextOperators[info.type]);\n\tif (old) {\n\t\tvar vars = Object.create(options);\n\t\tvars.variables = {type: old.type, keyword: type};\n\t\tvar warnString = language.getString(\"text/html\", \"Warning/OldRelinkTextOperator\", vars)\n\t\tlanguage.warn(warnString);\n\t\toldTextOperators[type] = undefined;\n\t}\n};\n\nfunction getText() {\n\tvar reEnd = /\\r?\\n\\$\\$\\$\\r?(?:\\n|$)/mg;\n\t// Move past the match\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\t// Look for the end of the block\n\treEnd.lastIndex = this.parser.pos;\n\tvar match = reEnd.exec(this.parser.source),\n\t\ttext;\n\t// Process the block\n\tif(match) {\n\t\ttext = this.parser.source.substring(this.parser.pos,match.index);\n\t\tthis.parser.pos = match.index + match[0].length;\n\t} else {\n\t\ttext = this.parser.source.substr(this.parser.pos);\n\t\tthis.parser.pos = this.parser.sourceLength;\n\t}\n\treturn text;\n};\n\nexports.report = function(text, callback, options) {\n\tvar innerText = getText.call(this),\n\t\toperator = getTextOperator(this.match[1], options);\n\tif (operator) {\n\t\treturn operator.report(innerText, callback, options);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar start = this.parser.pos,\n\t\tinnerStart = this.matchRegExp.lastIndex,\n\t\tinnerText = getText.call(this),\n\t\toperator = getTextOperator(this.match[1], options);\n\tif (operator) {\n\t\tvar innerOptions = Object.create(options);\n\t\tinnerOptions.settings = this.parser.context;\n\t\tvar results = operator.relink(innerText, fromTitle, toTitle, innerOptions);\n\t\tif (results && results.output) {\n\t\t\tvar builder = new Rebuilder(text, start);\n\t\t\tbuilder.add(results.output, innerStart, innerStart + innerText.length);\n\t\t\tresults.output = builder.results(this.parser.pos);\n\t\t}\n\t\treturn results;\n\t}\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/typedblock.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/utils.js":{"text":"/*\\\nmodule-type: library\n\nUtility methods for the wikitext relink rules.\n\n\\*/\n\nexports.makeWidget = function(parser, tag, attributes, body) {\n\tif (!parser.context.allowWidgets()) {\n\t\treturn undefined;\n\t}\n\tvar string = '<' + tag;\n\tfor (var attr in attributes) {\n\t\tvar value = attributes[attr];\n\t\tif (value !== undefined) {\n\t\t\tvar quoted = exports.wrapAttributeValue(value);\n\t\t\tif (!quoted) {\n\t\t\t\t// It's not possible to make this widget\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tstring += ' ' + attr + '=' + quoted;\n\t\t}\n\t}\n\tif (body !== undefined) {\n\t\tstring += '>' + body + '';\n\t} else {\n\t\tstring += '/>';\n\t}\n\treturn string;\n};\n\nexports.makePrettylink = function(parser, title, caption) {\n\tvar output;\n\tif (parser.context.allowPrettylinks() && canBePrettylink(title, caption)) {\n\t\tif (caption !== undefined) {\n\t\t\toutput = \"[[\" + caption + \"|\" + title + \"]]\";\n\t\t} else {\n\t\t\toutput = \"[[\" + title + \"]]\";\n\t\t}\n\t} else if (caption !== undefined) {\n\t\tvar safeCaption = sanitizeCaption(parser, caption);\n\t\tif (safeCaption !== undefined) {\n\t\t\toutput = exports.makeWidget(parser, '$link', {to: title}, safeCaption);\n\t\t}\n\t} else if (exports.shorthandPrettylinksSupported(parser.wiki)) {\n\t\toutput = exports.makeWidget(parser, '$link', {to: title});\n\t}\n\treturn output;\n};\n\n/**In version 5.1.20, Tiddlywiki made it so <$link to\"something\" /> would\n * use \"something\" as a caption. This is preferable. However, Relink works\n * going back to 5.1.14, so we need to have different handling for both\n * cases.\n */\nvar _supported;\nexports.shorthandPrettylinksSupported = function(wiki) {\n\tif (_supported === undefined) {\n\t\tvar test = wiki.renderText(\"text/plain\", \"text/vnd.tiddlywiki\", \"<$link to=test/>\");\n\t\t_supported = (test === \"test\");\n\t}\n\treturn _supported;\n};\n\n/**Return true if value can be used inside a prettylink.\n */\nfunction canBePrettylink(value, customCaption) {\n\treturn value.indexOf(\"]]\") < 0 && value[value.length-1] !== ']' && (customCaption !== undefined || value.indexOf('|') < 0);\n};\n\nfunction sanitizeCaption(parser, caption) {\n\tvar plaintext = parser.wiki.renderText(\"text/plain\", \"text/vnd.tiddlywiki\", caption);\n\tif (plaintext === caption && caption.indexOf(\"\") <= 0) {\n\t\treturn caption;\n\t} else {\n\t\treturn exports.makeWidget(parser, '$text', {text: caption});\n\t}\n};\n\nexports.containsPlaceholders = function(string) {\n\t// Does it contain a variable placeholder?\n\tif (/\\$\\(([^\\)\\$]+)\\)\\$/.test(string)) {\n\t\treturn true;\n\t}\n\t// Does it contain a filter placeholder?\n\tvar filterStart = string.indexOf(\"${\");\n\tif (filterStart >= 0 && string.indexOf(\"}$\", filterStart+3) >= 0) {\n\t\treturn true;\n\t}\n\t// If no, then it's just a string.\n\treturn false;\n};\n\nvar whitelist = [\"\", \"'\", '\"', '\"\"\"'];\nvar choices = {\n\t\"\": function(v) {return !/([\\/\\s<>\"'`=])/.test(v) && v.length > 0; },\n\t\"'\": function(v) {return v.indexOf(\"'\") < 0; },\n\t'\"': function(v) {return v.indexOf('\"') < 0; },\n\t'\"\"\"': function(v) {return v.indexOf('\"\"\"') < 0 && v[v.length-1] != '\"';},\n};\nvar _backticksSupported;\n\n/**Finds an appropriate quote mark for a given value.\n *\n *Tiddlywiki doesn't have escape characters for attribute values. Instead,\n * we just have to find the type of quotes that'll work for the given title.\n * There exist titles that simply can't be quoted.\n * If it can stick with the preference, it will.\n *\n * return: Returns the wrapped value, or undefined if it's impossible to wrap\n */\nexports.wrapAttributeValue = function(value, preference) {\n\tif (_backticksSupported === undefined) {\n\t\tvar test = $tw.wiki.renderText(\"text/plain\", \"text/vnd.tiddlywiki\", \"<$link to=`test`/>\");\n\t\t_backticksSupported = (test === \"test\");\n\t\tif (_backticksSupported) {\n\t\t\t// add in support for the backtick to the lists\n\t\t\twhitelist.push('`', '```');\n\t\t\tchoices['`'] = function(v) {return v.indexOf('`') < 0 && !exports.containsPlaceholders(v); };\n\t\t\tchoices['```'] = function(v) {return v.indexOf('```') < 0 && v[v.length-1] != '`' && !exports.containsPlaceholders(v);};\n\t\t}\n\t}\n\tif (choices[preference] && choices[preference](value)) {\n\t\treturn wrap(value, preference);\n\t}\n\tfor (var i = 0; i < whitelist.length; i++) {\n\t\tvar quote = whitelist[i];\n\t\tif (choices[quote](value)) {\n\t\t\treturn wrap(value, quote);\n\t\t}\n\t}\n\t// No quotes will work on this\n\treturn undefined;\n};\n\nfunction wrap(value, wrapper) {\n\tvar wrappers = {\n\t\t\"\": function(v) {return v; },\n\t\t\"'\": function(v) {return \"'\"+v+\"'\"; },\n\t\t'\"': function(v) {return '\"'+v+'\"'; },\n\t\t'\"\"\"': function(v) {return '\"\"\"'+v+'\"\"\"'; },\n\t\t\"[[\": function(v) {return \"[[\"+v+\"]]\"; },\n\t\t\"`\": function(v) {return '`'+v+'`'; },\n\t\t'```': function(v) {return '```'+v+'```'; }\n\t};\n\tvar chosen = wrappers[wrapper];\n\tif (chosen) {\n\t\treturn chosen(value);\n\t} else {\n\t\treturn undefined;\n\t}\n};\n\nfunction canBePrettyOperand(value) {\n\treturn value.indexOf(']') < 0;\n};\n\n// Finds the newline at the end of a string and returns it. Empty string if\n// none exists.\nexports.getEndingNewline = function(string) {\n\tvar l = string.length;\n\tif (string[l-1] === '\\n') {\n\t\treturn (string[l-2] === '\\r') ? \"\\r\\n\" : \"\\n\";\n\t}\n\treturn \"\";\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/utils.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/whitespace.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles whitespace pragma\n\n\\*/\n\nexports.name = \"whitespace\";\n\n// We don't actually do anything, but we can't rely on\n// the default behavior of moving to parser.pos.\n// we have to forward past all the whitespace tokens.\nexports.relink = exports.report = function() { this.parse(); }\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/whitespace.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/wikilink.js":{"text":"/*\\\nmodule-type: relinkwikitextrule\n\nHandles CamelCase links\n\nWikiLink\n\nbut not:\n\n~WikiLink\n\n\\*/\n\nvar utils = require(\"./utils.js\");\n\nexports.name = \"wikilink\";\n\nexports.report = function(text, callback, options) {\n\tvar title = this.match[0],\n\t\tunlink = $tw.config.textPrimitives.unWikiLink;\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tif (title[0] !== unlink) {\n\t\tcallback(title, unlink + title);\n\t}\n};\n\nexports.relink = function(text, fromTitle, toTitle, options) {\n\tvar entry = undefined,\n\t\ttitle = this.match[0];\n\tthis.parser.pos = this.matchRegExp.lastIndex;\n\tif (title === fromTitle && title[0] !== $tw.config.textPrimitives.unWikiLink) {\n\t\tentry = { output: this.makeWikilink(toTitle, options) };\n\t\tif (entry.output === undefined) {\n\t\t\tentry.impossible = true;\n\t\t}\n\t}\n\treturn entry;\n};\n\nexports.makeWikilink = function(title, options) {\n\tif (title.match(this.matchRegExp) && title[0] !== $tw.config.textPrimitives.unWikiLink) {\n\t\treturn title;\n\t} else {\n\t\treturn utils.makePrettylink(this.parser, title);\n\t}\n};\n","module-type":"relinkwikitextrule","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/wikilink.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def/body.js":{"text":"/*\\\n\nTakes care of relinking the bodies of definitions.\n\n\\*/\n\nvar utils = require(\"$:/plugins/flibbles/relink/js/utils\");\n\nexports.name = \"body\";\n\nexports.report = function(definition, callback, options) {\n\tvar handler = getHandler(definition.type, definition.name);\n\tif (handler) {\n\t\tvar newOptions = Object.create(options);\n\t\tvar entry = handler.report(definition.body, function(title, blurb, style) {\n\t\t\tvar macroStr = '\\\\' + definition.type + ' ' + definition.name + '()';\n\t\t\tif (blurb) {\n\t\t\t\tmacroStr += ' ' + blurb;\n\t\t\t}\n\t\t\tcallback(title, macroStr, style);\n\t\t}, newOptions);\n\t}\n};\n\nexports.relink = function(definition, fromTitle, toTitle, options) {\n\tvar handler = getHandler(definition.type, definition.name);\n\tvar results;\n\tif (handler) {\n\t\tvar newOptions = Object.create(options);\n\t\tresults = handler.relink(definition.body, fromTitle, toTitle, newOptions);\n\t\tif (results && results.output) {\n\t\t\tdefinition.body = results.output;\n\t\t}\n\t}\n\treturn results;\n};\n\nfunction getHandler(macroType, macroName) {\n\tvar type;\n\tswitch (macroType) {\n\tcase \"function\":\n\t\ttype = \"filter\";\n\t\tbreak;\n\tcase \"define\":\n\t\t/**This returns the handler to use for a macro\n\t\t * By default, we treat them like wikitext, but Relink used to make\n\t\t * little macros as placeholders. If we find one, we must return\n\t\t * the correct handler for what that placeholder represented.\n\t\t */\n\t\tvar placeholder = /^relink-(?:(\\w+)-)?\\d+$/.exec(macroName);\n\t\t// normal macro or special placeholder?\n\t\tif (placeholder) {\n\t\t\ttype = placeholder[1] || 'title';\n\t\t\tbreak;\n\t\t}\n\tdefault:\n\t\ttype = 'wikitext';\n\t}\n\treturn utils.getType(type);\n};\n","module-type":"relinkdef","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def/body.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def/substitution.js":{"text":"exports.name = 'substitution';\nvar subHandler = require(\"$:/plugins/flibbles/relink/js/utils/substitution.js\");\n\nexports.report = function(definition, callback, options) {\n\tif (definition.type === 'define') {\n\t\tvar options = Object.create(options);\n\t\toptions.noFilterSubstitution = true;\n\t\tsubHandler.report(definition.body, function(title, blurb, style) {\n\t\t\tcallback(title, '\\\\define ' + definition.name + '() ' + (blurb || ''), style);\n\t\t}, options);\n\t}\n};\n\nexports.relink = function(definition, fromTitle, toTitle, options) {\n\tvar results;\n\tif (definition.type === \"define\") {\n\t\tvar options = Object.create(options);\n\t\toptions.noFilterSubstitution = true;\n\t\tresults = subHandler.relink(definition.body, fromTitle, toTitle, options);\n\t\tif (results && results.output) {\n\t\t\tdefinition.body = results.output;\n\t\t}\n\t}\n\treturn results;\n};\n","module-type":"relinkdef","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/def/substitution.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes.js":{"text":"/*\\\n\nHandles all element attribute values. Most widget relinking happens here.\n\n\\*/\n\n'use strict';\n\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar utils = require('../utils.js');\nvar refHandler = relinkUtils.getType('reference');\nvar filterHandler = relinkUtils.getType('filter');\nvar macrocall = require(\"$:/plugins/flibbles/relink/js/utils/macrocall.js\");\nvar substitution = require(\"$:/plugins/flibbles/relink/js/utils/substitution.js\");\nvar attributeOperators = relinkUtils.getModulesByTypeAsHashmap('relinkhtmlattributes', 'name');\n\nexports.name = \"attributes\";\n\nexports.report = function(element, parser, callback, options) {\n\tfor (var attributeName in element.attributes) {\n\t\tvar attr = element.attributes[attributeName];\n\t\tvar nextEql = parser.source.indexOf('=', attr.start);\n\t\t// This is the rare case of changing tiddler\n\t\t// \"true\" to something else when \"true\" is\n\t\t// implicit, like <$link to /> We ignore those.\n\t\tif (nextEql < 0 || nextEql > attr.end) {\n\t\t\tcontinue;\n\t\t}\n\t\tswitch (attr.type) {\n\t\tcase \"string\":\n\t\t\tfor (var operatorName in attributeOperators) {\n\t\t\t\tvar operator = attributeOperators[operatorName];\n\t\t\t\tvar handler = operator.getHandler(element, attr, options);\n\t\t\t\tif (handler) {\n\t\t\t\t\thandler.report(attr.value, function(title, blurb, style) {\n\t\t\t\t\t\tif (operator.formBlurb) {\n\t\t\t\t\t\t\tif (blurb) {\n\t\t\t\t\t\t\t\tblurb = '\"' + blurb + '\"';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback(title, operator.formBlurb(element, attr, blurb, options), style);\n\t\t\t\t\t\t} else if (blurb) {\n\t\t\t\t\t\t\tcallback(title, element.tag + ' ' + attributeName + '=\"' + blurb + '\"', style);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcallback(title, element.tag + ' ' + attributeName, style);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, options);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \"indirect\":\n\t\t\trefHandler.report(attr.textReference, function(title, blurb, style) {\n\t\t\t\tcallback(title, element.tag + ' ' + attributeName + '={{' + (blurb || '') + '}}', style);\n\t\t\t}, options);\n\t\t\tbreak;\n\t\tcase \"filtered\":\n\t\t\tfilterHandler.report(attr.filter, function(title, blurb, style) {\n\t\t\t\tcallback(title, element.tag + ' ' + attributeName + '={{{' + blurb + '}}}', style);\n\t\t\t}, options);\n\t\t\tbreak;\n\t\tcase \"macro\":\n\t\t\tvar macro = attr.value;\n\t\t\tmacrocall.report(options.settings, macro, function(title, blurb, style) {\n\t\t\t\tcallback(title, element.tag + ' ' + attributeName + '=<<' + blurb + '>>', style);\n\t\t\t}, options);\n\t\t\tbreak;\n\t\tcase \"substituted\":\n\t\t\tsubstitution.report(attr.rawValue, function(title, blurb, style) {\n\t\t\t\tcallback(title, element.tag + ' ' + attributeName + '=`' + blurb + '`', style);\n\t\t\t}, options);\n\t\t\tfor (var operatorName in attributeOperators) {\n\t\t\t\tvar operator = attributeOperators[operatorName];\n\t\t\t\tvar handler = operator.getHandler(element, attr, options);\n\t\t\t\tif (handler) {\n\t\t\t\t\thandler.report(attr.rawValue, function(title, blurb, style) {\n\t\t\t\t\t\t// Only consider titles without substitutions.\n\t\t\t\t\t\tif (!utils.containsPlaceholders(title)) {\n\t\t\t\t\t\t\tblurb = (utils.containsPlaceholders(attr.rawValue) || blurb)? '`' + blurb + '`': '';\n\t\t\t\t\t\t\tif (operator.formBlurb) {\n\t\t\t\t\t\t\t\tblurb = operator.formBlurb(element, attr, blurb, options);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tif (blurb) {\n\t\t\t\t\t\t\t\t\tblurb = '=' + blurb;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tblurb = element.tag + ' ' + attributeName + blurb;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tcallback(title, blurb, style);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, options);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t}\n};\n\nexports.relink = function(element, parser, fromTitle, toTitle, options) {\n\tvar changed = undefined, impossible = undefined;\n\tfor (var attributeName in element.attributes) {\n\t\tvar attr = element.attributes[attributeName];\n\t\tvar nextEql = parser.source.indexOf('=', attr.start);\n\t\t// This is the rare case of changing tiddler\n\t\t// \"true\" to something else when \"true\" is\n\t\t// implicit, like <$link to /> We ignore those.\n\t\tif (nextEql < 0 || nextEql > attr.end) {\n\t\t\tattr.valueless = true;\n\t\t\tcontinue;\n\t\t}\n\t\tvar entry = undefined;\n\t\tswitch (attr.type) {\n\t\tcase 'substituted':\n\t\t\tif (utils.containsPlaceholders(attr.rawValue)) {\n\t\t\t\tvar subEntry = substitution.relink(attr.rawValue, fromTitle, toTitle, options);\n\t\t\t\tif (subEntry) {\n\t\t\t\t\tif (subEntry.output) {\n\t\t\t\t\t\tattr.rawValue = subEntry.output;\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t}\n\t\t\t\t\tif (subEntry.impossible) {\n\t\t\t\t\t\timpossible = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!utils.containsPlaceholders(fromTitle)) {\n\t\t\t\t\tfor (var operatorName in attributeOperators) {\n\t\t\t\t\t\tvar operator = attributeOperators[operatorName];\n\t\t\t\t\t\tvar handler = operator.getHandler(element, attr, options);\n\t\t\t\t\t\tif (handler) {\n\t\t\t\t\t\t\tentry = handler.relink(attr.rawValue, fromTitle, toTitle, options);\n\t\t\t\t\t\t\tif (entry && entry.output) {\n\t\t\t\t\t\t\t\tif (utils.containsPlaceholders(toTitle)) {\n\t\t\t\t\t\t\t\t\t// If we relinked, but the toTitle can't be in\n\t\t\t\t\t\t\t\t\t// a substitution, then we must fail instead.\n\t\t\t\t\t\t\t\t\tentry.impossible = true;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tattr.rawValue = entry.output;\n\t\t\t\t\t\t\t\t\tattr.handler = handler.name;\n\t\t\t\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// no break. turn it into a string and try to work with it\n\t\t\tattr.value = attr.rawValue;\n\t\tcase 'string':\n\t\t\tfor (var operatorName in attributeOperators) {\n\t\t\t\tvar operator = attributeOperators[operatorName];\n\t\t\t\tvar handler = operator.getHandler(element, attr, options);\n\t\t\t\tif (handler) {\n\t\t\t\t\tentry = handler.relink(attr.value, fromTitle, toTitle, options);\n\t\t\t\t\tif (entry && entry.output) {\n\t\t\t\t\t\tattr.oldValue = attr.value;\n\t\t\t\t\t\tattr.value = entry.output;\n\t\t\t\t\t\tattr.handler = handler.name;\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\t// Change it into a string if this was a substitution that had no substitutions\n\t\t\t\t\t\tattr.type = 'string';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'indirect':\n\t\t\tentry = refHandler.relinkInBraces(attr.textReference, fromTitle, toTitle, options);\n\t\t\tif (entry && entry.output) {\n\t\t\t\tattr.textReference = entry.output;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'filtered':\n\t\t\tentry = filterHandler.relinkInBraces(attr.filter, fromTitle, toTitle, options);\n\t\t\tif (entry && entry.output) {\n\t\t\t\tattr.filter = entry.output;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 'macro':\n\t\t\tvar macro = attr.value;\n\t\t\tentry = macrocall.relink(options.settings, macro, parser.source, fromTitle, toTitle, false, options);\n\t\t\tif (entry && entry.output) {\n\t\t\t\tattr.output = macrocall.reassemble(entry, parser.source, options);\n\t\t\t\tattr.value = entry.output;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tif (entry && entry.impossible) {\n\t\t\timpossible = true;\n\t\t}\n\t}\n\tif (changed || impossible) {\n\t\treturn {output: changed, impossible: impossible};\n\t}\n};\n","module-type":"relinkhtml","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/importvariables.js":{"text":"/*\\\n\nHandles state updating required for $importvariables widgets\n\n\\*/\n\nvar relinkUtils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar ImportContext = relinkUtils.getContext('import');\n\nexports.name = \"importvariables\";\n\nexports.report = function(element, parser, callback, options) {\n\tif (element.tag === \"$importvariables\") {\n\t\tprocessImport(element, parser, options);\n\t}\n};\n\nexports.relink = function(element, parser, fromTitle, toTitle, options) {\n\tif (element.tag === \"$importvariables\") {\n\t\tprocessImport(element, parser, options);\n\t}\n};\n\nfunction processImport(element, parser, options) {\n\tvar importFilterAttr = element.attributes.filter;\n\tif (importFilterAttr) {\n\t\tprocessImportFilter(parser, importFilterAttr, options);\n\t}\n};\n\n// This processes a <$importvariables> filter attribute and adds any new\n// variables to our parser.\nfunction processImportFilter(parser, importAttribute, options) {\n\tif (typeof importAttribute === \"string\") {\n\t\t// It was changed. Reparse it. It'll be a quoted\n\t\t// attribute value. Add a dummy attribute name.\n\t\timportAttribute = $tw.utils.parseAttribute(\"p=\"+importAttribute, 0)\n\t}\n\tvar context = parser.context;\n\tvar importFilter = computeAttribute(context, importAttribute, options);\n\tparser.context = new ImportContext(options.wiki, context, importFilter);\n};\n\nfunction computeAttribute(context, attribute, options) {\n\tvar value;\n\tif(attribute.type === \"filtered\") {\n\t\tvar parentWidget = context.widget;\n\t\tvalue = options.wiki.filterTiddlers(attribute.filter,parentWidget)[0] || \"\";\n\t} else if(attribute.type === \"indirect\") {\n\t\tvar parentWidget = context.widget;\n\t\tvalue = options.wiki.getTextReference(attribute.textReference,\"\",parentWidget.variables.currentTiddler.value);\n\t} else if(attribute.type === \"macro\") {\n\t\tvar parentWidget = context.widget;\n\t\tvalue = parentWidget.getVariable(attribute.value.name,{params: attribute.value.params});\n\t} else { // String attribute\n\t\tvalue = attribute.value;\n\t}\n\treturn value;\n};\n","module-type":"relinkhtml","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/importvariables.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/parameters.js":{"text":"/*\\\n\nHandles replacement in $macrocall widgets\n\n\\*/\n\nexports.name = \"parameters\";\n\nexports.report = function(element, parser, callback, options) {\n\tif (element.tag === \"$parameters\") {\n\t\tprocessParameters(element, parser, options);\n\t}\n};\n\nexports.relink = function(element, parser, fromTitle, toTitle, options) {\n\tif (element.tag === \"$parameters\") {\n\t\tprocessParameters(element, parser, options);\n\t}\n};\n\nfunction processParameters(element, parser, options) {\n\tvar attributes = element.orderedAttributes;\n\tvar index = 0;\n\tfor (var i = 0; i < attributes.length; i++) {\n\t\tvar attribute = attributes[i].name;\n\t\tif (attribute[0] == '$') {\n\t\t\tif (attribute[1] == '$') {\n\t\t\t\tattribute = attribute.substr(1);\n\t\t\t} else {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tparser.context.addParameter(attribute);\n\t\t++index;\n\t}\n};\n","module-type":"relinkhtml","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/parameters.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/fields.js":{"text":"/*\\ \nHandles replacement in widgets which allow arbitrary attributes that\ncorrespond to tiddler fields.\n\n\\*/\n\nexports.name = \"fields\";\n\nexports.getHandler = function(element, attribute, options) {\n\tvar regexp = options.settings.getConfig(\"fieldattributes\")[element.tag];\n\tif (regexp) {\n\t\tvar results = regexp.exec(attribute.name);\n\t\tif (results && results[0] === attribute.name) {\n\t\t\treturn options.settings.getFields()[results[1]];\n\t\t}\n\t}\n};\n","module-type":"relinkhtmlattributes","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/fields.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/macrocall.js":{"text":"/*\\\n\nHandles replacement in $macrocall widgets\n\n\\*/\n\nexports.name = \"macrocall\";\n\nexports.getHandler = function(element, attribute, options) {\n\tif (element.tag === \"$macrocall\") {\n\t\tvar nameAttr = element.attributes[\"$name\"];\n\t\tif (nameAttr) {\n\t\t\tvar setting = options.settings.getMacro(nameAttr.value);\n\t\t\treturn setting && setting[attribute.name];\n\t\t}\n\t}\n};\n\nexports.formBlurb = function(element, attribute, blurb, options) {\n\tvar nameAttr = element.attributes[\"$name\"];\n\tvar newBlurb = '<' + nameAttr.value + ' ' + attribute.name;\n\tif (blurb) {\n\t\tnewBlurb += '=' + blurb;\n\t}\n\treturn newBlurb;\n};\n","module-type":"relinkhtmlattributes","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/macrocall.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/sendmessage.js":{"text":"/*\\ \nHandles replacement in $action-sendmessage widgets\n\n\\*/\n\nexports.name = \"sendmessage\";\n\nexports.getHandler = function(element, attribute, options) {\n\tif (element.tag === \"$action-sendmessage\"\n\t&& attribute.name[0] !== \"$\") {\n\t\tvar messageAttr = element.attributes['$message'];\n\t\tif (messageAttr) {\n\t\t\tvar regexp = options.settings.getConfig(\"messages\")[messageAttr.value];\n\t\t\tif (regexp) {\n\t\t\t\tvar results = regexp.exec(attribute.name);\n\t\t\t\tif (results && results[0] === attribute.name) {\n\t\t\t\t\treturn options.settings.getFields()[results[1]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nexports.formBlurb = function(element, attribute, blurb, options) {\n\tvar messageAttr = element.attributes['$message'];\n\tvar newBlurb = '$action-sendmessage ' + messageAttr.value + ' ' + attribute.name;\n\tif (blurb) {\n\t\tnewBlurb += '=' + blurb;\n\t}\n\treturn newBlurb;\n};\n","module-type":"relinkhtmlattributes","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/sendmessage.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/transclude.js":{"text":"/*\\\n\nHandles replacement in $transclude widgets\n\n\\*/\n\nexports.name = \"transclude\";\n\nexports.getHandler = function(element, attribute, options) {\n\tif (element.tag === \"$transclude\") {\n\t\tvar name = attribute.name;\n\t\tif (name[0] === '$') {\n\t\t\tif (name[1] === '$') {\n\t\t\t\tname = name.substr(1);\n\t\t\t} else {\n\t\t\t\t// This is a reserved attribute\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tvar nameAttr = element.attributes[\"$variable\"];\n\t\tif (nameAttr) {\n\t\t\tvar setting = options.settings.getMacro(nameAttr.oldValue || nameAttr.value);\n\t\t\treturn setting && setting[name];\n\t\t}\n\t}\n};\n\nexports.formBlurb = function(element, attribute, blurb, options) {\n\tvar nameAttr = element.attributes[\"$variable\"];\n\tvar name = attribute.name;\n\tif (name[0] === '$') {\n\t\tname = name.substr(1);\n\t}\n\tvar newBlurb = '<' + nameAttr.value + ' ' + name;\n\tif (blurb) {\n\t\tnewBlurb += '=' + blurb;\n\t}\n\treturn newBlurb;\n};\n","module-type":"relinkhtmlattributes","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/transclude.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/whitelist.js":{"text":"/*\\ \n\nHandles replacement of widget attributes that are specified in the whitelist.\n\n\\*/\n\nexports.name = \"whitelist\";\n\nexports.getHandler = function(element, attribute, options) {\n\tvar setting = options.settings.getAttribute(element.tag);\n\treturn setting && setting[attribute.name];\n};\n","module-type":"relinkhtmlattributes","title":"$:/plugins/flibbles/relink/js/relinkoperations/text/wikitext/html/attributes/whitelist.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/context.js":{"text":"/*\\\n\nBase class for relink contexts.\n\n\\*/\n\nfunction Context() {\n};\n\nexports.context = Context;\n\n// This class does no special handling of fields, operators, or attributes.\n// we pass it along to the parent.\nContext.prototype.getFields = function() {\n\treturn this.parent.getFields();\n};\n\nContext.prototype.getOperator = function(name, index) {\n\treturn this.parent.getOperator(name, index);\n};\n\nContext.prototype.getOperators = function() {\n\treturn this.parent.getOperators();\n};\n\nContext.prototype.getAttribute = function(elementName) {\n\treturn this.parent.getAttribute(elementName);\n};\n\nContext.prototype.getAttributes = function() {\n\treturn this.parent.getAttributes();\n};\n\nContext.prototype.getConfig = function(category) {\n\treturn this.parent.getConfig(category);\n};\n\nContext.prototype.getMacro = function(macroName) {\n\treturn this.parent.getMacro(macroName);\n};\n\nContext.prototype.getMacros = function() {\n\treturn this.parent.getMacros();\n};\n\n/* Exceptions are tiddlers that have text/vnd.tiddlywiki type, but should\n * not be treated as such.\n */\nContext.prototype.getException = function(tiddlerTitle) {\n\treturn this.parent.getException(tiddlerTitle);\n};\n\nContext.prototype.allowPrettylinks = function() {\n\treturn this.parent.allowPrettylinks();\n};\n\nContext.prototype.allowWidgets = function() {\n\treturn this.parent.allowWidgets();\n};\n\nContext.prototype.hasImports = function(value) {\n\treturn this.parent.hasImports(value);\n};\n\nContext.prototype.getFocus = function() {\n\tif (this.parent) {\n\t\treturn this.parent.getFocus();\n\t}\n};\n\nContext.prototype.getPlaceholderList = function() {\n\tif (this.parent) {\n\t\treturn this.parent.getPlaceholderList();\n\t}\n\treturn null;\n};\n\nContext.prototype.addParameter = function(parameter) {\n\tif(this.parent) {\n\t\treturn this.parent.addParameter(parameter);\n\t}\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/context.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/import.js":{"text":"/*\\\n\nThis handles the fetching and distribution of relink settings.\n\n\\*/\n\nvar WidgetContext = require('./widget').widget;\n\nfunction ImportContext(wiki, parent, filter) {\n\tthis.parent = parent;\n\tthis.wiki = wiki;\n\tvar importWidget = createImportWidget(filter, this.wiki, this.parent.widget);\n\tthis._compileList(importWidget.tiddlerList, importWidget.variables);\n\t// this.widget is where we ask for macro definitions.\n\t// This only works if only one filter is imported\n\tthis.widget = this.getBottom(importWidget);\n\t// We keep this one because it's where we need to test for changes from.\n\tthis.importWidget = importWidget\n\t// Trickle this up, so that any containing tiddlercontext knows that this\n\t// tiddler does some importing, and must be checked regularly.\n\tparent.hasImports(true);\n};\n\nexports.import = ImportContext;\n\nImportContext.prototype = new WidgetContext();\n\nImportContext.prototype.changed = function(changes) {\n\treturn this.importWidget && this.importWidget.refresh(changes)\n};\n\nfunction createImportWidget(filter, wiki, parent) {\n\tvar widget = wiki.makeWidget( { tree: [{\n\t\ttype: \"importvariables\",\n\t\tattributes: {\n\t\t\t\"filter\": {\n\t\t\t\ttype: \"string\",\n\t\t\t\tvalue: filter\n\t\t\t}\n\t\t}\n\t}] }, { parentWidget: parent} );\n\tif (parent) {\n\t\tparent.children.push(widget);\n\t}\n\twidget.execute();\n\twidget.renderChildren();\n\tvar importWidget = widget.children[0];\n\treturn importWidget;\n};\n\nImportContext.prototype._compileList = function(titleList, variables) {\n\tfor (var i = 0; i < titleList.length; i++) {\n\t\tvar parser = this.wiki.parseTiddler(titleList[i]);\n\t\tif (parser) {\n\t\t\tvar parseTreeNode = parser.tree[0];\n\t\t\twhile (parseTreeNode && parseTreeNode.type === \"set\") {\n\t\t\t\tvar variable = variables[parseTreeNode.attributes.name.value];\n\t\t\t\tif(variable) {\n\t\t\t\t\tvariable.tiddler = titleList[i];\n\t\t\t\t}\n\t\t\t\tif (parseTreeNode.relink) {\n\t\t\t\t\tfor (var macroName in parseTreeNode.relink) {\n\t\t\t\t\t\tvar parameters = parseTreeNode.relink[macroName];\n\t\t\t\t\t\tfor (var paramName in parameters) {\n\t\t\t\t\t\t\tthis.addSetting(this.wiki, macroName, paramName, parameters[paramName], titleList[i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tparseTreeNode = parseTreeNode.children && parseTreeNode.children[0];\n\t\t\t}\n\t\t}\n\t}\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/import.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/tiddler.js":{"text":"/*\\\n\nContext for a tiddler. Defines nothing but makes an entry point to test if\na tiddler must be refreshed.\n\n\\*/\n\nvar WidgetContext = require('./widget.js').widget;\n\nfunction TiddlerContext(wiki, parentContext, title) {\n\tthis.title = title;\n\tthis.parent = parentContext;\n\tvar globalWidget = parentContext && parentContext.widget;\n\tvar parentWidget = wiki.makeWidget(null, {parentWidget: globalWidget});\n\tparentWidget.setVariable('currentTiddler', title);\n\tthis.widget = wiki.makeWidget(null, {parentWidget: parentWidget});\n};\n\nexports.tiddler = TiddlerContext;\n\nTiddlerContext.prototype = new WidgetContext();\n\nTiddlerContext.prototype.getFocus = function() {\n\t// Tiddler Contexts are the last possible focus when not embedded in contexts.\n\treturn this;\n};\n\nTiddlerContext.prototype.changed = function(changes) {\n\treturn this.widget && this.widget.refresh(changes);\n};\n\n// By default, a tiddler context does not use imports, unless an import\n// statement is later discovered somewhere in the fields.\nTiddlerContext.prototype.hasImports = function(value) {\n\treturn this._hasImports || (this._hasImports = value);\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/tiddler.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/variable.js":{"text":"/*\\\n\nThis handles the context for variables. Either from $set, $vars, or \\define\n\n\\*/\n\nvar WidgetContext = require('./widget').widget;\n\nfunction VariableContext(parent, setParseTreeNode) {\n\tvar name = setParseTreeNode.attributes.name.value;\n\tthis.parent = parent;\n\t// Now create a new widget and attach it.\n\tvar attachPoint = parent.widget;\n\tthis.setWidget = attachPoint.makeChildWidget(setParseTreeNode);\n\tattachPoint.children.push(this.setWidget);\n\tthis.setWidget.computeAttributes();\n\tthis.setWidget.execute();\n\t// We get the title of our current parameter focus\n\t// (i.e. what \\param would affect)\n\t// If it's another definition, then title will be null.\n\tthis.setWidget.variables[name].tiddler = parent.getFocus().title;\n\t// point our widget to bottom, where any other contexts would attach to\n\tthis.widget = this.getBottom(this.setWidget);\n\tthis.parameterFocus = true;\n\tif (setParseTreeNode.isMacroDefinition) {\n\t\tthis.placeholderList = Object.create(parent.getPlaceholderList());\n\t\tfor (var i = 0; i < setParseTreeNode.params.length; i++) {\n\t\t\tthis.placeholderList[setParseTreeNode.params[i].name] = true;\n\t\t}\n\t}\n};\n\nexports.variable = VariableContext;\n\nVariableContext.prototype = new WidgetContext();\n\nVariableContext.prototype.getFocus = function() {\n\tif(this.parameterFocus) {\n\t\treturn this;\n\t} else {\n\t\treturn this.parent.getFocus();\n\t}\n};\n\nVariableContext.prototype.getPlaceholderList = function() {\n\tif (this.placeholderList !== undefined) {\n\t\treturn this.placeholderList;\n\t} else {\n\t\treturn this.parent.getPlaceholderList();\n\t}\n};\n\nVariableContext.prototype.addParameter = function(parameter) {\n\tif(this.parameterFocus) {\n\t\tvar name = this.setWidget.setName;\n\t\tvar data = this.setWidget.variables[name];\n\t\tdata.params.push({name: parameter});\n\t} else if (this.parent) {\n\t\tthis.parent.addParameter(parameter);\n\t}\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/variable.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/whitelist.js":{"text":"/*\\\n\nThis top-level context manages settings inside the whitelist. It never has\na parent.\n\n\\*/\n\nvar utils = require('../utils');\nvar Context = require('./context').context;\n\nvar prefix = \"$:/config/flibbles/relink/\";\n\n/**Factories define methods that create settings given config tiddlers.\n * for factory method 'example', it will be called once for each:\n * \"$:/config/flibbles/relink/example/...\" tiddler that exists.\n * the argument \"key\" will be set to the contents of \"...\"\n *\n * The reason I build relink settings in this convoluted way is to minimize\n * the number of times tiddlywiki has to run through EVERY tiddler looking\n * for relink config tiddlers.\n */\nvar settingsGenerators = utils.getModulesByTypeAsHashmap('relinksetting', 'name');\n\nfunction WhitelistContext(wiki) {\n\tbuild(this, wiki);\n};\n\nexports.whitelist = WhitelistContext;\n\nWhitelistContext.prototype = new Context();\n\n/**Hot directories are directories for which if anything changes inside them,\n * then Relink must completely rebuild its index.\n * By default, this includes the whitelist settings, but relink-titles also\n * includes its rules disabling directory.\n * This is the FIRST solution I came up with to this problem. If you're\n * looking at this, please make a github issue so I have a chance to understand\n * your needs. This is currently a HACK solution.\n */\nWhitelistContext.hotDirectories = [prefix];\n\nWhitelistContext.prototype.getAttribute = function(elementName) {\n\treturn this.attributes[elementName];\n};\n\nWhitelistContext.prototype.getAttributes = function() {\n\treturn flatten(this.attributes);\n};\n\nWhitelistContext.prototype.getFields = function() {\n\treturn this.fields;\n};\n\nWhitelistContext.prototype.getConfig = function(category) {\n\treturn this[category];\n};\n\nWhitelistContext.prototype.getOperator = function(operatorName, operandIndex) {\n\tvar op = this.operators[operatorName];\n\treturn op && op[operandIndex || 1];\n};\n\nWhitelistContext.prototype.getOperators = function() {\n\tvar signatures = Object.create(null);\n\tfor (var op in this.operators) {\n\t\tvar operandSet = this.operators[op];\n\t\tfor (var index in operandSet) {\n\t\t\tvar entry = operandSet[index];\n\t\t\tsignatures[entry.key] = entry;\n\t\t}\n\t}\n\treturn signatures;\n};\n\nWhitelistContext.prototype.getMacro = function(macroName) {\n\treturn this.macros[macroName];\n};\n\nWhitelistContext.prototype.getMacros = function() {\n\treturn flatten(this.macros);\n};\n\nWhitelistContext.prototype.getException = function(tiddlerTitle) {\n\treturn this.exceptions[tiddlerTitle];\n};\n\nWhitelistContext.prototype.changed = function(changedTiddlers) {\n\tfor (var i = 0; i < WhitelistContext.hotDirectories.length; i++) {\n\t\tvar dir = WhitelistContext.hotDirectories[i];\n\t\tfor (var title in changedTiddlers) {\n\t\t\tif (title.substr(0, dir.length) === dir) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n};\n\nWhitelistContext.prototype.hasImports = function(value) {\n\t// We don't care if imports are used. This is the global level.\n\treturn false;\n};\n\nfunction build(settings, wiki) {\n\tfor (var name in settingsGenerators) {\n\t\tsettings[name] = Object.create(null);\n\t}\n\twiki.eachShadowPlusTiddlers(function(tiddler, title) {\n\t\tif (title.substr(0, prefix.length) === prefix) {\n\t\t\tvar remainder = title.substr(prefix.length);\n\t\t\tvar category = root(remainder);\n\t\t\tvar factory = settingsGenerators[category];\n\t\t\tif (factory) {\n\t\t\t\tvar name = remainder.substr(category.length+1);\n\t\t\t\tfactory.generate(settings[category], tiddler, name, wiki);\n\t\t\t}\n\t\t}\n\t});\n};\n\n/* Returns first bit of a path. path/to/tiddler -> path\n */\nfunction root(string) {\n\tvar index = string.indexOf('/');\n\tif (index >= 0) {\n\t\treturn string.substr(0, index);\n\t}\n};\n\n/* Turns {dir: {file1: 'value1', file2: 'value2'}}\n * into {dir/file1: 'value1', dir/file2: 'value2'}\n */\nfunction flatten(set) {\n\tvar signatures = Object.create(null);\n\tfor (var outerName in set) {\n\t\tvar setItem = set[outerName];\n\t\tfor (var innerName in setItem) {\n\t\t\tsignatures[outerName + \"/\" + innerName] = setItem[innerName];\n\t\t}\n\t}\n\treturn signatures;\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/whitelist.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/widget.js":{"text":"/*\\\n\nThis is a virtual subclass of context for contexts that exist within widgets\nof a specific tiddler.\n\nAll widget contexts must have a widget member.\n\n\\*/\n\nvar Context = require('./context.js').context;\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nfunction WidgetContext() {};\n\nexports.widget = WidgetContext;\n\nWidgetContext.prototype = new Context();\n\nWidgetContext.prototype.getMacroDefinition = function(variableName) {\n\t// widget.variables is prototyped, so it looks up into all its parents too\n\tvar def = this.widget.variables[variableName];\n\tif (!def) {\n\t\t// It might be a javascript macro\n\t\tdef = $tw.macros[variableName];\n\t\tif (def && !def.tiddler) {\n\t\t\t// We haven't assigned associated tiddlers to these macros yet.\n\t\t\t// That may be important for some installed supplemental plugins.\n\t\t\t$tw.modules.forEachModuleOfType('macro', function(title, module) {\n\t\t\t\tif (module.name) {\n\t\t\t\t\t// For now, we just attach it directly to the definition\n\t\t\t\t\t// It's easier, albeit a little sloppy.\n\t\t\t\t\t$tw.macros[module.name].tiddler = title;\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn def;\n};\n\nWidgetContext.prototype.addSetting = function(wiki, macroName, parameter, type, sourceTitle) {\n\tthis.macros = this.macros || Object.create(null);\n\tvar macro = this.macros[macroName];\n\ttype = type || utils.getDefaultType(wiki);\n\tif (macro === undefined) {\n\t\tmacro = this.macros[macroName] = Object.create(null);\n\t}\n\tvar handler = utils.getType(type);\n\tif (handler) {\n\t\thandler.source = sourceTitle;\n\t\tmacro[parameter] = handler;\n\t}\n};\n\nWidgetContext.prototype.getMacros = function() {\n\tvar signatures = this.parent.getMacros();\n\tif (this.macros) {\n\t\tfor (var macroName in this.macros) {\n\t\t\tvar macro = this.macros[macroName];\n\t\t\tfor (var param in macro) {\n\t\t\t\tsignatures[macroName + \"/\" + param] = macro[param];\n\t\t\t}\n\t\t}\n\t}\n\treturn signatures;\n};\n\n/**This does strange handling because it's possible for a macro to have\n * its individual parameters whitelisted in separate places.\n * Don't know WHY someone would do this, but it can happen.\n */\nWidgetContext.prototype.getMacro = function(macroName) {\n\tvar theseSettings = this.macros && this.macros[macroName];\n\tvar parentSettings;\n\tif (this.parent) {\n\t\tparentSettings = this.parent.getMacro(macroName);\n\t}\n\tif (theseSettings && parentSettings) {\n\t\t// gotta merge them without changing either. This is expensive,\n\t\t// but it'll happen rarely.\n\t\tvar rtnSettings = $tw.utils.extend(Object.create(null), theseSettings, parentSettings);\n\t\treturn rtnSettings;\n\t}\n\treturn theseSettings || parentSettings;\n};\n\nWidgetContext.prototype.getAttribute = function(elementName) {\n\tif (elementName.charAt(0) == '$' && elementName.indexOf('.') >= 0) {\n\t\t// This is potentially a \\widget, look in macros for it.\n\t\tvar macroSettings = this.getMacro(elementName);\n\t\tif (macroSettings) {\n\t\t\t// Make sure that it's actually a widget definition\n\t\t\tvar def = this.getMacroDefinition(elementName);\n\t\t\tif (def) {\n\t\t\t\t// We found a definition, but if it's not a widget, abort all.\n\t\t\t\treturn (def.isWidgetDefinition)? macroSettings: undefined;\n\t\t\t}\n\t\t}\n\t}\n\treturn this.parent.getAttribute(elementName);\n};\n\nWidgetContext.prototype.getOperator = function(name, index) {\n\tif (name.indexOf('.') >= 0) {\n\t\t// This is potentially a \\function, look in macros for it.\n\t\tvar macroSettings = this.getMacro(name);\n\t\tif (macroSettings) {\n\t\t\t//Make sure that it's actually a macro definition\n\t\t\tvar def = this.getMacroDefinition(name);\n\t\t\tif (def) {\n\t\t\t\tif (def.isFunctionDefinition) {\n\t\t\t\t\t// Minus one because operator indices are 1 indexed,\n\t\t\t\t\t// but parameters as we store them are not.\n\t\t\t\t\tvar param = def.params[index - 1];\n\t\t\t\t\treturn param && macroSettings[param.name];\n\t\t\t\t}\n\t\t\t\t// If it's not a filter, abort all.\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t}\n\treturn this.parent.getOperator(name, index);\n};\n\n/**Returns the deepest descendant of the given widget.\n */\nWidgetContext.prototype.getBottom = function(widget) {\n\twhile (widget.children.length > 0) {\n\t\twidget = widget.children[0];\n\t}\n\treturn widget;\n};\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/widget.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/contexts/wikitext.js":{"text":"/*\\\n\nContext for wikitext. It can contain rules about what's allowed in this\ncurrent layer of wikitext.\n\n\\*/\n\nvar WidgetContext = require('./widget.js').widget;\n\nfunction WikitextContext(parentContext) {\n\tthis.parent = parentContext;\n\tthis.widget = parentContext.widget;\n};\n\nexports.wikitext = WikitextContext;\n\nWikitextContext.prototype = new WidgetContext();\n\n// Unless this specific context has rules about it, widgets and prettyLInks are allowed.\nWikitextContext.prototype.allowWidgets = enabled;\nWikitextContext.prototype.allowPrettylinks = enabled;\n\nfunction enabled() { return true; };\n","module-type":"relinkcontext","title":"$:/plugins/flibbles/relink/js/contexts/wikitext.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils/backupIndexer.js":{"text":"/*\\\nmodule-type: library\n\nThis is a backup indexer Relink uses if the real one is disabled, or we're\n [\"string\", ...]\n */\n\nEntryNode.newType = function() {\n\treturn EntryNode;\n};\n\nEntryNode.prototype.add = function(entry) {\n\tthis.children.push(entry);\n};\n\nfunction EntryCollection() {\n\tthis.children = Object.create(null);\n\tthis.types = Object.create(null);\n};\n\nEntryNode.newCollection = function(name) {\n\treturn EntryCollection;\n};\n\n// Again. I reiterate. Don't use this. All this is just legacy support.\nObject.defineProperty(EntryCollection, 'impossible', {\n\tget: function() {\n\t\tvar imp = this._impossible;\n\t\tthis.eachChild(function(child) { imp = imp || child.impossible; });\n\t\treturn imp;\n\t},\n\tset: function(impossible) {\n\t\tthis._impossible = true;\n\t}\n});\n\nEntryCollection.prototype.eachChild = function(method) {\n\tfor (var child in this.children) {\n\t\tmethod(this.children[child]);\n\t}\n};\n\nEntryCollection.prototype.addChild = function(child, name, type) {\n\tthis.children[name] = child;\n\tthis.types[name] = type;\n};\n\nEntryCollection.prototype.hasChildren = function() {\n\treturn Object.keys(this.children).length > 0;\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/utils/entry.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils/macrocall.js":{"text":"/*\\\n\nMethods for reporting and relinking macros. Behaves much like a fieldtype, except that it's not.\n\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar Rebuilder = require(\"$:/plugins/flibbles/relink/js/utils/rebuilder\");\nvar macrocallOperators = utils.getModulesByTypeAsHashmap('relinkmacrocall', 'name');\n\n/** As in, report a macrocall invocation that is an html attribute.\n * macro: must be a macro object.*/\nexports.report = function(context, macro, callback, options) {\n\tfor (var operator in macrocallOperators) {\n\t\tmacrocallOperators[operator].report(context, macro, callback, options);\n\t}\n};\n\n/**Processes the given macro,\n * macro: {name:, params:, start:, end:}\n * each parameters: {name:, end:, value:}\n * Macro invocation returned is the same, but relinked, and may have new keys:\n * parameters: {type: macro, start:, newValue: (quoted replacement value)}\n * Output of the returned entry isn't a string, but a macro object. It needs\n * to be converted.\n */\nexports.relink = function(context, macro, text, fromTitle, toTitle, mayBeWidget, options) {\n\tvar entry;\n\tfor (var operator in macrocallOperators) {\n\t\tvar results = macrocallOperators[operator].relink(context, macro, text, fromTitle, toTitle, options);\n\t\tif (results) {\n\t\t\tentry = entry || {};\n\t\t\tif (results.impossible) {\n\t\t\t\tentry.impossible = true;\n\t\t\t}\n\t\t\tif (results.output) {\n\t\t\t\tmacro = results.output;\n\t\t\t\tentry.output = macro;\n\t\t\t}\n\t\t}\n\t}\n\treturn entry;\n};\n\n/**Converts the macro object into a string, includes the <<..>>.\n * The text is the old text the macro was formed from. It's used to preserve\n * whitespace.\n */\nexports.reassemble = function(entry, text, options) {\n\tvar macro = entry.output;\n\tvar builder = new Rebuilder(text, macro.start);\n\tvar varAttribute = macro.attributes && macro.attributes['$variable'];\n\tif (varAttribute && varAttribute.value !== macro.name) {\n\t\t// The name of the macro changed. Update it.\n\t\tbuilder.add(varAttribute.value, macro.start + 2, macro.start + 2 + macro.name.length);\n\t}\n\tfor (var i = 0; i < macro.params.length; i++) {\n\t\tvar param = macro.params[i];\n\t\tif (param.modified) {\n\t\t\tvar newValue = exports.wrapParameterValue(param.value, param.quote);\n\t\t\tif (newValue === undefined) {\n\t\t\t\tentry.impossible = true;\n\t\t\t} else {\n\t\t\t\tbuilder.add(newValue, param.start, param.end);\n\t\t\t}\n\t\t}\n\t}\n\treturn builder.results(macro.end);\n};\n\n\n/**Like wrapAttribute value, except for macro parameters, not attributes.\n *\n * These are more permissive. Allows brackets,\n * and slashes and '<' in unquoted values.\n */\nexports.wrapParameterValue = function(value, preference) {\n\tvar whitelist = [\"\", \"'\", '\"', '[[', '\"\"\"'];\n\tvar choices = {\n\t\t\"\": function(v) {return !/([\\s>\"':])/.test(v); },\n\t\t\"'\": function(v) {return v.indexOf(\"'\") < 0; },\n\t\t'\"': function(v) {return v.indexOf('\"') < 0; },\n\t\t\"[[\": canBePrettyOperand,\n\t\t'\"\"\"': function(v) {return v.indexOf('\"\"\"') < 0 && v[v.length-1] != '\"';}\n\t};\n\tif (choices[preference] && choices[preference](value)) {\n\t\treturn wrap(value, preference);\n\t}\n\tfor (var i = 0; i < whitelist.length; i++) {\n\t\tvar quote = whitelist[i];\n\t\tif (choices[quote](value)) {\n\t\t\treturn wrap(value, quote);\n\t\t}\n\t}\n\t// No quotes will work on this\n\treturn undefined;\n};\n\nfunction canBePrettyOperand(value) {\n\treturn value.indexOf(']') < 0;\n};\n\n\nfunction wrap(value, wrapper) {\n\tvar wrappers = {\n\t\t\"\": function(v) {return v; },\n\t\t\"'\": function(v) {return \"'\"+v+\"'\"; },\n\t\t'\"': function(v) {return '\"'+v+'\"'; },\n\t\t'\"\"\"': function(v) {return '\"\"\"'+v+'\"\"\"'; },\n\t\t\"[[\": function(v) {return \"[[\"+v+\"]]\"; }\n\t};\n\tvar chosen = wrappers[wrapper];\n\tif (chosen) {\n\t\treturn chosen(value);\n\t} else {\n\t\treturn undefined;\n\t}\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/utils/macrocall.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils/rebuilder.js":{"text":"/*\\\n\nThis helper class aids in reconstructing an existing string with new parts.\n\n\\*/\n\nfunction Rebuilder(text, start) {\n\tthis.text = text;\n\tthis.index = start || 0;\n\tthis.pieces = [];\n};\n\nmodule.exports = Rebuilder;\n\n/**Pieces must be added consecutively.\n * Start and end are the indices in the old string specifying where to graft\n * in the new piece.\n */\nRebuilder.prototype.add = function(value, start, end) {\n\tthis.pieces.push(this.text.substring(this.index, start), value);\n\tthis.index = end;\n};\n\nRebuilder.prototype.changed = function() {\n\treturn this.pieces.length > 0;\n};\n\nRebuilder.prototype.results = function(end) {\n\tif (this.changed()) {\n\t\tthis.pieces.push(this.text.substring(this.index, end));\n\t\treturn this.pieces.join('');\n\t}\n\treturn undefined;\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/utils/rebuilder.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils/substitution.js":{"text":"/*\\\n\nHandles relinking substitution text, like strings containing $(this)$.\n\n\\*/\n\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\nvar filterHandler = utils.getType('filter');\nvar macrocallHandler = require(\"./macrocall.js\");\n\nexports.report = function(string, callback, options) {\n\tif (!options.noFilterSubstitution) {\n\t\tvar filterRegex = /\\$\\{([\\S\\s]+?)\\}\\$/g, filter;\n\t\twhile (filter = filterRegex.exec(string)) {\n\t\t\tfilterHandler.report(filter[1], function(title, blurb, style) {\n\t\t\t\tcallback(title, '${' + blurb + '}$', style);\n\t\t\t}, options);\n\t\t}\n\t}\n\tvar varRegex = /\\$\\(([^\\)\\$]+)\\)\\$/g, varMatch;\n\twhile (varMatch = varRegex.exec(string)) {\n\t\tmacrocallHandler.report(options.settings, {name: varMatch[1], params: []}, function(title, blurb, style) {\n\t\t\tcallback(title, '$(' + blurb + ')$', style);\n\t\t}, options);\n\t}\n};\n\nexports.relink = function(string, fromTitle, toTitle, options) {\n\tvar entry;\n\tvar changed = false;\n\tvar newValue = string;\n\tif (!options.noFilterSubstitution) {\n\t\tnewValue = newValue.replace(/\\$\\{([\\S\\s]+?)\\}\\$/g, function(match, filter) {\n\t\t\tvar filterEntry = filterHandler.relink(filter, fromTitle, toTitle, options);\n\t\t\tif (filterEntry) {\n\t\t\t\tentry = entry || {};\n\t\t\t\tif (filterEntry.output) {\n\t\t\t\t\t// The only }$ should be the one at the very end\n\t\t\t\t\tif (filterEntry.output.indexOf(\"}$\") < 0) {\n\t\t\t\t\t\tchanged = true;\n\t\t\t\t\t\tmatch = '${' + filterEntry.output + '}$';\n\t\t\t\t\t} else {\n\t\t\t\t\t\tentry.impossible = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (filterEntry.impossible) {\n\t\t\t\t\tentry.impossible = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn match;\n\t\t});\n\t}\n\tnewValue = newValue.replace(/\\$\\(([^\\)\\$]+)\\)\\$/g, function(match, varname) {\n\t\tvar macroEntry = macrocallHandler.relink(options.settings, {name: varname, params: []}, string, fromTitle, toTitle, false, options);\n\t\tif (macroEntry) {\n\t\t\tentry = entry || {};\n\t\t\tif (macroEntry.output) {\n\t\t\t\tvar newTitle = macroEntry.output.attributes.$variable.value;\n\t\t\t\tif (newTitle.indexOf('$') >= 0 || newTitle.indexOf(')') >= 0) {\n\t\t\t\t\tentry.impossible = true;\n\t\t\t\t} else {\n\t\t\t\t\tchanged = true;\n\t\t\t\t\tmatch = '$(' + newTitle + ')$';\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (macroEntry.impossible) {\n\t\t\t\tentry.impossible = true;\n\t\t\t}\n\t\t}\n\t\treturn match;\n\t});\n\tif (changed) {\n\t\tentry.output = newValue;\n\t}\n\treturn entry;\n};\n","module-type":"library","title":"$:/plugins/flibbles/relink/js/utils/substitution.js","type":"application/javascript"},"$:/plugins/flibbles/relink/js/utils/macrocall/parameters.js":{"text":"var utils = require('$:/plugins/flibbles/relink/js/utils.js');\n\nexports.name = \"parameters\";\n\n// Error thrown when a macro's definition is needed, but can't be found.\nfunction CannotFindMacroDef() {};\nCannotFindMacroDef.prototype.impossible = true;\nCannotFindMacroDef.prototype.name = \"macroparam\";\n// Failed relinks due to missing definitions aren't reported for now.\n// I may want to do something special later on.\nCannotFindMacroDef.prototype.report = function() { return []; };\n\nexports.report = function(context, macro, callback, options) {\n\tvar managedMacro = context.getMacro(macro.name);\n\tif (!managedMacro) {\n\t\t// We don't manage this macro. Bye.\n\t\treturn undefined;\n\t}\n\tfor (var managedArg in managedMacro) {\n\t\tvar index;\n\t\ttry {\n\t\t\tindex = getParamIndexWithinMacrocall(context, macro.name, managedArg, macro.params, options);\n\t\t} catch (e) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (index < 0) {\n\t\t\t// The argument was not supplied. Move on to next.\n\t\t\tcontinue;\n\t\t}\n\t\tvar param = macro.params[index];\n\t\tvar handler = managedMacro[managedArg];\n\t\tvar nestedOptions = Object.create(options);\n\t\tnestedOptions.settings = context;\n\t\tvar entry = handler.report(param.value, function(title, blurb, style) {\n\t\t\tvar rtn = managedArg;\n\t\t\tif (blurb) {\n\t\t\t\trtn += ': \"' + blurb + '\"';\n\t\t\t}\n\t\t\tcallback(title, macro.name + ' ' + rtn, style);\n\t\t}, nestedOptions);\n\t}\n};\n\nexports.relink = function(context, macro, text, fromTitle, toTitle, options) {\n\tvar managedMacro = context.getMacro(macro.name);\n\tvar modified = false;\n\tif (!managedMacro) {\n\t\t// We don't manage this macro. Bye.\n\t\treturn undefined;\n\t}\n\tvar outMacro = $tw.utils.extend({}, macro);\n\tvar macroEntry = {};\n\toutMacro.params = macro.params.slice();\n\tfor (var managedArg in managedMacro) {\n\t\tvar index;\n\t\ttry {\n\t\t\tindex = getParamIndexWithinMacrocall(context, macro.name, managedArg, macro.params, options);\n\t\t} catch (e) {\n\t\t\tif (e instanceof CannotFindMacroDef) {\n\t\t\t\tmacroEntry.impossible = true;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (index < 0) {\n\t\t\t// this arg either was not supplied, or we can't find\n\t\t\t// the definition, so we can't tie it to an anonymous\n\t\t\t// argument. Either way, move on to the next.\n\t\t\tcontinue;\n\t\t}\n\t\tvar param = macro.params[index];\n\t\tvar handler = managedMacro[managedArg];\n\t\tvar nestedOptions = Object.create(options);\n\t\tnestedOptions.settings = context;\n\t\tvar entry = handler.relink(param.value, fromTitle, toTitle, nestedOptions);\n\t\tif (entry === undefined) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Macro parameters can only be string parameters, not\n\t\t// indirect, or macro, or filtered\n\t\tif (entry.impossible) {\n\t\t\tmacroEntry.impossible = true;\n\t\t}\n\t\tif (!entry.output) {\n\t\t\tcontinue;\n\t\t}\n\t\tvar quote = utils.determineQuote(text, param);\n\t\tvar newParam = $tw.utils.extend({}, param);\n\t\tnewParam.start = newParam.end - (newParam.value.length + (quote.length*2));\n\t\tnewParam.value = entry.output;\n\t\tnewParam.quote = quote;\n\t\tnewParam.modified = true;\n\t\toutMacro.params[index] = newParam;\n\t\tmodified = true;\n\t}\n\tif (modified || macroEntry.impossible) {\n\t\tif (modified) {\n\t\t\tmacroEntry.output = outMacro;\n\t\t}\n\t\treturn macroEntry;\n\t}\n\treturn undefined;\n};\n\n/** Returns -1 if param definitely isn't in macrocall.\n */\nfunction getParamIndexWithinMacrocall(context, macroName, param, params, options) {\n\tvar index, i, anonsExist = false;\n\tfor (i = 0; i < params.length; i++) {\n\t\tvar name = params[i].name;\n\t\tif (name === param) {\n\t\t\treturn i;\n\t\t}\n\t\tif (name === undefined) {\n\t\t\tanonsExist = true;\n\t\t}\n\t}\n\tif (!anonsExist) {\n\t\t// If no anonymous parameters are present, and we didn't find\n\t\t// it among the named ones, it must not be there.\n\t\treturn -1;\n\t}\n\tvar expectedIndex = indexOfParameterDef(context, macroName, param, options);\n\t// We've got to skip over all the named parameter instances.\n\tif (expectedIndex >= 0) {\n\t\tvar anonI = 0;\n\t\tfor (i = 0; i < params.length; i++) {\n\t\t\tif (params[i].name === undefined) {\n\t\t\t\tif (anonI === expectedIndex) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t\tanonI++;\n\t\t\t} else {\n\t\t\t\tvar indexOfOther = indexOfParameterDef(context, macroName, params[i].name, options);\n\t\t\t\tif (indexOfOther < expectedIndex) {\n\t\t\t\t\tanonI++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n};\n\n// Looks up the definition of a macro, and figures out what the expected index\n// is for the given parameter.\nfunction indexOfParameterDef(context, macroName, paramName, options) {\n\tvar def = context.getMacroDefinition(macroName);\n\tif (def === undefined) {\n\t\tthrow new CannotFindMacroDef();\n\t}\n\tvar params = def.params || [];\n\tfor (var i = 0; i < params.length; i++) {\n\t\tif (params[i].name === paramName) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n};\n\n","module-type":"relinkmacrocall","title":"$:/plugins/flibbles/relink/js/utils/macrocall/parameters.js","type":"application/javascript"},"$:/plugins/flibbles/relink/Filters/Missing":{"title":"$:/plugins/flibbles/relink/Filters/Missing","description":"{{$:/plugins/flibbles/relink/language/Filters/Missing}}","filter":"[all[]!is[system]relink:references:hard[]!is[tiddler]!is[shadow]!prefix[$:/tags/]sort[title]] -[[]]","tags":"$:/tags/Filter"},"$:/plugins/flibbles/relink/Filters/Orphans":{"title":"$:/plugins/flibbles/relink/Filters/Orphans","description":"{{$:/plugins/flibbles/relink/language/Filters/Orphans}}","filter":"[relink:orphans[]!is[system]sort[title]]","tags":"$:/tags/Filter"},"$:/config/flibbles/relink/attributes/$action-deletefield/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$action-deletefield/$tiddler","text":"filter"},"$:/config/flibbles/relink/attributes/$action-deletetiddler/$filter":{"title":"$:/config/flibbles/relink/attributes/$action-deletetiddler/$filter","text":"filter"},"$:/config/flibbles/relink/attributes/$action-deletetiddler/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$action-deletetiddler/$tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$action-listops/$filter":{"title":"$:/config/flibbles/relink/attributes/$action-listops/$filter","text":"filter"},"$:/config/flibbles/relink/attributes/$action-listops/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$action-listops/$tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$action-log/$$filter":{"title":"$:/config/flibbles/relink/attributes/$action-log/$$filter","text":"filter"},"$:/config/flibbles/relink/attributes/$action-navigate/$to":{"title":"$:/config/flibbles/relink/attributes/$action-navigate/$to","text":"title"},"$:/config/flibbles/relink/attributes/$action-popup/$state":{"title":"$:/config/flibbles/relink/attributes/$action-popup/$state","text":"title"},"$:/config/flibbles/relink/attributes/$action-sendmessage/$names":{"title":"$:/config/flibbles/relink/attributes/$action-sendmessage/$names","text":"filter"},"$:/config/flibbles/relink/attributes/$action-sendmessage/$values":{"title":"$:/config/flibbles/relink/attributes/$action-sendmessage/$values","text":"filter"},"$:/config/flibbles/relink/attributes/$action-setfield/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$action-setfield/$tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$fields":{"title":"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$fields","text":"filter"},"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$indexes":{"title":"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$indexes","text":"filter"},"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$values":{"title":"$:/config/flibbles/relink/attributes/$action-setmultiplefields/$values","text":"filter"},"$:/config/flibbles/relink/attributes/$button/actions":{"title":"$:/config/flibbles/relink/attributes/$button/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$button/set":{"title":"$:/config/flibbles/relink/attributes/$button/set","text":"reference"},"$:/config/flibbles/relink/attributes/$button/setTo":{"title":"$:/config/flibbles/relink/attributes/$button/setTo","text":"title"},"$:/config/flibbles/relink/attributes/$button/to":{"title":"$:/config/flibbles/relink/attributes/$button/to","text":"title"},"$:/config/flibbles/relink/attributes/$checkbox/actions":{"title":"$:/config/flibbles/relink/attributes/$checkbox/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$checkbox/checkactions":{"title":"$:/config/flibbles/relink/attributes/$checkbox/checkactions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$checkbox/tiddler":{"title":"$:/config/flibbles/relink/attributes/$checkbox/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$checkbox/tag":{"title":"$:/config/flibbles/relink/attributes/$checkbox/tag","text":"title"},"$:/config/flibbles/relink/attributes/$checkbox/uncheckactions":{"title":"$:/config/flibbles/relink/attributes/$checkbox/uncheckactions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$count/filter":{"title":"$:/config/flibbles/relink/attributes/$count/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$draggable/tiddler":{"title":"$:/config/flibbles/relink/attributes/$draggable/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$draggable/filter":{"title":"$:/config/flibbles/relink/attributes/$draggable/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$droppable/actions":{"title":"$:/config/flibbles/relink/attributes/$droppable/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$dropzone/actions":{"title":"$:/config/flibbles/relink/attributes/$dropzone/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$edit-bitmap/tiddler":{"title":"$:/config/flibbles/relink/attributes/$edit-bitmap/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$edit-text/tiddler":{"title":"$:/config/flibbles/relink/attributes/$edit-text/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$edit/inputActions":{"title":"$:/config/flibbles/relink/attributes/$edit/inputActions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$edit/refreshTitle":{"title":"$:/config/flibbles/relink/attributes/$edit/refreshTitle","text":"title"},"$:/config/flibbles/relink/attributes/$edit/tiddler":{"title":"$:/config/flibbles/relink/attributes/$edit/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$encrypt/filter":{"title":"$:/config/flibbles/relink/attributes/$encrypt/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$fieldmangler/tiddler":{"title":"$:/config/flibbles/relink/attributes/$fieldmangler/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$fields/tiddler":{"title":"$:/config/flibbles/relink/attributes/$fields/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$genesis/$names":{"title":"$:/config/flibbles/relink/attributes/$genesis/$names","text":"filter"},"$:/config/flibbles/relink/attributes/$genesis/$values":{"title":"$:/config/flibbles/relink/attributes/$genesis/$values","text":"filter"},"$:/config/flibbles/relink/attributes/$image/source":{"title":"$:/config/flibbles/relink/attributes/$image/source","text":"title"},"$:/config/flibbles/relink/attributes/$importvariables/filter":{"title":"$:/config/flibbles/relink/attributes/$importvariables/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$jsontiddler/tiddler":{"title":"$:/config/flibbles/relink/attributes/$jsontiddler/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$keyboard/actions":{"title":"$:/config/flibbles/relink/attributes/$keyboard/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$linkcatcher/to":{"title":"$:/config/flibbles/relink/attributes/$linkcatcher/to","text":"title"},"$:/config/flibbles/relink/attributes/$linkcatcher/set":{"title":"$:/config/flibbles/relink/attributes/$linkcatcher/set","text":"title"},"$:/config/flibbles/relink/attributes/$link/to":{"title":"$:/config/flibbles/relink/attributes/$link/to","text":"title"},"$:/config/flibbles/relink/attributes/$link/tooltip":{"title":"$:/config/flibbles/relink/attributes/$link/tooltip","text":"wikitext"},"$:/config/flibbles/relink/attributes/$linkcatcher/actions":{"title":"$:/config/flibbles/relink/attributes/$linkcatcher/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$list/filter":{"title":"$:/config/flibbles/relink/attributes/$list/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$list/template":{"title":"$:/config/flibbles/relink/attributes/$list/template","text":"title"},"$:/config/flibbles/relink/attributes/$list/editTemplate":{"title":"$:/config/flibbles/relink/attributes/$list/editTemplate","text":"title"},"$:/config/flibbles/relink/attributes/$list/emptyMessage":{"title":"$:/config/flibbles/relink/attributes/$list/emptyMessage","text":"wikitext"},"$:/config/flibbles/relink/attributes/$list/history":{"title":"$:/config/flibbles/relink/attributes/$list/history","text":"title"},"$:/config/flibbles/relink/attributes/$log/$$filter":{"title":"$:/config/flibbles/relink/attributes/$log/$$filter","text":"filter"},"$:/config/flibbles/relink/attributes/$messagecatcher/actions":{"title":"$:/config/flibbles/relink/attributes/$messagecatcher/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$navigator/story":{"title":"$:/config/flibbles/relink/attributes/$navigator/story","text":"title"},"$:/config/flibbles/relink/attributes/$navigator/history":{"title":"$:/config/flibbles/relink/attributes/$navigator/history","text":"title"},"$:/config/flibbles/relink/attributes/$radio/actions":{"title":"$:/config/flibbles/relink/attributes/$radio/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$radio/tiddler":{"title":"$:/config/flibbles/relink/attributes/$radio/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$range/actions":{"title":"$:/config/flibbles/relink/attributes/$range/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$range/actionsStart":{"title":"$:/config/flibbles/relink/attributes/$range/actionsStart","text":"wikitext"},"$:/config/flibbles/relink/attributes/$range/actionsStop":{"title":"$:/config/flibbles/relink/attributes/$range/actionsStop","text":"wikitext"},"$:/config/flibbles/relink/attributes/$range/tiddler":{"title":"$:/config/flibbles/relink/attributes/$range/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$reveal/state":{"title":"$:/config/flibbles/relink/attributes/$reveal/state","text":"reference"},"$:/config/flibbles/relink/attributes/$reveal/stateTitle":{"title":"$:/config/flibbles/relink/attributes/$reveal/stateTitle","text":"title"},"$:/config/flibbles/relink/attributes/$select/actions":{"title":"$:/config/flibbles/relink/attributes/$select/actions","text":"wikitext"},"$:/config/flibbles/relink/attributes/$select/tiddler":{"title":"$:/config/flibbles/relink/attributes/$select/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$setvariable/tiddler":{"title":"$:/config/flibbles/relink/attributes/$setvariable/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$setvariable/subtiddler":{"title":"$:/config/flibbles/relink/attributes/$setvariable/subtiddler","text":"title"},"$:/config/flibbles/relink/attributes/$setvariable/filter":{"title":"$:/config/flibbles/relink/attributes/$setvariable/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$set/tiddler":{"title":"$:/config/flibbles/relink/attributes/$set/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$set/subtiddler":{"title":"$:/config/flibbles/relink/attributes/$set/subtiddler","text":"title"},"$:/config/flibbles/relink/attributes/$set/filter":{"title":"$:/config/flibbles/relink/attributes/$set/filter","text":"filter"},"$:/config/flibbles/relink/attributes/$setmultiplevariables/$names":{"title":"$:/config/flibbles/relink/attributes/$setmultiplevariables/$names","text":"filter"},"$:/config/flibbles/relink/attributes/$setmultiplevariables/$values":{"title":"$:/config/flibbles/relink/attributes/$setmultiplevariables/$values","text":"filter"},"$:/config/flibbles/relink/attributes/$tiddler/tiddler":{"title":"$:/config/flibbles/relink/attributes/$tiddler/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$transclude/tiddler":{"title":"$:/config/flibbles/relink/attributes/$transclude/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$transclude/$tiddler":{"title":"$:/config/flibbles/relink/attributes/$transclude/$tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$transclude/subtiddler":{"title":"$:/config/flibbles/relink/attributes/$transclude/subtiddler","text":"title"},"$:/config/flibbles/relink/attributes/$transclude/$subtiddler":{"title":"$:/config/flibbles/relink/attributes/$transclude/$subtiddler","text":"title"},"$:/config/flibbles/relink/attributes/$view/tiddler":{"title":"$:/config/flibbles/relink/attributes/$view/tiddler","text":"title"},"$:/config/flibbles/relink/attributes/$view/subtiddler":{"title":"$:/config/flibbles/relink/attributes/$view/subtiddler","text":"title"},"$:/config/flibbles/relink/attributes/$wikify/text":{"title":"$:/config/flibbles/relink/attributes/$wikify/text","text":"wikitext"},"$:/plugins/flibbles/relink/configuration":{"title":"$:/plugins/flibbles/relink/configuration","text":"\\whitespace trim\n
\n<>\n
\n"},"$:/config/flibbles/relink/exceptions/$:/DefaultTiddlers":{"title":"$:/config/flibbles/relink/exceptions/$:/DefaultTiddlers","text":"application/x-tiddler-filter"},"$:/config/flibbles/relink/exceptions/$:/config/FileSystemPaths":{"title":"$:/config/flibbles/relink/exceptions/$:/config/FileSystemPaths","text":"application/x-tiddler-filter"},"$:/config/flibbles/relink/exceptions/$:/config/FileSystemExtensions":{"title":"$:/config/flibbles/relink/exceptions/$:/config/FileSystemExtensions","text":"application/x-tiddler-filter"},"$:/config/flibbles/relink/fieldattributes/$action-createtiddler":{"title":"$:/config/flibbles/relink/fieldattributes/$action-createtiddler","text":"([^$].*)"},"$:/config/flibbles/relink/fieldattributes/$action-deletefield":{"title":"$:/config/flibbles/relink/fieldattributes/$action-deletefield","text":"([^$].*)"},"$:/config/flibbles/relink/fieldattributes/$action-setfield":{"title":"$:/config/flibbles/relink/fieldattributes/$action-setfield","text":"([^$].*)"},"$:/config/flibbles/relink/fieldattributes/$jsontiddler":{"title":"$:/config/flibbles/relink/fieldattributes/$jsontiddler","text":"\\$(.*)"},"$:/config/flibbles/relink/fields/caption":{"title":"$:/config/flibbles/relink/fields/caption","text":"wikitext"},"$:/config/flibbles/relink/fields/filter":{"title":"$:/config/flibbles/relink/fields/filter","text":"filter"},"$:/config/flibbles/relink/fields/list":{"title":"$:/config/flibbles/relink/fields/list","text":"list"},"$:/config/flibbles/relink/fields/list-after":{"title":"$:/config/flibbles/relink/fields/list-after","text":"title"},"$:/config/flibbles/relink/fields/list-before":{"title":"$:/config/flibbles/relink/fields/list-before","text":"title"},"$:/config/flibbles/relink/fields/tags":{"title":"$:/config/flibbles/relink/fields/tags","text":"list"},"$:/plugins/flibbles/relink/language/Buttons/Delete/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/Delete/Hint","text":"delete"},"$:/plugins/flibbles/relink/language/Buttons/LinkToInline/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/LinkToInline/Hint","text":"go to defining tiddler"},"$:/plugins/flibbles/relink/language/Buttons/NewAttribute/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewAttribute/Hint","text":"Specify a new widget/element attribute to be updated whenever a tiddler is renamed"},"$:/plugins/flibbles/relink/language/Buttons/NewAttribute/Caption":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewAttribute/Caption","text":"add"},"$:/plugins/flibbles/relink/language/Buttons/NewField/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewField/Hint","text":"Specify a new field to be updated whenever a tiddler is renamed"},"$:/plugins/flibbles/relink/language/Buttons/NewField/Caption":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewField/Caption","text":"add"},"$:/plugins/flibbles/relink/language/Buttons/NewOperator/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewOperator/Hint","text":"Specify a new filter operator to be considered whenever a tiddler is renamed"},"$:/plugins/flibbles/relink/language/Buttons/NewOperator/Caption":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewOperator/Caption","text":"add"},"$:/plugins/flibbles/relink/language/Buttons/NewParameter/Hint":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewParameter/Hint","text":"Specify a new macro parameter to be updated whenever a tiddler is renamed"},"$:/plugins/flibbles/relink/language/Buttons/NewParameter/Caption":{"title":"$:/plugins/flibbles/relink/language/Buttons/NewParameter/Caption","text":"add"},"$:/plugins/flibbles/relink/language/Error/InvalidAttributeName":{"title":"$:/plugins/flibbles/relink/language/Error/InvalidAttributeName","text":"Illegal characters in attribute name \"<$text text=<>/>\". Attributes cannot contain slashes ('/'), closing angle or square brackets ('>' or ']'), quotes or apostrophes ('\"' or \"'\"), equals ('='), or whitespace"},"$:/plugins/flibbles/relink/language/Error/InvalidElementName":{"title":"$:/plugins/flibbles/relink/language/Error/InvalidElementName","text":"Illegal characters in element/widget name \"<$text text=<>/>\". Element tags can only contain letters and the characters hyphen (`-`) and dollar sign (`$`)"},"$:/plugins/flibbles/relink/language/Error/InvalidMacroName":{"title":"$:/plugins/flibbles/relink/language/Error/InvalidMacroName","text":"Illegal characters in macro name \"<$text text=<>/>\". Macros cannot contain whitespace"},"$:/plugins/flibbles/relink/language/Error/InvalidParameterName":{"title":"$:/plugins/flibbles/relink/language/Error/InvalidParameterName","text":"Illegal characters in parameter name \"<$text text=<>/>\". Parameters can only contain letters, digits, and the characters underscore (`_`) and hyphen (`-`)"},"$:/plugins/flibbles/relink/language/Error/RelinkFilterOperator":{"title":"$:/plugins/flibbles/relink/language/Error/RelinkFilterOperator","text":"Filter Error: Unknown suffix for the 'relink' filter operator"},"$:/plugins/flibbles/relink/language/Error/ReportFailedRelinks":{"title":"$:/plugins/flibbles/relink/language/Error/ReportFailedRelinks","text":"Relink could not update '<>' to '<>' inside the following tiddlers:"},"$:/plugins/flibbles/relink/language/Error/UnrecognizedType":{"title":"$:/plugins/flibbles/relink/language/Error/UnrecognizedType","text":"Relink parse error: Unrecognized field type '<>'"},"$:/plugins/flibbles/relink/language/Filters/Missing":{"title":"$:/plugins/flibbles/relink/language/Filters/Missing","text":"//Relink// Missing tiddlers"},"$:/plugins/flibbles/relink/language/Filters/Orphans":{"title":"$:/plugins/flibbles/relink/language/Filters/Orphans","text":"//Relink// Orphans tiddlers"},"$:/plugins/flibbles/relink/language/Help/Attributes":{"title":"$:/plugins/flibbles/relink/language/Help/Attributes","text":"See the Attributes documentation page for details."},"$:/plugins/flibbles/relink/language/Help/Fields":{"title":"$:/plugins/flibbles/relink/language/Help/Fields","text":"See the Fields documentation page for details."},"$:/plugins/flibbles/relink/language/Help/Macros":{"title":"$:/plugins/flibbles/relink/language/Help/Macros","text":"See the Macros documentation page for details."},"$:/plugins/flibbles/relink/language/Help/Operators":{"title":"$:/plugins/flibbles/relink/language/Help/Operators","text":"See the Operators documentation page for details."},"$:/plugins/flibbles/relink/language/SideBar/Missing/Caption":{"title":"$:/plugins/flibbles/relink/language/SideBar/Missing/Caption","text":"//Relink//
Missing"},"$:/plugins/flibbles/relink/language/SideBar/Orphans/Caption":{"title":"$:/plugins/flibbles/relink/language/SideBar/Orphans/Caption","text":"//Relink//
Orphans"},"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Empty":{"title":"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Empty","text":"No tiddlers contain any fields, links, macros, transclusions, or widgets referencing this one"},"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Description":{"title":"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Description","text":"The following tiddlers contain fields, links, macros, transclusions, or widgets referencing this one:"},"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Caption":{"title":"$:/plugins/flibbles/relink/language/TiddlerInfo/References/Caption","text":"//Relink// References"},"$:/plugins/flibbles/relink/language/ui/Attributes/Caption":{"title":"$:/plugins/flibbles/relink/language/ui/Attributes/Caption","text":"Attributes"},"$:/plugins/flibbles/relink/language/ui/Fields/Caption":{"title":"$:/plugins/flibbles/relink/language/ui/Fields/Caption","text":"Fields"},"$:/plugins/flibbles/relink/language/ui/Macros/Caption":{"title":"$:/plugins/flibbles/relink/language/ui/Macros/Caption","text":"Macros"},"$:/plugins/flibbles/relink/language/ui/Operators/Caption":{"title":"$:/plugins/flibbles/relink/language/ui/Operators/Caption","text":"Operators"},"$:/plugins/flibbles/relink/language/Warning/OldRelinkTextOperator":{"title":"$:/plugins/flibbles/relink/language/Warning/OldRelinkTextOperator","text":"Relink cannot parse your $$$<> wikitext until you migrate your \"<>\" relink module from the deprecated ''relinktextoperator'' module-type to ''relinktext''.

See the online documentation for details."},"$:/plugins/flibbles/relink/license":{"title":"$:/plugins/flibbles/relink/license","type":"text/vnd.tiddlywiki","text":"Relink Plugin Copyright (c) 2019-<> Cameron Fischer\n\n[[BSD 3-Clause License|https://raw.githubusercontent.com/flibbles/tw5-relink/master/LICENSE]]\n"},"$:/config/flibbles/relink/macros/colour-picker/actions":{"title":"$:/config/flibbles/relink/macros/colour-picker/actions","text":"wikitext"},"$:/config/flibbles/relink/macros/csvtiddlers/filter":{"title":"$:/config/flibbles/relink/macros/csvtiddlers/filter","text":"filter"},"$:/config/flibbles/relink/macros/datauri/title":{"title":"$:/config/flibbles/relink/macros/datauri/title","text":"title"},"$:/config/flibbles/relink/macros/image-picker/actions":{"title":"$:/config/flibbles/relink/macros/image-picker/actions","text":"wikitext"},"$:/config/flibbles/relink/macros/jsontiddler/title":{"title":"$:/config/flibbles/relink/macros/jsontiddler/title","text":"title"},"$:/config/flibbles/relink/macros/jsontiddlers/filter":{"title":"$:/config/flibbles/relink/macros/jsontiddlers/filter","text":"filter"},"$:/config/flibbles/relink/macros/keyboard-driven-input/configTiddlerFilter":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/configTiddlerFilter","text":"filter"},"$:/config/flibbles/relink/macros/keyboard-driven-input/inputAcceptActions":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/inputAcceptActions","text":"wikitext"},"$:/config/flibbles/relink/macros/keyboard-driven-input/inputAcceptVariantActions":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/inputAcceptVariantActions","text":"wikitext"},"$:/config/flibbles/relink/macros/keyboard-driven-input/inputCancelActions":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/inputCancelActions","text":"wikitext"},"$:/config/flibbles/relink/macros/keyboard-driven-input/selectionStateTitle":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/selectionStateTitle","text":"title"},"$:/config/flibbles/relink/macros/keyboard-driven-input/storeTitle":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/storeTitle","text":"title"},"$:/config/flibbles/relink/macros/keyboard-driven-input/tiddler":{"title":"$:/config/flibbles/relink/macros/keyboard-driven-input/tiddler","text":"title"},"$:/config/flibbles/relink/macros/list-links/filter":{"title":"$:/config/flibbles/relink/macros/list-links/filter","text":"filter"},"$:/config/flibbles/relink/macros/list-links/emptyMessage":{"title":"$:/config/flibbles/relink/macros/list-links/emptyMessage","text":"wikitext"},"$:/config/flibbles/relink/macros/list-links-draggable/tiddler":{"title":"$:/config/flibbles/relink/macros/list-links-draggable/tiddler","text":"title"},"$:/config/flibbles/relink/macros/list-links-draggable/itemTemplate":{"title":"$:/config/flibbles/relink/macros/list-links-draggable/itemTemplate","text":"title"},"$:/config/flibbles/relink/macros/list-tagged-draggable/tag":{"title":"$:/config/flibbles/relink/macros/list-tagged-draggable/tag","text":"title"},"$:/config/flibbles/relink/macros/list-tagged-draggable/emptyMessage":{"title":"$:/config/flibbles/relink/macros/list-tagged-draggable/emptyMessage","text":"wikitext"},"$:/config/flibbles/relink/macros/list-tagged-draggable/itemTemplate":{"title":"$:/config/flibbles/relink/macros/list-tagged-draggable/itemTemplate","text":"title"},"$:/config/flibbles/relink/macros/list-thumbnails/filter":{"title":"$:/config/flibbles/relink/macros/list-thumbnails/filter","text":"filter"},"$:/config/flibbles/relink/macros/tabs/actions":{"title":"$:/config/flibbles/relink/macros/tabs/actions","text":"wikitext"},"$:/config/flibbles/relink/macros/tabs/buttonTemplate":{"title":"$:/config/flibbles/relink/macros/tabs/buttonTemplate","text":"title"},"$:/config/flibbles/relink/macros/tabs/default":{"title":"$:/config/flibbles/relink/macros/tabs/default","text":"title"},"$:/config/flibbles/relink/macros/tabs/tabsList":{"title":"$:/config/flibbles/relink/macros/tabs/tabsList","text":"filter"},"$:/config/flibbles/relink/macros/tabs/template":{"title":"$:/config/flibbles/relink/macros/tabs/template","text":"title"},"$:/config/flibbles/relink/macros/tag/tag":{"title":"$:/config/flibbles/relink/macros/tag/tag","text":"title"},"$:/config/flibbles/relink/macros/tag-picker/actions":{"title":"$:/config/flibbles/relink/macros/tag-picker/actions","text":"wikitext"},"$:/config/flibbles/relink/macros/tag-pill/actions":{"title":"$:/config/flibbles/relink/macros/tag-pill/actions","text":"wikitext"},"$:/config/flibbles/relink/macros/tag-pill/tag":{"title":"$:/config/flibbles/relink/macros/tag-pill/tag","text":"title"},"$:/config/flibbles/relink/macros/toc/tag":{"title":"$:/config/flibbles/relink/macros/toc/tag","text":"title"},"$:/config/flibbles/relink/macros/toc/itemClassFilter":{"title":"$:/config/flibbles/relink/macros/toc/itemClassFilter","text":"filter"},"$:/config/flibbles/relink/macros/toc-expandable/tag":{"title":"$:/config/flibbles/relink/macros/toc-expandable/tag","text":"title"},"$:/config/flibbles/relink/macros/toc-expandable/itemClassFilter":{"title":"$:/config/flibbles/relink/macros/toc-expandable/itemClassFilter","text":"filter"},"$:/config/flibbles/relink/macros/toc-expandable/exclude":{"title":"$:/config/flibbles/relink/macros/toc-expandable/exclude","text":"list"},"$:/config/flibbles/relink/macros/toc-selective-expandable/tag":{"title":"$:/config/flibbles/relink/macros/toc-selective-expandable/tag","text":"title"},"$:/config/flibbles/relink/macros/toc-selective-expandable/itemClassFilter":{"title":"$:/config/flibbles/relink/macros/toc-selective-expandable/itemClassFilter","text":"filter"},"$:/config/flibbles/relink/macros/toc-selective-expandable/exclude":{"title":"$:/config/flibbles/relink/macros/toc-selective-expandable/exclude","text":"list"},"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/tag":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/tag","text":"title"},"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/selectedTiddler":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/selectedTiddler","text":"title"},"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/unselectedText":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/unselectedText","text":"wikitext"},"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/missingText":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/missingText","text":"wikitext"},"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/template":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-external-nav/template","text":"title"},"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/tag":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/tag","text":"title"},"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/selectedTiddler":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/selectedTiddler","text":"title"},"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/unselectedText":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/unselectedText","text":"wikitext"},"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/missingText":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/missingText","text":"wikitext"},"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/template":{"title":"$:/config/flibbles/relink/macros/toc-tabbed-internal-nav/template","text":"title"},"$:/config/flibbles/relink/macros/translink/title":{"title":"$:/config/flibbles/relink/macros/translink/title","text":"title"},"$:/config/flibbles/relink/messages/tm-new-tiddler":{"title":"$:/config/flibbles/relink/messages/tm-new-tiddler","text":"(.*)"},"$:/config/flibbles/relink/operators/filter":{"title":"$:/config/flibbles/relink/operators/filter","text":"filter"},"$:/config/flibbles/relink/operators/list":{"title":"$:/config/flibbles/relink/operators/list","text":"reference"},"$:/config/flibbles/relink/operators/subfilter":{"title":"$:/config/flibbles/relink/operators/subfilter","text":"filter"},"$:/config/flibbles/relink/operators/tag":{"title":"$:/config/flibbles/relink/operators/tag","text":"title"},"$:/config/flibbles/relink/operators/title":{"title":"$:/config/flibbles/relink/operators/title","text":"title"},"$:/config/flibbles/relink/operators/field:title":{"title":"$:/config/flibbles/relink/operators/field:title","text":"title"},"$:/config/flibbles/relink/operators/relink:report":{"title":"$:/config/flibbles/relink/operators/relink:report","text":"title"},"$:/language/EditTemplate/Title/Impossibles/Prompt":{"title":"$:/language/EditTemplate/Title/Impossibles/Prompt","text":"''Warning:'' Not all references in the following tiddlers can be updated by //Relink// due to the complexity of the new title:"},"$:/language/EditTemplate/Title/References/Prompt":{"title":"$:/language/EditTemplate/Title/References/Prompt","text":"The following tiddlers will be updated if relinking:"},"$:/language/EditTemplate/Title/Relink/Prompt":{"title":"$:/language/EditTemplate/Title/Relink/Prompt","text":"Use //Relink// to update ''<$text text=<>/>'' to ''<$text text=<>/>'' across all other tiddlers"},"$:/core/ui/EditTemplate/title":{"title":"$:/core/ui/EditTemplate/title","tags":"$:/tags/EditTemplate","text":"\\whitespace trim\n<$edit-text field=\"draft.title\" class=\"tc-titlebar tc-edit-texteditor\" focus={{{ [{$:/config/AutoFocus}match[title]then[true]] ~[[false]] }}} tabindex={{$:/config/EditTabIndex}} cancelPopups=\"yes\" dir={{$:/config/DefaultTextDirection}}/>\n\n<$vars pattern=\"\"\"[\\|\\[\\]{}]\"\"\" bad-chars=\"\"\"`| [ ] { }`\"\"\">\n\n<$list filter=\"[all[current]regexp:draft.title]\" variable=\"listItem\">\n\n
\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/BadCharacterWarning}}\n\n
\n\n\n\n\n\n<$reveal state=\"!!draft.title\" type=\"nomatch\" text={{!!draft.of}} tag=\"div\" dir={{$:/config/DefaultTextDirection}}>\n\n<$list filter=\"[{!!draft.title}!is[missing]]\" variable=\"listItem\">\n\n
\n\n{{$:/core/images/warning}} {{$:/language/EditTemplate/Title/Exists/Prompt}}: <$link to={{!!draft.title}} />\n\n
\n\n\n\n<$list filter=\"[{!!draft.of}!is[missing]]\" variable=\"listItem\">\n\n<$vars fromTitle={{!!draft.of}} toTitle={{!!draft.title}}>\n\n<$checkbox tiddler=\"$:/config/RelinkOnRename\" field=\"text\" checked=\"yes\" unchecked=\"no\" default=\"no\"> {{$:/language/EditTemplate/Title/Relink/Prompt}}\n\n<$tiddler tiddler=<> >\n\n<$list filter=\"[relink:wouldchangelimit[1]]\" variable=\"listItem\">\n\n<$vars stateTiddler=<> >\n\n<$set\n\tname=\"prompt\"\n\tfilter=\"[relink:wouldchangerelink:impossible]\"\n\tvalue=\"EditTemplate/Title/Impossibles/Prompt\"\n\temptyValue=\"EditTemplate/Title/References/Prompt\" >\n<$reveal type=\"nomatch\" state=<> text=\"show\">\n<$button set=<> setTo=\"show\" class=\"tc-btn-invisible\">\n{{$:/core/images/right-arrow}}\n \n<$macrocall $name=lingo title=<> />\n\n\n<$reveal type=\"match\" state=<> text=\"show\">\n<$button set=<> setTo=\"hide\" class=\"tc-btn-invisible\">\n{{$:/core/images/down-arrow}}\n \n<$macrocall $name=lingo title=<> />\n\n\n\n\n<$reveal type=\"match\" state=<> text=\"show\">\n<$list variable=\"listItem\" filter=\"[relink:wouldchange!title[$:/StoryList]sort[title]]\" template=\"$:/plugins/flibbles/relink/ui/ListItemTemplate\">\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"},"$:/config/flibbles/relink/PluginLibrary":{"title":"$:/config/flibbles/relink/PluginLibrary","caption":"//Relink// Library","url":"https://flibbles.github.io/tw5-relink/library/index.html","tags":"$:/tags/PluginLibrary","text":"The //Relink// library contains //Relink// as well as its supplemental plugins. It is maintained by Flibbles. See the [[github page|https://github.com/flibbles/tw5-relink]] for more information.\n"},"$:/plugins/flibbles/relink/readme":{"title":"$:/plugins/flibbles/relink/readme","type":"text/vnd.tiddlywiki","text":"When renaming a tiddler, Relink can update the fields, filters, and widgets\nof all other tiddlers. However, it works through whitelisting.\n\nIt's already configured to update tiddler titles for all core widgets, filters,\nand fields, but the whitelists can be customized for each of this in the\nconfiguration panel.\n\nSee the tw5-relink website for more details and examples.\n"},"$:/config/flibbles/relink/settings/default-type":{"title":"$:/config/flibbles/relink/settings/default-type","text":"title"},"$:/config/flibbles/relink/touch-modify":{"title":"$:/config/flibbles/relink/touch-modify","text":"yes"},"$:/config/DefaultColourMappings/relink-impossible":{"title":"$:/config/DefaultColourMappings/relink-impossible","text":"<>"},"$:/language/Docs/PaletteColours/relink-impossible":{"title":"$:/language/Docs/PaletteColours/relink-impossible","text":"Relink link impossible"},"$:/plugins/flibbles/relink/ui/ListItemTemplate":{"title":"$:/plugins/flibbles/relink/ui/ListItemTemplate","text":"\\whitespace trim\n<$set\n\tname=\"classes\"\n\tfilter=\"[relink:impossible]\"\n\tvalue=\"tc-menu-list-item tc-relink-impossible\"\n\temptyValue=\"tc-menu-list-item\">\n
>>\n<$link to=<>><$text text=<> />\n
\n\n"},"$:/plugins/flibbles/relink/ui/ListItemWithBlurbTemplate":{"title":"$:/plugins/flibbles/relink/ui/ListItemWithBlurbTemplate","text":"
<$link />
\n<$list variable=blurb filter=\"[relink:report]\">\n"},"$:/plugins/flibbles/relink/ui/MissingTemplate":{"title":"$:/plugins/flibbles/relink/ui/MissingTemplate","text":"\\whitespace trim\n<$set name=\"missingTiddler\" value=<> >\n
\n<$button popup=<> class=\"tc-btn-invisible tc-missing-tiddler-label\">\n<$view field=\"title\" format=\"text\" />\n\n<$reveal state=<> type=\"popup\" position=\"below\" animate=\"yes\">\n
\n<$transclude tiddler=\"$:/core/ui/ListItemTemplate\"/>\n
\n<$list filter=\"[all[current]relink:backreferences[]sort[title]]\" template=\"$:/plugins/flibbles/relink/ui/ListItemWithBlurbTemplate\"/>\n
\n\n
\n\n"},"$:/plugins/flibbles/relink/ui/MoreSideBar/Missing":{"title":"$:/plugins/flibbles/relink/ui/MoreSideBar/Missing","caption":"{{$:/plugins/flibbles/relink/language/SideBar/Missing/Caption}}","tags":"$:/tags/MoreSideBar","text":"<$list filter={{$:/plugins/flibbles/relink/Filters/Missing!!filter}} template=\"$:/plugins/flibbles/relink/ui/MissingTemplate\" />\n"},"$:/plugins/flibbles/relink/ui/MoreSideBar/Orphans":{"title":"$:/plugins/flibbles/relink/ui/MoreSideBar/Orphans","caption":"{{$:/plugins/flibbles/relink/language/SideBar/Orphans/Caption}}","tags":"$:/tags/MoreSideBar","text":"<$list filter={{$:/plugins/flibbles/relink/Filters/Orphans!!filter}} template=\"$:/core/ui/ListItemTemplate\" />\n"},"$:/plugins/flibbles/relink/ui/TiddlerInfo/References":{"title":"$:/plugins/flibbles/relink/ui/TiddlerInfo/References","caption":"{{$:/plugins/flibbles/relink/language/TiddlerInfo/References/Caption}}","tags":"$:/tags/TiddlerInfo","text":"\\define lingo-base() $:/plugins/flibbles/relink/language/TiddlerInfo/\n\\define filter() [all[current]relink:backreferences[]!title[$:/StoryList]!prefix[$:/temp/]sort[title]]\n\\whitespace trim\n<$list filter=\"[subfilterfirst[]]\">\n<>\n\n\n\n<$vars toTitle='' >\n<$list filter=<> emptyMessage=<> variable=\"listItem\" template=\"$:/plugins/flibbles/relink/ui/TiddlerInfo/ReferencesTemplate\" />\n\n\n\n"},"$:/plugins/flibbles/relink/ui/TiddlerInfo/ReferencesTemplate":{"title":"$:/plugins/flibbles/relink/ui/TiddlerInfo/ReferencesTemplate","text":"\\whitespace trim\n\n!match[]thenrelink:impossiblethen[tc-relink-impossible]] +[join[ ]] }}} >\n\t<$list\n\t\tvariable=whitelist\n\t\tfilter=\"[removeprefix[$:/config/flibbles/relink/]split[/]first[]titlecase[]addprefix[$:/plugins/flibbles/relink/ui/configuration/]]\"\n\t\temptyMessage=\"<$link to=<>/>\" >\n\t\t<$link to=<>>\n\t\t\t''//Relink// whitelist''\n\t\t\n\t\n\n\n\t<$list filter=\"[relink:report]\">\n\n\t\t<$text text=<> />\n\t\n\n"},"$:/plugins/flibbles/relink/ui/components/button-delete":{"title":"$:/plugins/flibbles/relink/ui/components/button-delete","text":"\\define lingo-base() $:/plugins/flibbles/relink/language/Buttons/\n\\define prefix() $:/config/flibbles/relink/\n\\whitespace trim\n\n<$list\n\tfilter=\"[all[current]prefix]\"\n\temptyMessage=\"<$link><$button class='tc-btn-invisible' tooltip={{$:/plugins/flibbles/relink/language/Buttons/LinkToInline/Hint}}>{{$:/core/images/link}}\">\n<$button class=\"tc-btn-invisible\" tooltip={{$:/plugins/flibbles/relink/language/Buttons/Delete/Hint}}><$list filter=\"[all[current]is[tiddler]]\">\n<$action-deletetiddler $tiddler=<> />\n<$list filter=\"[all[current]is[shadow]]\">\n<$action-setfield $tiddler=<> text=\"\" />\n\n{{$:/core/images/delete-button}}\n\n\n"},"$:/plugins/flibbles/relink/ui/components/select-fieldtype":{"title":"$:/plugins/flibbles/relink/ui/components/select-fieldtype","text":"\\define prefix() $:/config/flibbles/relink/\n\\whitespace trim\n\n<$vars type={{{ [relink:type[]] }}} >\n<$list filter=\"[all[current]prefix]\" >\n<$select tiddler=<> >\n<$list variable=\"option\" filter=\"[relink:types[]]\">\n\n\n\n<$list filter=\"[all[current]!prefix]\">\n<$text text=<> />\n\n\n"},"$:/plugins/flibbles/relink/ui/components/tables":{"title":"$:/plugins/flibbles/relink/ui/components/tables","text":"\\define .make-table(title, plugin, default-table-state:yes)\n\\whitespace trim\n\n<$list variable=\"render\" filter=\"[relink:signatures<__plugin__>prefix<__category__>first[]]\">\n<$vars table-state=<>>\n> >\n<$reveal type=\"nomatch\" state=<> text=\"yes\" default=\"\"\"$default-table-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<> setTo=\"yes\">\n{{$:/core/images/right-arrow}} $title$\n\n\n<$reveal type=\"match\" state=<> text=\"yes\" default=\"\"\"$default-table-state$\"\"\">\n<$button class=\"tc-btn-invisible tc-btn-dropdown\" set=<> setTo=\"no\">\n{{$:/core/images/down-arrow}} $title$\n\n\n\n<$list\n\tvariable=\"signature\"\n\tfilter=\"[relink:signatures<__plugin__>prefix<__category__>sort[]]\">\n<$vars key={{{ [removeprefix<__category__>removeprefix[/]] }}} >\n<$tiddler tiddler={{{[relink:source[]]}}} >\n<$reveal tag=\"tr\" type=\"match\" state=<> text=\"yes\" default=\"\"\"$default-table-state$\"\"\">\n<$macrocall $name=<<__list-row-macro__>> signature=<> />\n{{||$:/plugins/flibbles/relink/ui/components/select-fieldtype}}\n{{||$:/plugins/flibbles/relink/ui/components/button-delete}}\n\n\n\n\n\n\n\\end\n\n\\define tables(category, list-row-macro, header-list)\n\\whitespace trim\n<$vars\n\tcolumn-count={{{[enlist<__header-list__>] [[DeleteColumn]] +[count[]]}}}>\n\n\n<$list variable=\"header\" filter=\"[enlist<__header-list__>butlast[]]\">\n\n\n\n<<.make-table Custom \"\" yes>>\n\n<$list\n\tfilter=\"[plugin-type[plugin]![$:/core]![$:/plugins/flibbles/relink]]\">\n<$set name=\"subtitle\"\n\tfilter=\"[all[current]has[description]]\"\n\tvalue=\"''{{!!name}}'': <$text text={{!!description}}/>\"\n\temptyValue=\"''{{!!name}}''\" >\n<$macrocall $name=\".make-table\" title=<> plugin=<> />\n\n\n<<.make-table Core \"$:/plugins/flibbles/relink\">>\n\n\n\n\\end\n"},"$:/plugins/flibbles/relink/ui/configuration/Attributes":{"title":"$:/plugins/flibbles/relink/ui/configuration/Attributes","caption":"{{$:/plugins/flibbles/relink/language/ui/Attributes/Caption}}","tags":"$:/tags/flibbles/relink/Configuration","text":"\\import $:/plugins/flibbles/relink/ui/components/tables\n\\define prefix-attr() $:/config/flibbles/relink/attributes/\n\\define lingo-base() $:/plugins/flibbles/relink/language/Buttons/\n\\define element-name-tiddler() $:/state/flibbles/relink/element-name\n\\define attribute-name-tiddler() $:/state/flibbles/relink/attribute-name\n\n\\define row()\n\\whitespace trim\n<$set name='element'\n value={{{[splitbefore[/]removesuffix[/]]}}}>\n<$set name=\"attribute\"\n value={{{[removeprefixremoveprefix[/]]}}}>\n<$text text=<> />\n<$text text=<> />\n\n\\end\n\\define body()\n\\whitespace trim\n\nAdd a new attribute:\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"widget/element\" />\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"attribute\" />\n \n<$reveal type=\"nomatch\" text=\"\" state=<> >\n<$reveal type=\"nomatch\" text=\"\" state=<> >\n<$relinkmangler>\n<$button\n\ttooltip={{$(lingo-base)$NewAttribute/Hint}}\n\taria-label={{$(lingo-base)$NewAttribute/Caption}}>\n<$action-sendmessage\n\t$message=\"relink-add-attribute\"\n\telement={{$(element-name-tiddler)$}}\n\tattribute={{$(attribute-name-tiddler)$}} />\n<$action-deletetiddler $tiddler=<> />\n<$action-deletetiddler $tiddler=<> />\n<$text text={{$(lingo-base)$NewAttribute/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<> >\n<$button>\n<$text text={{$(lingo-base)$NewAttribute/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<> >\n<$button>\n<$text text={{$(lingo-base)$NewAttribute/Caption}}/>\n\n\n\n@@.tc-control-panel\n<$macrocall\n\t$name=tables\n\tcategory=\"attributes\"\n\theader-list=\"[[Widget/HTML Element]] Attribute Type\"\n\tlist-row-macro=\"row\" />\n@@\n\\end\n\n{{$:/plugins/flibbles/relink/language/Help/Attributes}}\n\n<>\n"},"$:/plugins/flibbles/relink/ui/configuration/Fields":{"title":"$:/plugins/flibbles/relink/ui/configuration/Fields","caption":"{{$:/plugins/flibbles/relink/language/ui/Fields/Caption}}","tags":"$:/tags/flibbles/relink/Configuration","text":"\\import $:/plugins/flibbles/relink/ui/components/tables\n\\define lingo-base() $:/plugins/flibbles/relink/language/Buttons/\n\\define field-name-tiddler() $:/state/flibbles/relink/field-name\n\n\\define row()\n<$text text=<> />\n\\end\n\n\\define body()\n\\whitespace trim\n\nAdd a new field:\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"field name\" />\n \n<$reveal type=\"nomatch\" text=\"\" state=<> >\n<$relinkmangler>\n<$button\n\ttooltip={{$(lingo-base)$NewField/Hint}}\n\taria-label={{$(lingo-base)$NewField/Caption}}>\n<$action-sendmessage\n\t$message=\"relink-add-field\"\n\tfield={{$(field-name-tiddler)$}} />\n<$action-deletetiddler $tiddler=<> />\n<$text text={{$(lingo-base)$NewField/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<> >\n<$button>\n<$text text={{$(lingo-base)$NewField/Caption}}/>\n\n\n\n@@.tc-control-panel\n<$macrocall\n\t$name=tables\n\tcategory=\"fields\"\n\theader-list=\"[[Field Name]] [[Field Type]]\"\n\tlist-row-macro=\"row\" />\n@@\n\\end\n\n{{$:/plugins/flibbles/relink/language/Help/Fields}}\n\n<>\n"},"$:/plugins/flibbles/relink/ui/configuration/Macros":{"title":"$:/plugins/flibbles/relink/ui/configuration/Macros","caption":"{{$:/plugins/flibbles/relink/language/ui/Macros/Caption}}","tags":"$:/tags/flibbles/relink/Configuration","text":"\\import $:/plugins/flibbles/relink/ui/components/tables\n\\define prefix-macro() $:/config/flibbles/relink/macros/\n\\define lingo-base() $:/plugins/flibbles/relink/language/Buttons/\n\\define macro-name-tiddler() $:/state/flibbles/relink/macro-name\n\\define parameter-name-tiddler() $:/state/flibbles/relink/parameter-name\n\n\\define row()\n\\whitespace trim\n<$set name=\"parameter\"\n value={{{[relink:splitafter[/]]}}}>\n<$set name='macro'\n value={{{[removesuffixremovesuffix[/]]}}}>\n<$text text=<> />\n<$text text=<> />\n\n\\end\n\n\\define body()\n\\whitespace trim\n\nAdd a new macro parameter:\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"macro\" />\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"parameter\" />\n \n<$reveal type=\"nomatch\" text=\"\" state=<> >\n<$reveal type=\"nomatch\" text=\"\" state=<> >\n<$relinkmangler>\n<$button\n\ttooltip={{$(lingo-base)$NewParameter/Hint}}\n\taria-label={{$(lingo-base)$NewParameter/Caption}}>\n<$action-sendmessage\n\t$message=\"relink-add-parameter\"\n\tmacro={{$(macro-name-tiddler)$}}\n\tparameter={{$(parameter-name-tiddler)$}} />\n<$action-deletetiddler $tiddler=<> />\n<$action-deletetiddler $tiddler=<> />\n<$text text={{$(lingo-base)$NewParameter/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<> >\n<$button>\n<$text text={{$(lingo-base)$NewParameter/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<> >\n<$button>\n<$text text={{$(lingo-base)$NewParameter/Caption}}/>\n\n\n\n@@.tc-control-panel\n<$macrocall\n\t$name=tables\n\tcategory=\"macros\"\n\theader-list=\"Macro Parameter Type\"\n\tlist-row-macro=\"row\" />\n@@\n\\end\n\n{{$:/plugins/flibbles/relink/language/Help/Macros}}\n\n<>\n"},"$:/plugins/flibbles/relink/ui/configuration/Operators":{"title":"$:/plugins/flibbles/relink/ui/configuration/Operators","caption":"{{$:/plugins/flibbles/relink/language/ui/Operators/Caption}}","tags":"$:/tags/flibbles/relink/Configuration","text":"\\import $:/plugins/flibbles/relink/ui/components/tables\n\\define lingo-base() $:/plugins/flibbles/relink/language/Buttons/\n\\define operator-name-tiddler() $:/state/flibbles/relink/operator-name\n\n\\define row()\n<$text text=<> />\n\\end\n\n\\define body()\n\\whitespace trim\n\nAdd a new filter operator:\n \n<$edit-text\n\ttiddler=<>\n\ttag=\"input\"\n\tdefault=\"\"\n\tplaceholder=\"operator name\" />\n \n<$reveal type=\"nomatch\" text=\"\" state=<>>\n<$relinkmangler>\n<$button\n\ttooltip={{$(lingo-base)$NewOperator/Hint}}\n\taria-label={{$(lingo-base)$NewOperator/Caption}}>\n<$action-sendmessage\n\t$message=\"relink-add-operator\"\n\toperator={{$(operator-name-tiddler)$}} />\n<$action-deletetiddler $tiddler=<> />\n<$text text={{$(lingo-base)$NewOperator/Caption}}/>\n\n\n\n<$reveal type=\"match\" text=\"\" state=<>>\n<$button>\n<$text text={{$(lingo-base)$NewOperator/Caption}}/>\n\n\n\n@@.tc-control-panel\n<$macrocall\n\t$name=tables\n\tcategory=\"operators\"\n\theader-list=\"[[Filter Operator]] [[Operand Type]]\"\n\tlist-row-macro=\"row\" />\n@@\n\\end\n\n{{$:/plugins/flibbles/relink/language/Help/Operators}}\n\n<>\n"},"$:/plugins/flibbles/relink/ui/stylesheet.css":{"title":"$:/plugins/flibbles/relink/ui/stylesheet.css","tags":"$:/tags/Stylesheet","text":".tc-relink-references {\n}\n\n.tc-relink-references-table {\n\twidth: 100%;\n\tborder: none;\n}\n\n.tc-relink-references-table td {\n\tborder-left: none;\n}\n\n.tc-relink-references-table tr:first-child td {\n\tborder-top: none;\n}\n\n.tc-relink-references-title {\n\ttext-align: left;\n\tvertical-align: top;\n\tpadding-top: 3px;\n\tpadding-bottom: 3px;\n}\n\n.tc-relink-references-occurrence {\n\tfont-style: italic;\n\ttext-align: left;\n\tfont-weight: 200;\n\tpadding-left: 25px;\n\tvertical-align: top;\n}\n\n.tc-relink-header-plugin {\n\ttext-align: left;\n}\n\n.tc-relink-header-plugin button {\n\twidth: 100%\n}\n\n.tc-relink-column-type {\n\twidth: 8em;\n}\n\n.tc-relink-column-type select {\n\twidth: 100%;\n}\n\n.tc-relink-column-delete {\n\tborder-left: none;\n\ttext-align: left;\n}\n\n.tc-relink-column-delete button {\n\tpadding-left: 1em;\n}\n\n.tc-relink-impossible a.tc-tiddlylink {\n\tcolor: <>;\n}\n\n.tc-relink-menu-missing-blurb {\n\tmargin-left: 30pt;\n}\n"}}} \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json.meta b/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json.meta new file mode 100644 index 000000000..a5ccead52 --- /dev/null +++ b/editions/tw5.com/tiddlers/$__plugins_flibbles_relink.json.meta @@ -0,0 +1,13 @@ +author: Flibbles +core-version: >=5.1.22 +created: 20240221025320294 +demo: http://flibbles.github.io/tw5-relink/ +dependents: +description: Flexibility when relinking renamed tiddlers +list: readme configuration license +name: Relink +plugin-type: plugin +source: https://github.com/flibbles/tw5-relink +title: $:/plugins/flibbles/relink +type: application/json +version: 2.4.3 \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_captionField.tid b/editions/tw5.com/tiddlers/Examples_TOC_param_captionField.tid similarity index 77% rename from editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_captionField.tid rename to editions/tw5.com/tiddlers/Examples_TOC_param_captionField.tid index 4e419ac78..e12650055 100644 --- a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_captionField.tid +++ b/editions/tw5.com/tiddlers/Examples_TOC_param_captionField.tid @@ -1,8 +1,8 @@ created: 20240724082221230 -import-compound: Examples/TOC/SimpleToc -modified: 20240730081240127 +import-compound: Examples/TOC/param/tag +modified: 20240826164358077 tags: $:/tags/wiki-test-spec -title: Examples/TOC/SimpleToc/captionField +title: Examples/TOC/param/captionField type: text/vnd.tiddlywiki-multiple title: Description diff --git a/editions/tw5.com/tiddlers/Examples_TOC_param_itemTemplate.tid b/editions/tw5.com/tiddlers/Examples_TOC_param_itemTemplate.tid new file mode 100644 index 000000000..ae61bb040 --- /dev/null +++ b/editions/tw5.com/tiddlers/Examples_TOC_param_itemTemplate.tid @@ -0,0 +1,57 @@ +created: 20240826160050805 +description: Simple TOC +modified: 20240826162927425 +tags: $:/tags/wiki-test-spec +title: Examples/TOC/param/itemTemplate +type: text/vnd.tiddlywiki-multiple + +title: Narrative + +* The following code defines a "Simple Table of Contents" using "root" as the base tag +* Click through all the tabs to get additional info + +<$transclude $tiddler="Narrative-extended" $mode="block"/> + ++ +title: root +list: First Third Fourth + +The list-field in the "root" tag-tiddler can be used to define the "sort order" of the TOC ++ +title: First +tags: root + +1st 1st 1st 1st 1st ++ +title: Second +tags: First + +2nd 2nd 2nd 2nd 2nd ++ +title: Third +tags: root + +3rd 3rd 3rd 3rd 3rd ++ +title: Fourth +caption: fourth-caption +tags: root + +4th 4th 4th 4th 4th + +This tiddler contains a caption, which will be shown in the TOC instead of the tiddler title ++ +title: myTemplate + +<$let tv-wikilinks="no"> +<$transclude $field="caption"> + <$transclude $field="title"/> - param itemTemplate + + ++ +title: Output + +
+<> +
+ diff --git a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid b/editions/tw5.com/tiddlers/Examples_TOC_param_parentField.tid similarity index 94% rename from editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid rename to editions/tw5.com/tiddlers/Examples_TOC_param_parentField.tid index 13e904b6c..46dc2eb0e 100644 --- a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_parentField.tid +++ b/editions/tw5.com/tiddlers/Examples_TOC_param_parentField.tid @@ -1,8 +1,8 @@ created: 20240730081443212 description: Simple TOC - parentField parameter -modified: 20240803121600331 +modified: 20240826162950242 tags: $:/tags/wiki-test-spec -title: Examples/TOC/SimpleToc/parentField +title: Examples/TOC/param/parentField type: text/vnd.tiddlywiki-multiple title: Narrative diff --git a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc.tid b/editions/tw5.com/tiddlers/Examples_TOC_param_tag.tid similarity index 90% rename from editions/tw5.com/tiddlers/Examples_TOC_SimpleToc.tid rename to editions/tw5.com/tiddlers/Examples_TOC_param_tag.tid index aaee9d5c6..6f1638b58 100644 --- a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc.tid +++ b/editions/tw5.com/tiddlers/Examples_TOC_param_tag.tid @@ -1,8 +1,8 @@ created: 20240724070813184 -description: Simple TOC -modified: 20240729112105751 +description: TOC tag parameter +modified: 20240826164015156 tags: $:/tags/wiki-test-spec -title: Examples/TOC/SimpleToc +title: Examples/TOC/param/tag type: text/vnd.tiddlywiki-multiple title: Narrative diff --git a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_tagField.tid b/editions/tw5.com/tiddlers/Examples_TOC_param_tagField.tid similarity index 66% rename from editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_tagField.tid rename to editions/tw5.com/tiddlers/Examples_TOC_param_tagField.tid index 07a65f2a0..1dc45a3e4 100644 --- a/editions/tw5.com/tiddlers/Examples_TOC_SimpleToc_tagField.tid +++ b/editions/tw5.com/tiddlers/Examples_TOC_param_tagField.tid @@ -1,14 +1,15 @@ created: 20240729105221520 description: Simple TOC - tagField = tagLike -modified: 20240729110636440 +modified: 20240826163000897 tags: $:/tags/wiki-test-spec -title: Examples/TOC/SimpleToc/tagField +title: Examples/TOC/param/tagField type: text/vnd.tiddlywiki-multiple title: Narrative * This test-case creates a "Simple Table of Contents" using "root" as the base tag * It uses a field named: ''tagLike'' which defines the TOC structure +* The parameter is: `tagField:"tagLike"` * Click through all the tabs to get additional info <$transclude $tiddler="Narrative-extended" $mode="block"/> @@ -39,9 +40,27 @@ tagLike: root 4th 4th 4th 4th 4th ++ +title: Fifth +tagLike: Second + +5th 5th 5th 5th 5th + ++ +title: Sixth +tagLike: Second + +6th 6th 6th 6th 6th + + title: Output + +\define tv-toc-show-new-child() yes +
<>
diff --git a/editions/tw5.com/tiddlers/Table-of-Contents Macros (Advanced Examples).tid b/editions/tw5.com/tiddlers/Table-of-Contents Macros (Advanced Examples).tid new file mode 100644 index 000000000..e64239cfa --- /dev/null +++ b/editions/tw5.com/tiddlers/Table-of-Contents Macros (Advanced Examples).tid @@ -0,0 +1,11 @@ +created: 20240826172211655 +modified: 20240826172607528 +tags: [[Macro Examples]] [[Table-of-Contents Macros]] +title: Table-of-Contents Macros (Advanced Examples) +type: text/vnd.tiddlywiki + +The following examples provide information about the "rewritten" toc macors. For the standard examples look at: [[Table-of-Contents Macros (Examples)]] + +<> + +<> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid index b643bcc8f..578b72392 100644 --- a/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid +++ b/editions/tw5.com/tiddlers/macros/TableOfContentsMacro.tid @@ -1,5 +1,5 @@ created: 20140919155729620 -modified: 20240207142704165 +modified: 20240826172206506 tags: Macros [[Core Macros]] title: Table-of-Contents Macros type: text/vnd.tiddlywiki @@ -10,19 +10,14 @@ To make a table of contents appear in the sidebar, see [[How to add a new tab to !! Macros -; toc -: A simple tree +|Macro |Description |h +|''toc'' |A simple tree | +|''toc-expandable'' |A tree in which all the branches can be expanded and collapsed | +|''toc-selective-expandable'' |A tree in which the non-empty branches can be expanded and collapsed | +|''toc-tabbed-internal-nav'' |A two-panel browser:
- On the left, a selectively expandable tree that behaves like a set of vertical tabs.
- On the right, the content of whichever tiddler the user selects in the tree| +|''toc-tabbed-external-nav'' |~| -; toc-expandable -: A tree in which all the branches can be expanded and collapsed - -; toc-selective-expandable -: A tree in which the non-empty branches can be expanded and collapsed - -; toc-tabbed-internal-nav
toc-tabbed-external-nav -: A two-panel browser: -:* On the left, a selectively expandable tree that behaves like a set of vertical tabs -:* On the right, the content of whichever tiddler the user selects in the tree +!!! Differences The difference between the last two has to do with what happens when the user clicks a link in the right-hand panel: @@ -33,15 +28,22 @@ The difference between the last two has to do with what happens when the user cl : The target tiddler appears in the normal way in the story river, which depends on the user's configured storyview -!! Parameters +!! Common Macro Parameters + +These parameters are ''used by all'' toc-macros. + +|Parameter |Description |h +|''tag'' |The root tag that identifies the top level of the tree | +|''sort'' |An optional extra [[filter step|Filter Step]], e.g. `sort[title]`. See more info below. | +|''exclude'' |This optional parameter can be used to exclude tiddlers from the TOC list | +|''captionField'' |default: `caption`. Expects a field-name.If set it uses this field instead of the caption-field.
If the field is empty, or does not exists, it tries to use "caption" or falls back to the "tiddler-title". See more info below. | +|''tagField''|Uses any “tag-like” field instead of the “tags” field to create the “tag-like” tree.
tagField takes precedence over parentField. | +|''parentField''|Instead of using tags, the toc tree is built using “parent” fields. There is no default, but usually it will be "parent". This function uses the same filter behaviour as the tocP plugin. | +|''itemTemplate''|Expects a: template tiddler-title. By default toc macros use the `toc-defaultItemTemplate` procedure, which is specific to toc-macros.If itemTemplate is set, it uses the content of the template tiddler to display a toc node. If itemTemplate is used captionField is set to `text`.
''Important:'' If the toc-itemTemplate field is set in the current node it will take precedence over the macro parameter | -; tag -: The root tag that identifies the top level of the tree ; sort -: An optional extra [[filter step|Filter Step]], e.g. `sort[title]` - -:The sort parameter substituted into a single [[filter expression|Filter Expression]] like this. For backwards compatibility it is done as follows: +:The sort parameter is substituted into a single [[filter expression|Filter Expression]] like this. For backwards compatibility it is done as follows: :> ``<$list filter=`[all[shadows+tiddlers]tag!has[draft.of]$(sort)$] -[] -[subfilter]`>`` @@ -53,17 +55,11 @@ The difference between the last two has to do with what happens when the user cl `toc-tabbed-internal-nav` and `toc-tabbed-external-nav` take additional parameters: -; selectedTiddler -: The title of the [[state tiddler|StateMechanism]] for noting the currently selected tiddler, defaulting to `$:/temp/toc/selectedTiddler`. It is recommended that this be a [[system tiddler|SystemTiddlers]] - -; unselectedText -: The text to display when no tiddler is selected in the tree - -; missingText -: The text to display if the selected tiddler doesn't exist - -; template -: Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the selected tiddler into the right-hand panel +|Parameter |Descriptoin |h +|''selectedTiddler'' |The title of the [[state tiddler|StateMechanism]] for noting the currently selected tiddler, defaulting to `$:/temp/toc/selectedTiddler`. It is recommended that this be a [[system tiddler|SystemTiddlers]] | +|''unselectedText'' |The text to display when no tiddler is selected in the tree | +|''missingText'' |The text to display if the selected tiddler doesn't exist | +|''template'' |Optionally, the title of a tiddler to use as a [[template|TemplateTiddlers]] for transcluding the selected tiddler into the right-hand panel | !! Tiddler Fields @@ -71,19 +67,11 @@ The top level of the tree consists of the tiddlers that carry a particular tag, At each level, the tiddlers can be [[ordered|Order of Tagged Tiddlers]] by means of the <<.field list>> field of the parent tag tiddler. They can also be ordered by the macro's <<.param sort>> parameter. -!!! Tiddler Fields - -; caption -: The tree displays the <<.field caption>> field of a tiddler if it has one, or the tiddler's <<.field title>> otherwise. - -; toc-link -: Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a <<.field toc-link>> field with the the value <<.value no>>. In the [[examples|Table-of-Contents Macros (Examples)]], the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse. - -; target -:<<.from-version "5.1.23">> By default, the links open the tiddlers making up the table of contents. Alternatively, if the tiddler contains a <<.field target>> field then its contents will be used as the target of the link. - -; tooltip -: Will be used to show a tooltip about the node on mouse hover +|Field |Description |h +|''caption'' |The tree displays the <<.field caption>> field of a tiddler if it has one, or the tiddler's <<.field title>> otherwise. | +|''toc-link'' |Each tiddler in the tree is normally displayed as a link. To suppress this, give the tiddler a <<.field toc-link>> field with the the value <<.value no>>. In the [[examples|Table-of-Contents Macros (Examples)]], the SecondThree tiddler is set up like this. Clicking such a tiddler in the tree causes its branch to expand or collapse. | +|''target'' |<<.from-version "5.1.23">> By default, the links open the tiddlers making up the table of contents. Alternatively, if the tiddler contains a <<.field target>> field then its contents will be used as the target of the link.| +|''tooltip'' |Will be used to show a tooltip about the node on mouse hover | !! Custom Icons @@ -119,4 +107,5 @@ The default settings can be overwritten in your code using the define-pragma or !! Examples -Learn more at [[Examples|Table-of-Contents Macros (Examples)]] \ No newline at end of file +Learn more at [[Standard Examples|Table-of-Contents Macros (Examples)]] +Learn much more at: [[Advanced Examples|Table-of-Contents Macros (Advanced Examples)]] \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/macros/examples/toc.tid b/editions/tw5.com/tiddlers/macros/examples/toc.tid index b7e502bd3..f35cfbb10 100644 --- a/editions/tw5.com/tiddlers/macros/examples/toc.tid +++ b/editions/tw5.com/tiddlers/macros/examples/toc.tid @@ -1,9 +1,11 @@ created: 20150221193056000 -modified: 20240207125739904 +modified: 20240826172042818 tags: [[Table-of-Contents Macros]] [[Macro Examples]] title: Table-of-Contents Macros (Examples) type: text/vnd.tiddlywiki +The following examples provide information about the "core" toc macors. The rewritten toc-macros should be 100% compatible with the functionality presented here. + These examples derive tables of contents from the root tag <<.tag Contents>>. See [[Table-of-Contents Macros]] for details on how to use the Table-of-Contents Macros to make your own structured table-of-contents. You can explore the tag-based structure with these clickable tag pills: diff --git a/editions/tw5.com/tiddlers/test-contacts-itemTemplate-parameter.tid b/editions/tw5.com/tiddlers/test-contacts-itemTemplate-parameter.tid new file mode 100644 index 000000000..8c7da5039 --- /dev/null +++ b/editions/tw5.com/tiddlers/test-contacts-itemTemplate-parameter.tid @@ -0,0 +1,12 @@ +created: 20240826162020234 +modified: 20240826162157753 +tags: testTOC +title: test-contacts-itemTemplate-parameter +type: text/vnd.tiddlywiki + +* This tiddler was created to test [[contacts]] tiddler, which contains a `toc-include` +* There is a [[Talk-thread|https://talk.tiddlywiki.org/t/proposal-toc-macros-rewrite-using-if-functions-and-procedures-new-fuctionality/9046/32?u=pmario]], where Scott posts his version as a JSON file. + +< +<> +""">>