Help:Custom Edittools

From Zelda Dungeon Wiki
Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.

If there's a complex bit of code that you find yourself copy/pasting a lot, or if you're trying to establish or conform to a consistent format, Custom Edittools allow you to insert prepared content with one click. This is done through an additional "Custom" section at the bottom of the Edittools box below the edit window. On some pages, such as Categories and Interviews, a "Special" section will appear at the top for commonly used code relating to those pages.

User:{{#username:}}/Edittools

The Custom section of the Edittools includes whatever you have on your [[User:{{#username:}}/Edittools]] page. It will not include anyone else's page, your page will not be included for anyone else. This is for your own personal use.

How to construct your Edittools page:

First, go ahead and write whatever content you want to be placed into other pages. Usually this will be something like a template or base formatting for a new article. Then place <charinsert></charinsert> tags around it. To demonstrate, I'll use the Interview template, though it's already included when editing articles in the Interview namespace.

<charinsert>{{Infobox|interview|
| date		= 
| interviewee	= 
| interviewer	= 
| description	= 
| source	= 
}}</charinsert>

If you stop here, save the page and edit a page, you'll find that you can click on and insert "{{Infobox|interview|", or "|date", or "=", etc. This is because charinsert separates the links with spaces. To fix this, you have to put spaces between <nowiki></nowiki> tags. Since, in this example, there are a lot of spaces, I'll go ahead and put the whole thing in nowiki tags.

Newlines also break charinsert, and they have to be replaced with "&#13;". After these changes, the final code is:

<charinsert><nowiki>{{Infobox|interview|+&#13;| date		= &#13;| interviewee	= &#13;| interviewer	= &#13;| description	= &#13;| source	= &#13;}}</nowiki></charinsert>

The '+' after "Infobox|interview|" means that's where the cursor will go when this template is inserted, so you can start filling out the information.

You can include as many of these as you want on your Edittools page, each within its own set of charinsert tags, separated by spaces. Now, every time you edit a page, you can simply scroll down to the Custom Edittools and click on the text you want to add, and it will be inserted where your cursor is in the editing window.

User:{{#username:}}/Macro

One downside to Custom Edittools is that the entirety of the code or text appears in the Edittools, which can be cluttered and confusing. In some cases it might be appropriate to add another layer to simplify the inclusion.

Macro

To start, create the [[User:{{#username:}}/Macro]] page. Add whatever you want to be accessible through the Edittools, and this time surround it with "section" tags. Place "<section begin="id" />" at the beginning, and "<section end="id" />" at the end, replacing id with a useful unique identifier to refer to that section. For example:

<section begin="Lipsum" />Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam et nulla orci. Duis ac viverra metus. Mauris quis lorem leo. Quisque odio leo, tristique at mollis sed, tempus sed arcu.<section end="Lipsum" />

You can add as many of these sections as you want on this page.

Edittools

Now, back to your [[User:{{#username:}}/Edittools]] page, you need to transclude the sections from your Macro page. The code for the example above would be:

<charinsert>{{subst:#lst:User:Fi/Macro|Lipsum}}</charinsert>

Replace "Fi" with "{{#username:}}" and "Lipsum" with the id you defined on the Macro page.

This won't insert the text into the editing window, but it will add the code to substitute it into the article. If you need to add to the inserted text, you'll have to save your work and start another edit. It's not recommended to include templates that need to be filled out this way, as the extra edit(s) it requires clogs up the Recent Edits. And is making two edits really more convenient than having a jumble of text at the bottom of the Edittools?

Resources