-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFC] Syntax for minor variations in tidbits #89
Comments
That looks like a great plugin, but I wouldn't enable it for the main instance. It does complicate the syntax, and would underweight these folded tidbits in comparison to others. That said, it does degrade gracefully, and I don't think it would break many existing factoids. |
I see your point about underweighting the new folded tidbits, but I'm not going to worry about it too much because the intended use case is to replace factoids that currently have several slight variations with just one folded factoid. With regard to breaking existing factoids, it might be better to use |
out of ~140k factoids, about 5 will be affected. Still think it should be a plugin though, not on by default -- both for avoiding unneeded complexity in the main code, and also to make it easy to enable/disable. |
3,750 lines of code and we're worried about the added complexity of maybe a dozen more, lol. No matter. I wrote this plugin tonight. Had to add a new plugin signal in |
I've a couple questions regarding this when you have a moment, @zigdon.
Whatever the answer to question 2, if the answer to question 1 is "Yes", I'm happy with the plugin as-is and ready to open a PR for review. |
This is a working draft, and may be revised based on feedback in the comments. Where appropriate, I will note if a change has been made.
Use case
Avoiding the creation of multiple, nearly identical factoids while still providing more variety than a single factoid under the current system.
Example
Replace this list of tidbits for the same trigger:
with this single factoid:
Note that the list of factoids would double in size from 12 entries to 24 if, for example, it was also desired for Bucket to possibly say "I will $verb the $noun!" etc. With the proposed syntax, that could be folded into the example with
=~ s/not/{not|}/
.Why new syntax
This behavior can sort of be implemented by creating variables. The drawbacks are:
New syntax would eliminate these drawbacks, respectively, as follows:
||
) or an empty alternative at the beginning or end of the list ({|
or|}
) represent a variation where that element does not appear (with multiple consecutive spaces collapsed before output).One of the obvious arguments against this is that it would make the syntax for teaching Bucket even more arcane. In an effort to use something reasonably intuitive, I've proposed curly braces and pipes in this example. Pipes are intuitive regex "or" syntax, and curly braces appear in string interpolation when using languages like PHP—whose $variables Bucket's vars resemble in text. But the syntax is up for discussion just as much as whether to implement the idea.
Implementation considerations
$noun{s|}
at end of example).{list|of|options}
) and/or the number of blocks allowed per factoid (as variables are)?Status
master
) to resolve the variation syntax before variables are expanded.|
if it is escaped with\
:{variations|can|contain\|pipes|by escaping}
yields the candidates["variations", "can", "contain|pipes", "by escaping"]
.split
routine that ignored empty variations at the tail of the block (since fixed).pre_expand
) was merged tomaster
back in May.The text was updated successfully, but these errors were encountered: