Template:Mdnbox/doc: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(Added category.)
 
(9 intermediate revisions by the same user not shown)
Line 2: Line 2:
__NOTOC__
__NOTOC__
==Usage==
==Usage==
{{tl|mdnbox}} produces a right-hand adjusted, floating message box, telling the reader there is a document on the current subject (either the wikipage's name, or an user-defined title) on [https://developer.mozilla.org Mozilla Developer Network] (MDN).
{{tl|mdnbox}} produces a right-hand adjusted, floating message box, telling the reader there are documents on a certain subject on [https://developer.mozilla.org Mozilla Developer Network] (MDN).


==Parameters==
==Parameters==
There are 1 unnamed and 8 named parameters (see the table below), none of which is required for the template to work. However, if the template is not configured correctly, it will most likely cause the document link to break.
There are 3 named parameters (see the table below), none of which is required for the template to work.


{| class="wikitable"
{| class="wikitable"
Line 11: Line 11:
! Parameter !! Description
! Parameter !! Description
|-
|-
| ''<code>1</code>'' || Custom link text; unnamed parameter
| <code>zone</code> || MDN zone
|-
|-
| <code>lang</code> || Language code
| <code>wpla</code> || MDN web platform
|-
|-
| <code>d</code> || For exclusion of the page level <tt>/docs</tt>
| <code>tool</code> || MDN developer tool
|}
 
;<big>Copy-paste template</big>
* <code><nowiki>{{mdnbox|zone= |wpla= |tool= }}</nowiki></code>
 
===MDN zone===
;<big>zone</big>
MDN sort the major Mozilla application projects into "zones". You can choose to link to a certain zone, or to the overview page for Mozilla projects, by entering the parameter <code>zone</code> and set it to one of the values in the table '''Zone codes''' below. In addition to the zones specified at MDN, I have added a few common applications.
 
;Usage:
* <code><nowiki>{{mdnbox|</nowiki>zone=''zone code''<nowiki>}}</nowiki></code>
 
====Zone codes====
{| class="wikitable"
|-
|-
| <code>l1</code> || Custom page address/first page level
! Value !! MDN zone !! Comment
|-
|-
| <code>l2</code>–<code>l5</code> || Additional page levels 2–5
| add || Add-ons ||
|-
|-
| <code>sh</code> || Page subheader/anchor name
| app || Apps ||
|}
|-
 
| cal || Calendar/Lightning ||
;<big>Copy-paste templates</big>
|-
{| class="wikitable"
| ff || Firefox ||
|-
| ffa || Firefox for Android ||
|-
| fos || Firefox OS ||
|-
| fxa || Firefox Accounts || Will eventually replace Persona
|-
|-
! Size !! Code
| mp || Marketplace ||
|-
|-
| Basic || <code><nowiki>{{mdnbox|lang= |''1'' }}</nowiki></code>
| per || Persona || Will be incorporated into Firefox Accounts
|-
|-
| Common || <code><nowiki>{{mdnbox|lang= |l1= |l2= |''1'' }}</nowiki></code>
| tb || Thunderbird ||
|-
|-
| Full || <code><nowiki>{{mdnbox|lang= |d=no |l1= |l2= |l3= |l4= |l5= |''1'' }}</nowiki></code>
| moz || Mozilla || For all other Mozilla projects
|}
|}


===Custom link text===
===Web Platform===
;<big>1</big>
;<big>wpla</big>
Custom text string that will show as link text. The parameter is unnamed, so no parameter name needs to be entered.
MDN have documentation for all the web platforms used by Mozilla and Mozilla products. You can choose to link to a certain platform, or to the overview page for the web technologies you may find in the Mozilla projects you work with, by entering the parameter <code>wpla</code> and set it to one of the values in the table '''Platform codes''' below.
 
Note:
* If this parameter is left out, the link will be named after the current page. The automatically generated name will include subpages, but not the namespace.
 
If, for example, you place the template on the subpage <tt>L10n:Dashboard/Apps/Projects</tt>, and don't define any link text of your own, the link name will be "Dashboard/Apps/Projects".


;Usage:
;Usage:
* <code><nowiki>{{mdnbox|</nowiki>''text''<nowiki>}}</nowiki></code>
* <code><nowiki>{{mdnbox|</nowiki>wpla=''platform code''<nowiki>}}</nowiki></code>


===Language===
====Platform codes====
;<big>lang</big>
{| class="wikitable"
It is possible to specify a MDN locale code for the link (e.g. <tt>de</tt> for German or <tt>sv-SE</tt> for Swedish). If this parameter is left out, the link will be redirected at MDN to either the locale of the user's Firefox browser, or (if there is no translation of that webpage for the user's locale) to the English default locale (<tt>en-US</tt>). An up-to-date list of Mozilla's web locale codes can be found at the [https://l10n.mozilla-community.org/webdashboard/ Mozilla Web Localization Dashboard].
|-
! Value !! Web platform !! Comment
|-
| api || APIs and DOM ||
|-
| css || CSS ||
|-
| css3 || CSS3 ||
|-
| graph || Graphics ||
|-
| html || HTML ||
|-
| html5 || HTML5 ||
|-
| js || JavaScript ||
|-
| mml || MathML ||
|-
| all || To the overview page <br>''Web technology for developers'' || For all other web platforms
|}


;Usage:
===Developer Tools===
* <code><nowiki>{{mdnbox|</nowiki>lang=''locale code''<nowiki>}}</nowiki></code>
;<big>tool</big>
 
In addition to documentation on applications designed to run as stand-alone programs, MDN have documentation for Mozilla's web tools and in-application developer tools. You can choose to link to a certain tool, or to the overview page for the developer tools in Firefox, by entering the parameter <code>tool</code> and set it to one of the values in the table '''Tool codes''' below.
===Exclude the /docs page level===
;<big>d</big>
Most pages on MDN are placed as documents under the page level <tt>/docs</tt>, for ''documents''. But some sections of the website don't use that level. This template will, as default, include <tt>/docs</tt> in the URL, but it is possible to suppress that inclusion by defining this parameter ('''<code>d</code>''') to the value <var>no</var>. Any other value, e.g. <var>yes</var>, <var>null</var>, or "&nbsp;" (empty), will be ignored (i.e. the <tt>/docs</tt> level will still be included).
 
So, only use this parameter if you need to exclude the <tt>/docs</tt> level frpm the URL. If you want to keep it, you don't need to do anything, it will be inserted automatically.


;Usage:
;Usage:
* <code><nowiki>{{mdnbox|</nowiki>d=no<nowiki>}}</nowiki></code>
* <code><nowiki>{{</nowiki>mdnbox|tool=''tool code''<nowiki>}}</nowiki></code>


===Page address===
====Tool codes====
There are two ways to enter the page address in the template, by entering the entire address part for the webpage in one string, or by defining each page level separately.
{| class="wikitable"
 
|-
====One address string====
! Value !! Developer tool !! Comment
;<big>l1</big>
|-
If you want to link to a webpage under the websites base address, and enter the page address as a single string, you can use the '''<code>l1</code>''' parameter ("l1" as in ''level one'').
| appm || App Manager || Firefox OS
 
|-
To, e.g., link to the MDN page ''Localizing with Verbatim'' (<tt>developer.mozilla.org/en-US/docs/Mozilla/Localization/Localizing_with_Verbatim</tt>), you enter <var>Mozilla/Localization/Localizing with Verbatim</var>, which is the page address under the level <tt>developer.mozilla.org/en-US/docs/</tt>. The name you type in must be the same as the page's address part in the location bar.
| jsdeb || JavaScript Debugger ||
 
|-
;Limitation:
| pagin || Page Inspector ||
* Any linkpart pointing to an anchor/subheader (i.e. a link that includes a number sign, #) will break the link. If you want to link to an anchor/subheader, use the <code>sh</code> parameter (see below).
|-
 
| wcon || Web Console ||
;Usage:
|-
* <code><nowiki>{{mdnbox|</nowiki>l1=''custom address string''<nowiki>}}</nowiki></code>
| all || To the overview page <br>''Firefox Developer Tools'' || For all other developer tools
 
|}
====Defined page levels====
;<big>l1 + l2–l5</big>
Sometimes, the page address is particularly long or complicated. If you want to enter the address in a structured way, you can use the parameters '''<code>l1</code>'''–'''<code>l5</code>''' in order to define up to 5 page levels ("l2" as in ''level two'', etc.) under the level <tt>developer.mozilla.org/docs/</tt> (or under <tt>developer.mozilla.org/</tt>, if the <tt>/docs</tt> level is excluded).
 
To, e.g., link to the MDN page ''Localizing with Verbatim'' (<tt>developer.mozilla.org/en-US/docs/Mozilla/Localization/Localizing_with_Verbatim</tt>), you enter the values <var>Mozilla</var>, <var>Localization</var>, and <var>Localizing with Verbatim</var> (which is the page address under the level <tt>developer.mozilla.org/en-US/docs/</tt>), defining the parameters <code>l1=</code>, <code>l2=</code>, and <code>l3=</code>, respectively. That will insert the string <tt>[…]/Mozilla/Localization/Localizing with Verbatim</tt> into the URL.
 
;Limitations:
* You cannot use the parameters <code>l2</code> to <code>l5</code> without also using <code>l1</code>.
* Any linkpart pointing to an anchor/subheader (i.e. a link that includes a number sign, #) will break the link. If you want to link to an anchor/subheader, use the <code>sh</code> parameter (see below).
 
;Usage:
* <code><nowiki>{{mdnbox|</nowiki>l1=''level 1''|l2=''level 2''|l3=''level 3''|l4=''level 4''|l5=''level 5''<nowiki>}}</nowiki></code>
 
===Page anchor/subheader===
;<big>sh</big>
This parameter allow you to link to a named section of an article, i.e. a subheader or an anchor in the format <tt>Page_name#Section_name</tt>. Just enter the name of the section, i.e. don't include the number sign (<tt>#</tt>). That is inserted automatically.
 
For example, to link to the article section ''Additional tasks'' on the page ''Localizing with Verbatim'', you enter the value <var>Additional tasks</var>, which will be output as <tt>#Additional tasks</tt>.
 
;Usage:
* <code><nowiki>{{</nowiki>mdnbox|sh=''anchor/subheader title''<nowiki>}}</nowiki></code>


==Examples==
==Examples==
Line 106: Line 115:
;<big>No parameters</big>
;<big>No parameters</big>
<code><nowiki>{{mdnbox}}</nowiki></code> gives
<code><nowiki>{{mdnbox}}</nowiki></code> gives
<br><br><br>
<br><br><br><br>
{{mdnbox|Custom link text}}
{{mdnbox|zone=ff}}
;<big>1</big>
;<big>zone</big>
<code><nowiki>{{mdnbox|Custom link text}}</nowiki></code> gives
<code><nowiki>{{mdnbox|zone=ff}}</nowiki></code> gives
<br><br><br>
<br><br><br><br>
{{mdnbox|Localizing with Verbatim|l1=Mozilla/Localization/Localizing with Verbatim}}
{{mdnbox|wpla=html5}}
;<big>l1</big>
;<big>wpla</big>
<code><nowiki>{{mdnbox|Localizing with Verbatim|l1=Mozilla/Localization/Localizing with Verbatim}}</nowiki></code> gives
<code><nowiki>{{mdnbox|wpla=html5}}</nowiki></code> gives
<br><br><br>
<br><br><br><br>
{{mdnbox|''Localizing with Verbatim'' in Korean|lang=ko|l1=Mozilla/Localization/Localizing with Verbatim}}
{{mdnbox|tool=jsdeb}}
<big>lang</big>
;<big>tool</big>
 
<code><nowiki>{{mdnbox|tool=jsdeb}}</nowiki></code> gives
<code><nowiki>{{mdnbox|''Localizing with Verbatim'' in Korean|lang=ko|l1=Mozilla/Localization/Localizing with Verbatim}}</nowiki></code> gives
<br><br><br><br>
<br><br><br>
{{mdnbox|zone=ff|wpla=html5|tool=jsdeb}}
<big>d</big>
;<big>Combo</big>
{{mdnbox|The MDN project|l1=MDN}}
<code><nowiki>{{mdnbox|zone=ff|wpla=html5|tool=jsdeb}}</nowiki></code> gives
:1. No param
:<code><nowiki>{{mdnbox|The MDN project|l1=MDN}}</nowiki></code> gives
<br><br><br>
{{mdnbox|The MDN project|d=|l1=MDN}}
:2. Empty
:<code><nowiki>{{mdnbox|The MDN project|d=|l1=MDN}}</nowiki></code> gives
<br><br><br>
{{mdnbox|Add-ons|d=no|l1=Add-ons}}
:3. Value: no
:<code><nowiki>{{mdnbox|Add-ons|d=no|l1=Add-ons}}</nowiki></code> gives
<br><br><br>
{{mdnbox|Localizing with Verbatim|l1=Mozilla|l2=Localization|l3=Localizing with Verbatim}}
<big>l1–l5</big>
 
<code><nowiki>{{mdnbox|Localizing with Verbatim|l1=Mozilla|l2=Localization|l3=Localizing with Verbatim}}</nowiki></code> gives
<br><br><br>
{{mdnbox|Localizing with Verbatim: Additional tasks|l1=Mozilla|l2=Localization|l3=Localizing with Verbatim|sh=Additional tasks}}
<big>sh</big>
 
<code><nowiki>{{mdnbox|Localizing with Verbatim: Additional tasks|l1=Mozilla|l2=Localization|l3=Localizing with Verbatim|sh=Additional tasks}}</nowiki></code> gives


==See also==
==See also==
* {{tl|mozlink}}
* {{tl|mozlink}}
* {{tl|sumobox}}


<includeonly>
<includeonly>
[[Category:Mozilla link templates]]
[[Category:Mozilla link templates]]
[[Category:Message box templates]]
[[Category:Mozilla-specific message boxes]]
[[Category:Mozilla-specific message boxes]]
</includeonly>
</includeonly>

Latest revision as of 09:48, 29 January 2015

Edit-copy green.svg
This is a documentation subpage for Template:Mdnbox.
It contains usage information, categories and other content that is not part of the original template page.

Usage

{{mdnbox}} produces a right-hand adjusted, floating message box, telling the reader there are documents on a certain subject on Mozilla Developer Network (MDN).

Parameters

There are 3 named parameters (see the table below), none of which is required for the template to work.

Parameter Description
zone MDN zone
wpla MDN web platform
tool MDN developer tool
Copy-paste template
  • {{mdnbox|zone= |wpla= |tool= }}

MDN zone

zone

MDN sort the major Mozilla application projects into "zones". You can choose to link to a certain zone, or to the overview page for Mozilla projects, by entering the parameter zone and set it to one of the values in the table Zone codes below. In addition to the zones specified at MDN, I have added a few common applications.

Usage
  • {{mdnbox|zone=zone code}}

Zone codes

Value MDN zone Comment
add Add-ons
app Apps
cal Calendar/Lightning
ff Firefox
ffa Firefox for Android
fos Firefox OS
fxa Firefox Accounts Will eventually replace Persona
mp Marketplace
per Persona Will be incorporated into Firefox Accounts
tb Thunderbird
moz Mozilla For all other Mozilla projects

Web Platform

wpla

MDN have documentation for all the web platforms used by Mozilla and Mozilla products. You can choose to link to a certain platform, or to the overview page for the web technologies you may find in the Mozilla projects you work with, by entering the parameter wpla and set it to one of the values in the table Platform codes below.

Usage
  • {{mdnbox|wpla=platform code}}

Platform codes

Value Web platform Comment
api APIs and DOM
css CSS
css3 CSS3
graph Graphics
html HTML
html5 HTML5
js JavaScript
mml MathML
all To the overview page
Web technology for developers
For all other web platforms

Developer Tools

tool

In addition to documentation on applications designed to run as stand-alone programs, MDN have documentation for Mozilla's web tools and in-application developer tools. You can choose to link to a certain tool, or to the overview page for the developer tools in Firefox, by entering the parameter tool and set it to one of the values in the table Tool codes below.

Usage
  • {{mdnbox|tool=tool code}}

Tool codes

Value Developer tool Comment
appm App Manager Firefox OS
jsdeb JavaScript Debugger
pagin Page Inspector
wcon Web Console
all To the overview page
Firefox Developer Tools
For all other developer tools

Examples

(By parameter)

MDN logotype Find documentation about developing for the web on  MDN text banner
No parameters

{{mdnbox}} gives



MDN logotype Find documentation about Firefox on  MDN text banner
zone

{{mdnbox|zone=ff}} gives



MDN logotype Find documentation about HTML5 on  MDN text banner
wpla

{{mdnbox|wpla=html5}} gives



MDN logotype Find documentation about JavaScript Debugger on  MDN text banner
tool

{{mdnbox|tool=jsdeb}} gives



MDN logotype Find documentation about Firefox and HTML5  and JavaScript Debugger on  MDN text banner
Combo

{{mdnbox|zone=ff|wpla=html5|tool=jsdeb}} gives

See also