Template:Edit/doc: Difference between revisions

From the Croc Wiki, the Croc encyclopedia
Jump to navigationJump to search
Content added Content deleted
(add tooltip documentation)
No edit summary
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
<!-- Please add categories to the /doc subpage, and interwikis at Wikidata (see Wikipedia:Wikidata) -->
{{High-use}}
Provides a link to edit a page.
This [[Wikipedia:Template messages|template]] is a [[Wikipedia:Manual of Style/Self-references to avoid|self-reference]] and so is part of the Wikipedia project rather than the encyclopedic content.


It provides a clickable link to edit a page, or a section of the page.
==Usage==
<code><nowiki>{{</nowiki>'''Edit'''|''Page''|''Label''|section=''Section''|editintro=''Editintro''|preload=''preload''|preloadtitle=''Preloadtitle''|tooltip=''tooltip''<nowiki>}}</nowiki></code>


== Usage ==
All parameters are optional
<pre>
*Page: the page to edit, if not the current page
{{Edit
*Label: the text to label the link, defaults to "edit"
|1=
*Section: the section to edit, 0 for top section, "new" to add a new section
|2=
*Editintro: Title of a page that will be transcluded above the edit box. Not a wikilink, templates require <code>Template:</code>
|section=
*Preload: Title of a page to preload into the edit form if the page to be edited does not exist
|editintro=
*Preloadtitle: if section=new, a title to be preloaded into the title box of the edit form
|preload=
*Tooltip: the text to display when user hovers over the link
|preloadtitle=
|tooltip=
}}
</pre>


* '''1''': the page to edit. If omitted, it will be the current page.
* '''2''': the label text of the edit link. If omitted, it is "edit" by default.
* '''section''': the section to edit, in which <code>0</code> for the top (i.e. lead section), <code>1</code> for the first (sub-)section, and <code>new</code> for adding a new section.
* '''editintro''': the content of a page/template that will be transcluded above the edit box when you edit the page. Usually used to load [[w:en:Wikipedia:Template messages|template messages]].
* '''preload''': the content of a page/template that will be preloaded into the text area of the edit form. It works only if the page to be edited does not exist.
* '''preloadtitle''': if making a new section (i.e. <code>|section=new</code>), the title to be preloaded into the title box of the edit form.
* '''tooltip''': the text to display when you hover over the link.

Notes:
* All parameters are optional.
* The parameter names '''must be''' in lowercase or they will fail.

== Examples ==
{| class="wikitable"
|-
!style="width: 35%;"| Code
!style="width: 15%;"| Result
!| Explanation
|-
| <nowiki>{{edit}}</nowiki> || {{edit}} || Edit current page
|-
| <nowiki>{{edit| |edit template doc}}</nowiki> || {{edit| |edit template doc}} ||
|-
| <nowiki>{{edit|2=edit template doc}}</nowiki> || {{edit|2=edit template doc}} ||
|-
| <nowiki>{{edit|friendship}}</nowiki> || {{edit|friendship}} || Edit the article [[friendship]]
|-
| <nowiki>{{edit|friendship|section=3}}</nowiki> || {{edit|friendship|section=3}} || Edit the third order of a (sub-)section of the article [[friendship]], which is [https://en.wikipedia.org/w/index.php?title=Friendship&oldid=930460849#Adolescence 1.2 Adolescence] as of 10 Jan 2020
|-
| <nowiki>{{edit|Draft:Sandbox|editintro=Template:Disambig editintro}}</nowiki> || {{edit|Draft:Sandbox|editintro=Template:Disambig editintro}} || Load {{tl|Disambig editintro}} when you edit
|-
| <nowiki>{{edit|Template:Some new template|preload=Template:Documentation/preload}}</nowiki> || {{edit|Template:Some new template|preload=Template:Documentation/preload}} || Preload the whoole content of {{tl|Documentation/preload}} when you create a new template
|-
| <nowiki>{{edit|Wikipedia talk:Sandbox|section=new||preloadtitle=Custom title of the new section}}</nowiki> || {{edit|Wikipedia talk:Sandbox|section=new||preloadtitle=Custom title of the new section}} || Create a new section of a custom title
|-
| <nowiki>{{edit|2=link with tooltip|tooltip=This is a tooltip}}</nowiki> || {{edit| |tooltip=This is a tooltip}} || Hover over the link to see the tooltip
|}

== TemplateData ==
{{TemplateDataHeader}}
{{TemplateDataHeader}}
<templatedata>
<templatedata>
Line 75: Line 116:
</templatedata>
</templatedata>


== Comparison ==

==See also==
{{edit templates}}
{{edit templates}}


== See also ==
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
* {{tl|View}}
<!-- Categories go here and interwikis go in Wikidata. -->
* {{tl|VTE}}
[[Category:Internal link maintenance templates]]

[[Category:Internal link templates]]


<includeonly>{{sandbox other||
<!-- Add categories below this line, and interwikis at Wikidata -->
[[{{ns:Category}}:Internal link maintenance templates]]
[[{{ns:Category}}:Internal link templates]]
}}</includeonly>
}}</includeonly>