Difference between revisions of "Template:Draft article check/doc"

From blackwiki
Jump to navigation Jump to search
imported>Vanisaac
m (→‎Usage: clean up per WP:CAT#T and WP:AWBREQ add template:Sandbox other)
 
(17 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
 
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
 
<!-- Categories go at the bottom of this page and interwikis go in Wikidata. -->
DraftChecker is a template to alert editors to the existence of relevant articles or drafts.
+
{{tl|Draft article check}} is a template designed to alert editors to the existence of relevant articles or drafts.
* In '''Draft''' or '''Draft_Talk''',  DraftChecker will check for an '''Article''' of the same title. 
 
* In '''Article_Talk''', DraftChecker will check for a '''Draft''' of the same title.
 
* In the '''Article''' namespace, Draftchecker will check for a '''Draft''' of the same title, but '''will only show a message if''' a custom javascript determines the user is logged in. 
 
  
 
== Usage ==
 
== Usage ==
'''<nowiki>{{DraftChecker}}</nowiki>'''
+
{{mbox|text=The functionality of this template is being developed and updated. It is currently mostly used in the ''Draft:''/''Draft talk:'' spaces via {{tl|Draft article}}, so that's what's documented. Other namespaces are forthcoming, so it can be used in {{tl|Userspace draft}}, for example, or by placing {{tl|Draft article}} in other namespaces, like ''Talk:'' or ''Wikipedia:''}}
==Technical details==
+
<code><nowiki>{{Draft article check}}</nowiki></code> will give different results depending on which namespace it is used, and which corresponding article exist in mainspace/draft space
* The messages displayed are stored in sub-templates [[Template:DraftChecker/ArticleFound|/ArticleFound]], [[Template:DraftChecker/DraftFound|/DraftFound]], and [[Template:DraftChecker/ArticleNotFound|/ArticleNotFound]].
 
* This template calls two sub-templates: [[Template:DraftChecker/CheckForDraft|/CheckForDraft]] and [[Template:DraftChecker/CheckForArticle|/CheckForArticle]]
 
  
==Logged-in Editors -vs- Anonymous Readers==
+
{|class=wikitable
In order for logged-in editors to view '''DraftChecker''''s links in the main Article namespace, two lines of javascript code must be installed: the [[User:HectorMoffet/ShowOnlyToLoggedInUsers.js|ShowOnlyToLoggedInUsers.js]] script.     
+
|-
 +
!Namespace !! Message
 +
|-
 +
| Draft || {{Draft article check|demospace=Draft|Example}} (article)<br>{{Draft article check|demospace=Draft|J Phys C}} (redirect)
 +
|-
 +
| Draft talk || {{Draft article check|demospace=Draft talk|Example}} (article)<br>{{Draft article check|demospace=Draft talk|J Phys C}} (redirect)
 +
|-
 +
!colspan="2"|''in development''
 +
|-
 +
| Main || {{Draft article check|demospace=Main|Example}} (article)<br>{{Draft article check|demospace=Main|J Phys C}} (redirect)
 +
|-
 +
| Talk || {{Draft article check|demospace=Talk|Example}} (article)<br>{{Draft article check|demospace=Talk|J Phys C}} (redirect)
 +
|-
 +
| User || {{Draft article check|demospace=User|Example}} (article)<br>{{Draft article check|demospace=User|J Phys C}} (redirect)
 +
|-
 +
| User talk || {{Draft article check|demospace=User talk|Example}} (article)<br>{{Draft article check|demospace=User talk|J Phys C}} (redirect)
  
While '''DraftChecker''' is in development, you can install this script by adding the following line to [[Special:MyPage/common.js|your common.js file]]:
+
|-
:importScript('[[User:HectorMoffet/ShowOnlyToLoggedInUsers.js]]');
+
| Wikipedia || {{Draft article check|demospace=Wikipedia|Example}} (article)<br>{{Draft article check|demospace=Wikipedia|J Phys C}} (redirect)
 +
|-
 +
| Wikipedia talk || {{Draft article check|demospace=Wikipedia talk|Example}} (article)<br>{{Draft article check|demospace=Wikipedia talk|J Phys C}} (redirect)
  
In the future, the [[User:HectorMoffet/ShowOnlyToLoggedInUsers.js|ShowOnlyToLoggedInUsers.js script]] could become a [[Wikipedia:Gadget|Gadget]] enabled by default, or its two lines of code could be  incorporated into Wikipedia's default javascript file ([[MediaWiki:Common.js]]).
+
|}
  
==Test Cases==
+
<includeonly>{{Sandbox other||
As of 15:43, 23 December 2013 (UTC), the following testcases passed:  (altering the text/existence of relevant pages in future may alter the results)
 
* [[Draft:Example]] should show a link to the corresponding Wikipedia article
 
* [[Draft talk:Example]] should show a link to the corresponding Wikipedia article
 
* [[Talk:Example]] should show a link to the corresponding Draft .
 
* If you are '''not logged-in''', then the Wikipedia article [[Example]] should NOT show any links to drafts. (Although the html source should show an element with the style "visiblity: hidden;") 
 
* if you are '''logged-in''', (and '''[[User:HectorMoffet/ShowOnlyToLoggedInUsers.js|ShowOnlyToLoggedInUsers.js]] is installed'''), then the Wikipedia article [[Example]] SHOULD show a link to the corresponding draft.
 
 
 
* [[Draft:DraftcheckerNullTest]] and [[Draft talk:DraftcheckerNullTest]] should report the non-existence of the corresponding article.
 
* [[Kierkegaard (disambiguation)]] and [[Talk:Kierkegaard (disambiguation)]] should not report anything.
 
* [[Wikipedia:Example]] should not report anything.
 
 
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
 
 
<!-- Categories go here, and interwikis go in Wikidata -->
 
<!-- Categories go here, and interwikis go in Wikidata -->
 
+
[[Category:Draft namespace templates]]
{{uncat}}
+
[[Category:Wikipedia drafts]]
 
 
 
}}</includeonly>
 
}}</includeonly>

Latest revision as of 00:36, 25 April 2020

{{Draft article check}} is a template designed to alert editors to the existence of relevant articles or drafts.

Usage

{{Draft article check}} will give different results depending on which namespace it is used, and which corresponding article exist in mainspace/draft space

Namespace Message
Draft On Draft:Example:Template:Space (article)
On Draft:J Phys C:Template:Space (redirect)
Draft talk On Draft talk:Example:Template:Space (article)
On Draft talk:J Phys C:Template:Space (redirect)
in development
Main On Example:Template:Space (article)
On J Phys C:Template:Space (redirect)
Talk On Talk:Example:Template:Space (article)
On Talk:J Phys C:Template:Space (redirect)
User On User:Example:Template:Space (article)
On User:J Phys C:Template:Space (redirect)
User talk On User talk:Example:Template:Space (article)
On User talk:J Phys C:Template:Space (redirect)
Wikipedia On Wikipedia:Example:Template:Space (article)
On Wikipedia:J Phys C:Template:Space (redirect)
Wikipedia talk On Wikipedia talk:Example:Template:Space (article)
On Wikipedia talk:J Phys C:Template:Space (redirect)