sabrogden / Ditto

Ditto is an extension to the Windows Clipboard. You copy something to the Clipboard and Ditto takes what you copied and stores it in a database to retrieve at a later time.
https://ditto-cp.sourceforge.io/
3.95k stars 208 forks source link

No support for templates with placeholders for variables (string interpolation) #540

Open Chealer opened 1 year ago

Chealer commented 1 year ago

Ditto allows pasting any string which was copied. However, as of 03.24.246, to my knowledge, it does not allow pasting a string which is not precisely in the clipboard, but rather generated on-the-fly according to variables.

For example, we use a MediaWiki instance which does not support WYSIWYG. To insert inline code snippets, we have to use the following MediaWiki code: <code>‎int count = 1;</code> Doing that would be faster if I could define a template entry with references to variables. These references could be defined using placeholders, identified by some syntax. Then, when pasting, the user would be prompted for the values of the variables, before interpolating them to compute the formatted string and pasting it. Therefore, if placeholders used the ${variableName} syntax (as in JavaScript), a template for inserting an inline code snippet in MediaWiki could use the template string <code>${code}</code>, defining a code variable. When pasting that template entry, the user could type the value ‎int count = 1;, which would then paste the above wiki code.

For sure, our wiki could have a feature to ease code insertion, which would be better than doing it with Ditto (and I believe MediaWiki does already support that with appropriate versions/extensions). And the same could probably be argued against any use case, but I can see enough enough applications to warrant developing this for all these cases which will take long/forever to be solved ideally.