Inserting some kind of (even dynamic) template text for a timestamp, macro, widget,and then replacing common misspellings are two entirely different tasks, me thinks.
For the latter, I would possibly define one or more dictionary tiddlersthat specify a filter field to be able to constrain the tiddlers to which it applies,and otherwise specify indexes that are...
- simple words
- replaced as is
- /regex/mgi
- to auto-replace more sophisticated things
Whereas the values represent the replacement text... which — for current DataTiddlers — would one-liners only ...but could perhaps — for inserting multi-line content — leverage a syntax that instructs the replacing algorithm to go fetch the content from a text-reference instead.
Your reference to /regex/mgi was lost on me, I'm afraid. Is that a directory? pragma? library? TW tag? plugin?
/a pattern (group 1) and (group 2)/mgi: <$some-widget attr="""$1$""">$2$</$some-widget>Your reference to /regex/mgi was lost on me, I'm afraid. Is that a directory? pragma? library? TW tag? plugin?I simply tried to hint at wanting to express regexp patterns... that generally look like that, whereas the things within the two forward slashes and after the 2nd vary depending on your pattern.
The tricky bit would be a pattern to replace identified capture groups in the replacement text.
(I include the sort operator because you'd want some predictability in replacments. See here for an example related to the old autocorrect plugin.)
There should also be some way to specify exceptions to where auto-correction occurs.
In Simon's original plugin, this was done by adding a tag (excludeWikiWords) to tiddlers you wanted to exclude from the plugin's reach. Given the extended capabilities of TW5, though, I imagine this could also be a setting in the plugin, configurable in the same way as the list of dictionary tiddlers. (E.g., a list of tiddlers or a macro call like <$list filter="[tag[excludeWikiWords]prefix[$:/]]" />.)
(I include the sort operator because you'd want some predictability in replacments. See here for an example related to the old autocorrect plugin.)Actually, if you wanted predictability, the mechanism will do no sorting whatsoever but walk through the indexes in the very sequence they are specified in the dictionaries. As for dictionaries themselves, the list field of the corresponding system-tag would declare precedence of one dictionary over the other.
There should also be some way to specify exceptions to where auto-correction occurs.I think each dictionary should have a filter field that specifies what tiddlers a given dictionary applies to.
I don't see such a plugin using list widgets but rather query the wiki for replacement definitions in dictionary tiddlers directly (using js). So, any configurations will have to be bound to the dictionaries themselves, I think. Therefore, the only true option I see right now is the filter.
Funny you should mention that, as I'm still struggling to come to grips with the list field and often forget about its ordering power. (Whenever I do remember it, it seems to be in some context where it won't solve my immediate problem — at least in any way I can yet see. ;) )
I think each dictionary should have a filter field that specifies what tiddlers a given dictionary applies to.Hmmmm. Wouldn't it be easier to define the set of affected (or unaffected) tiddlers in one place, rather than having to do so every time you create a new dictionary?
In my case, with TWC, I created new autocorrect lists pretty regularly — and applied them all in the same circumstances. I.e., if there was a tiddler where I didn't want autocorrection, I didn't want ANY autocorrection. Instances where I might want SOME autocorrections but not OTHER autocorrections didn't come up. Even with that ability, I can't imagine that circumstance rearing its head often — but maybe others feel differently.
For example, I used the old autocorrect plugin to expand on episode titles for TV shows. I'd scrape the titles of episodes from Wikipedia or TV.com and run a saved macro in N++ (outside of TW) to give me a set of matched autocorrect pairs that I could drop into a new tiddler. Individual lines there looked something like this: BBad:Felina->//Breaking Bad// season 5, episode 16: "Felina" That allowed me to drop shorthand into my journal tiddlers when I caught an episode of something and know where it fell in the overall run of a show. (It also allowed me to reference episodes by title without having to look up seasons and episode numbers when writing something about a show.)
The TV example may not be especially relevant — but it does demonstrate a case where someone might want to create individual dictionary tiddlers more or less on the fly without having to do a lot of configuration (or updating the list field of the master-tag tiddler).
(Sorry if these suggestions are far afield from how TW5 does things. Despite my efforts to learn, it feels like I'm freshly ignorant about TiddlyWiki all over again since taking the TW5 plunge.)