Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Gk0Wk committed Oct 18, 2023
2 parents 3e3dbe3 + d67ea4f commit b74884a
Show file tree
Hide file tree
Showing 67 changed files with 2,801 additions and 15 deletions.
15 changes: 13 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
created: 20210916060835982
modified: 20211015005122099
modified: 20231007041946163
title: $:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/linkify
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
created: 20210916060838759
modified: 20211015005122107
modified: 20231007042344185
title: $:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/list-bullet
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
created: 20210916060839751
modified: 20211015005122116
modified: 20231007042345993
title: $:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/list-number
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
created: 20210916060837120
modified: 20211015005122122
modified: 20231007041955508
title: $:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/mono-block
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
created: 20210916060836547
modified: 20211015005122217
modified: 20231007042353194
title: $:/config/EditorToolbarButtons/Visibility/$:/core/ui/EditorToolbar/transcludify
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20231007043121227
modified: 20231007043121227
title: $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/advanced-search
type: text/vnd.tiddlywiki

show
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
created: 20181203004822817
creator:
modified: 20211111140120534
modified: 20231007043118915
modifier:
title: $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/control-panel
type: text/vnd.tiddlywiki

hide
show
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
created: 20231007043117666
modified: 20231007043117666
title: $:/config/PageControlButtons/Visibility/$:/core/ui/Buttons/home
type: text/vnd.tiddlywiki

