On Tue, Apr 8, 2008 at 10:49 AM, Jonathan Nowacki jnowacki@gmail.com wrote:
I added this code to MediaWiki:Common.js
var button = { "imageFile": " https://compbio.iupui.edu/support/wiki/images/e/e3/Button_GNU.png", //image to be shown on the button (may be a full URL too), 22x22 pixels "speedTip": "Use this to mark free software that's ALSO open source", //text shown in a tooltip when hovering the mouse over the button "tagOpen": "{{", //the text to use to mark the beginning of the block "tagClose": "GNU}}", //the text to use to mark the end of the block (if any) "sampleText": "" //the sample text to place inside the block }; mwCustomEditButtons.push(button);
The goal is to put a *{{GNU}}* tag into the wiki whenever a button is pressed. If I put the {{GNU}} within "tagOpen" the template is interpreted before insertion into the page which is NOT what I want. The button should insert the template name "{{GNU}}" and not the text the template references. So I split the template in half but the cursor is in the middle of the template. e.g.:
{{|GNU}}
What I would like to do is put the cursor at the end of the template. For example:
{{GNU}} |
That way someone can insert the template and keep typing without messing up the template. Any ideas on how to do this?
Thanks,
Jonathan Nowacki
-- IU Medical School 410 West 10th Street, Suite 5000 Indianapolis, IN 46202-5122 United States of America _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
The solution is to put {{GNU}} as the value for tagOpen. To do this without having the template itself be transcluded on Common.js, escape the braces, i.e. "{{GNU}}"