show
1 change: 1 addition & 0 deletions wiki/tiddlers/$__plugins_flibbles_relink-markdown.json

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions wiki/tiddlers/$__plugins_flibbles_relink-markdown.json.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
author: Flibbles
core-version: >=5.1.22
dependents:
description: Markdown support for Relink
list: readme
name: Relink Markdown
parent-plugin: $:/plugins/flibbles/relink
plugin-type: plugin
source: https://github.com/flibbles/tw5-relink
title: $:/plugins/flibbles/relink-markdown
type: application/json
version: 2.3.5
64 changes: 64 additions & 0 deletions wiki/tiddlers/$__plugins_flibbles_relink-titles.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"tiddlers": {
"$:/plugins/flibbles/relink-titles/configuration": {
"title": "$:/plugins/flibbles/relink-titles/configuration",
"caption": "{{$:/plugins/flibbles/relink-titles/language/Caption}}",
"tags": "$:/tags/flibbles/relink/Configuration",
"text": "\\define lingo-base() $:/plugins/flibbles/relink-titles/language/\n\\define prefix() $:/config/flibbles/relink-titles/relink/\n\\whitespace trim\n\n<div class=\"tc-control-panel\">\n\n<<lingo Help>>\n\n<table>\n<tbody>\n<$list filter=\"[[relinktitlesrule]modules[]]\">\n<tr>\n<td>\n<$checkbox\n\ttiddler={{{ [all[current]addprefix<prefix>] }}}\n\tfield=\"text\"\n\tchecked=\"enabled\"\n\tunchecked=\"disabled\"\n\tdefault=\"enabled\">\n&#32;\n''{{!!caption}}''\n</$checkbox></td><td>\n\n<$transclude field='description' />\n\n</td></tr></$list>\n</tbody></table></div>\n"
},
"$:/plugins/flibbles/relink-titles/language/Caption": {
"title": "$:/plugins/flibbles/relink-titles/language/Caption",
"text": "Titles"
},
"$:/plugins/flibbles/relink-titles/language/Directory/Caption": {
"title": "$:/plugins/flibbles/relink-titles/language/Directory/Caption",
"text": "Rename subdirectories"
},
"$:/plugins/flibbles/relink-titles/language/Directory/Description": {
"title": "$:/plugins/flibbles/relink-titles/language/Directory/Description",
"text": "For wikis set up hierarchically using `/`, like a filesystem. This option will update all tiddlers nested inside the target tiddler. i.e. `fromTiddler/path/file` becomes `toTiddler/path/file`."
},
"$:/plugins/flibbles/relink-titles/language/Lookup/Caption": {
"title": "$:/plugins/flibbles/relink-titles/language/Lookup/Caption",
"text": "Lookup tiddlers"
},
"$:/plugins/flibbles/relink-titles/language/Help": {
"title": "$:/plugins/flibbles/relink-titles/language/Help",
"text": "See the <a href={{{ [{$:/plugins/flibbles/relink-titles!!demo}addsuffix[#Plugins/Titles]] }}} class=\"tc-tiddlylink-external\">//Relink-titles// documentation page</a> for details."
},
"$:/plugins/flibbles/relink-titles/readme": {
"title": "$:/plugins/flibbles/relink-titles/readme",
"text": "Highly customizable relinking of tiddler titles //related// to the renamed tiddler.\n\n* Rename a hierarchy of subtiddlers when renaming a root tiddler.\n* Make custom filter rules to rename other tiddlers the way you want when Relinking.\n* Integrates with other plugins for plugin-specific rules.\n\nSee <a href={{$:/plugins/flibbles/relink-titles!!source}} class=\"tc-tiddlylink-external\">the tw5-relink website</a> for more details and examples.\n\n{{$:/core/images/warning}} ''Warning:'' You must use //Relink// v1.10.2 or greater with this, or this plugin may delete some tiddler bodies while trying to relink titles.\n"
},
"$:/plugins/flibbles/relink-titles/relinkoperations/title.js": {
"title": "$:/plugins/flibbles/relink-titles/relinkoperations/title.js",
"text": "/*\\\nmodule-type: relinkoperator\ntitle: $:/plugins/flibbles/relink-titles/relinkoperations/title.js\ntype: application/javascript\n\nRenames tiddlers which have titles derived from fromTitle. Then it makes\nsure that those tiddlers are properly relinked too.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nvar configPrefix = \"$:/config/flibbles/relink-titles/relink/\";\nvar utils = require('$:/plugins/flibbles/relink/js/utils.js');\n// This is using hotDirectories, which is a deprecated feature. It should be\n// using the $:/config/flibbles/relink/{cateogory} directory which would be\n// automatically maintained and regenerated.\n// Maybe in time I'll get around to migrating this, but no need to complicate\n// things now with changes that would require migration, and that would\n// have no outward effect.\nutils.getContext('whitelist').hotDirectories.push(configPrefix);\n\nvar titleRules = Object.create(null);\n$tw.modules.forEachModuleOfType('relinktitlesrule', function(title, module) {\n\ttitleRules[title] = module;\n});\n\nexports.name = 'title';\n\nexports.report = function(tiddler, callback, options) {\n\tvar cache = getCache(options),\n\t\trules = cache.rules;\n\tfor (var i = 0; i < rules.length; i++) {\n\t\trules[i].report(tiddler.fields.title, function(title, blurb) {\n\t\t\tcallback(title, blurb ? ('title: ' + blurb) : 'title');\n\t\t}, options);\n\t}\n};\n\nexports.relink = function(tiddler, fromTitle, toTitle, changes, options) {\n\tvar cache = getCache(options),\n\t\ttitle = tiddler.fields.title;\n\tif (!cache.touched[title]) {\n\t\tvar rules = cache.rules;\n\t\tfor (var i = 0; i < rules.length; i++) {\n\t\t\tvar rule = rules[i];\n\t\t\tvar entry = rule.relink(title, fromTitle, toTitle, options);\n\t\t\tif (entry) {\n\t\t\t\tvar result = entry.output;\n\t\t\t\tif (result && (result !== title)) {\n\t\t\t\t\tif (options.wiki.getTiddler(result) || cache.touched[result]) {\n\t\t\t\t\t\t// There's already a tiddler there. We won't clobber it.\n\t\t\t\t\t\tentry.impossible = true;\n\t\t\t\t\t\tentry.output = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tcache.touched[result] = true;\n\t\t\t\t}\n\t\t\t\t// Record that we've touched this one, so we only touch it once.\n\t\t\t\t// Both its prior and latter. Neither should be touched again.\n\t\t\t\tcache.touched[title] = true;\n\t\t\t\tchanges.title = entry;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n};\n\nfunction getCache(options) {\n\treturn utils.getCacheForRun(options, 'titles', function() {\n\t\treturn {\n\t\t\trules: getRules(options.wiki),\n\t\t\ttouched: Object.create(null)\n\t\t};\n\t});\n};\n\nfunction getRules(wiki) {\n\tvar activeRules = [];\n\tfor (var rule in titleRules) {\n\t\tvar configTiddler = wiki.getTiddler(configPrefix + rule);\n\t\tif (!configTiddler || configTiddler.fields.text !== \"disabled\") {\n\t\t\tactiveRules.push(titleRules[rule]);\n\t\t}\n\t}\n\treturn activeRules;\n};\n",
"module-type": "relinkoperator",
"type": "application/javascript"
},
"$:/plugins/flibbles/relink-titles/rules/directory": {
"title": "$:/plugins/flibbles/relink-titles/rules/directory",
"text": "/*\\\ncaption: {{$:/plugins/flibbles/relink-titles/language/Directory/Caption}}\ndescription: {{$:/plugins/flibbles/relink-titles/language/Directory/Description}}\nmodule-type: relinktitlesrule\ntitle: $:/plugins/flibbles/relink-titles/rules/directory\ntype: application/javascript\n\nHandles subdirectory renaming.\n\n\\*/\n\n/*jslint node: false, browser: true */\n/*global $tw: false */\n\"use strict\";\n\nexports.name = 'directory';\n\n/**The report returns all parent directories of a given title which exist.\n */\nexports.report = function(title, callback, options) {\n\tvar index = -1;\n\twhile ((index = title.indexOf('/', index+1)) >= 0) {\n\t\tvar dir = title.substr(0, index);\n\t\tcallback(dir, '.' + title.substr(index));\n\t}\n};\n\n/**The relink returns the new title (if any) derived from title for a given\n * rename of fromTitle to toTitle.\n */\nexports.relink = function(title, fromTitle, toTitle, options) {\n\tvar length = fromTitle.length;\n\tif (title.charAt(length) === '/' && title.substr(0, length) === fromTitle) {\n\t\treturn {output: toTitle + title.substr(length)};\n\t}\n\treturn undefined;\n};\n",
"caption": "{{$:/plugins/flibbles/relink-titles/language/Directory/Caption}}",
"description": "{{$:/plugins/flibbles/relink-titles/language/Directory/Description}}",
"module-type": "relinktitlesrule",
"type": "application/javascript"
},
"$:/plugins/flibbles/relink-titles/language/Lookup/Description": {
"title": "$:/plugins/flibbles/relink-titles/language/Lookup/Description",
"text": "This option updates all configuration tiddlers which relate to target tiddlers either through fixed prefixes or suffixes, i.e. `$:/config/Buttons/Visibility/fromFile` becomes `$:/config/Buttons/Visibility/toFile` when \"fromFile\" is renamed.\n\nEach line corresponds to a pattern, where `$(currentTiddler)$` would be the name of the tiddler being renamed, and `$(*)$` matches with anything.\n\n<$edit-text\n\ttiddler=\"$:/config/flibbles/relink-titles/lookup/patterns\"\n\ttag=\"textarea\"\n/>\n"
},
"$:/config/flibbles/relink-titles/lookup/patterns": {
"title": "$:/config/flibbles/relink-titles/lookup/patterns",
"text": "$:/config/$(*)$/Visibility/$(currentTiddler)$\n"
},
"$:/plugins/flibbles/relink-titles/rules/lookup": {
"title": "$:/plugins/flibbles/relink-titles/rules/lookup",
"text": "/*\\\ncaption: {{$:/plugins/flibbles/relink-titles/language/Lookup/Caption}}\ndescription: {{$:/plugins/flibbles/relink-titles/language/Lookup/Description}}\nmodule-type: relinktitlesrule\ntitle: $:/plugins/flibbles/relink-titles/rules/lookup\ntype: application/javascript\n\nHandles setting tiddlers which are derived from other tiddlers, like how\n\n```\n$:/config/PageControlButtons/Visibility/$(currentTiddler)$\n```\n\nset the visibility for $(currentTiddler)$\n\n\\*/\n\n\"use strict\";\n\nexports.name = 'lookup';\n\nvar patternTiddler = \"$:/config/flibbles/relink-titles/lookup/patterns\";\nvar anyMatcher = /\\$\\((?:\\*|currentTiddler)\\)\\$/g;\n\nexports.report = function(targetTitle, callback, options) {\n\tvar patterns = getPatterns(options.wiki);\n\tfor (var i = 0; i < patterns.length; i++) {\n\t\tvar pattern = patterns[i];\n\t\tvar index = 0;\n\t\tvar results = match(pattern, targetTitle);\n\t\tif (results) {\n\t\t\tvar blurb = pattern.string.replace(anyMatcher, function(match) {\n\t\t\t\tindex++;\n\t\t\t\tif (match === \"$(*)$\") {\n\t\t\t\t\treturn results[index];\n\t\t\t\t} else { // must be \"$(currentTiddler)$\"\n\t\t\t\t\treturn \"...\";\n\t\t\t\t}\n\t\t\t});\n\t\t\tcallback(results.title, blurb);\n\t\t}\n\t}\n};\n\nexports.relink = function(targetTitle, fromTitle, toTitle, options) {\n\tvar patterns = getPatterns(options.wiki);\n\tfor (var i = 0; i < patterns.length; i++) {\n\t\tvar pattern = patterns[i];\n\t\tvar results = match(pattern, targetTitle, fromTitle);\n\t\tif (results) {\n\t\t\tvar groupIndex = 0;\n\t\t\t// Make all the correct substitutions to create the new title\n\t\t\tvar output = pattern.string.replace(anyMatcher, function(match) {\n\t\t\t\tgroupIndex++;\n\t\t\t\tif (match === \"$(*)$\") {\n\t\t\t\t\treturn results[groupIndex];\n\t\t\t\t} else { // must be \"$(currentTiddler)$\"\n\t\t\t\t\treturn toTitle;\n\t\t\t\t}\n\t\t\t});\n\t\t\treturn {output: output};\n\t\t}\n\t}\n\treturn undefined;\n};\n\nfunction match(pattern, string, matchTitle) {\n\tvar results = pattern.matcher.exec(string);\n\tif (results) {\n\t\t// It superficially matches, but we need to make sure all the right\n\t\t// groups match too.\n\t\tfor (var j = 0; j < pattern.groups.length; j++) {\n\t\t\tvar index = pattern.groups[j];\n\t\t\tif (matchTitle === undefined) {\n\t\t\t\t// It doesn't matter what matchTitle is, as long as all\n\t\t\t\t// groups match the same thing.\n\t\t\t\tmatchTitle = results[index];\n\t\t\t} else if (results[index] !== matchTitle) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}\n\t\tresults.title = matchTitle;\n\t}\n\treturn results;\n};\n\nfunction getPatterns(wiki) {\n\treturn wiki.getCacheForTiddler(patternTiddler, \"relink-titles\", function() {\n\t\tvar text = wiki.getTiddlerText(patternTiddler);\n\t\tvar matchers = []\n\t\tif (text) {\n\t\t\tvar array = text.split('\\n');\n\t\t\tfor (var i = 0; i < array.length; i++) {\n\t\t\t\tvar pattern = formPatternFromString(array[i]);\n\t\t\t\tif (pattern) {\n\t\t\t\t\tmatchers.push(pattern);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn matchers;\n\t});\n};\n\nfunction formPatternFromString(string) {\n\tvar groupIndex = 1;\n\tvar matchingGroups = [];\n\tstring = $tw.utils.trim(string);\n\tvar parts = string.split(\"$(currentTiddler)$\");\n\tif (parts.length <= 1) {\n\t\t// $(currentTiddler)$ must not have been there\n\t\treturn null;\n\t}\n\tfor (var j = 0; j < parts.length; j++) {\n\t\t// Split it up by the wildcards\n\t\tvar sections = parts[j].split(\"$(*)$\");\n\t\tfor (var k = 0; k < sections.length; k++) {\n\t\t\tsections[k] = $tw.utils.escapeRegExp(sections[k]);\n\t\t}\n\t\tparts[j] = sections.join(\"(.*)\");\n\t\t// If there are 3 sections, then there is 2 $(*)$, so the index\n\t\t// must skip them. etc...\n\t\tgroupIndex += sections.length-1;\n\t\tif (j < parts.length-1) {\n\t\t\t// If there are 3 parts, that means 2 $(currentTiddler)$, and\n\t\t\t// so we skip the last part\n\t\t\tmatchingGroups.push(groupIndex);\n\t\t\tgroupIndex++;\n\t\t}\n\t}\n\treturn {\n\t\tstring: string,\n\t\tgroups: matchingGroups,\n\t\tmatcher: new RegExp(\"^\" + parts.join(\"(.*)\") + \"$\")\n\t};\n};\n",
"caption": "{{$:/plugins/flibbles/relink-titles/language/Lookup/Caption}}",
"description": "{{$:/plugins/flibbles/relink-titles/language/Lookup/Description}}",
"module-type": "relinktitlesrule",
"type": "application/javascript"
}
}
}
13 changes: 13 additions & 0 deletions wiki/tiddlers/$__plugins_flibbles_relink-titles.json.meta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
author: Flibbles
core-version: >=5.1.22
demo: http://flibbles.github.io/tw5-relink/
dependents:
description: Renames tiddlers with titles derived from Relinked tiddler
list: readme configuration
name: Relink Titles
parent-plugin: $:/plugins/flibbles/relink
plugin-type: plugin
source: https://github.com/flibbles/tw5-relink
title: $:/plugins/flibbles/relink-titles
type: application/json
version: 2.3.1
Loading

0 comments on commit b74884a

Please sign in to comment.