|
|
| 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 4 named parameters (see the table below), none of which is required for the template to work, but one of which has to be used together with one or more of the other parameters. |
|
| |
|
| {| class="wikitable" | | {| class="wikitable" |
| |- | | |- |
| ! Parameter !! Description | | ! Parameter !! Description |
| |-
| |
| | ''<code>1</code>'' || Custom link text; unnamed parameter
| |
| |- | | |- |
| | <code>lang</code> || Language code | | | <code>lang</code> || Language code |
| |- | | |- |
| | <code>d</code> || For exclusion of the page level <tt>/docs</tt> | | | <code>zone</code> || MDN zone |
| |-
| |
| | <code>l1</code> || Custom page address/first page level
| |
| |- | | |- |
| | <code>l2</code>–<code>l5</code> || Additional page levels 2–5 | | | <code>wpla</code> || MDN web platform |
| |- | | |- |
| | <code>sh</code> || Page subheader/anchor name | | | <code>tool</code> || MDN developer tool |
| |} | | |} |
|
| |
|
| ;<big>Copy-paste templates</big> | | ;<big>Copy-paste template</big> |
| {| class="wikitable"
| | * <code><nowiki>{{mdnbox|lang= |zone= |wpla= |tool= }}</nowiki></code> |
| |-
| |
| ! Size !! Code
| |
| |-
| |
| | Basic || <code><nowiki>{{mdnbox|lang= |''1'' }}</nowiki></code>
| |
| |-
| |
| | Common || <code><nowiki>{{mdnbox|lang= |l1= |''1'' }}</nowiki></code>
| |
| |-
| |
| | Full || <code><nowiki>{{mdnbox|lang= |d=no |l1= |l2= |l3= |l4= |l5= |''1'' }}</nowiki></code>
| |
| |}
| |
| | |
| ===Custom link text===
| |
| ;<big>1</big>
| |
| Custom text string that will show as link text. The parameter is unnamed, so no parameter name needs to be entered.
| |
| | |
| 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:
| |
| * <code><nowiki>{{mdnbox|</nowiki>''text''<nowiki>}}</nowiki></code>
| |
|
| |
|
| ===Language=== | | ===Language=== |
| | ''Conditional'' |
| ;<big>lang</big> | | ;<big>lang</big> |
| 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]. | | 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]. |
| | |
| | ;Limitation |
| | * Cannot be used on its own, it will only have an effect if used together with one or more of the other three parameters. |
|
| |
|
| ;Usage: | | ;Usage: |
| * <code><nowiki>{{mdnbox|</nowiki>lang=''locale code''<nowiki>}}</nowiki></code> | | * <code><nowiki>{{mdnbox|</nowiki>lang=''locale code''<nowiki>}}</nowiki></code> |
|
| |
|
| ===Exclude the /docs page level=== | | ===MDN zone=== |
| ;<big>d</big> | | ;<big>zone</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 " " (empty), will be ignored (i.e. the <tt>/docs</tt> level will still be included).
| | 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. |
| | |
| 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>{{mdnbox|</nowiki>zone=''zone code''<nowiki>}}</nowiki></code> |
|
| |
|
| ===Page address=== | | ====Zone 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 !! MDN zone !! 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'').
| | | add || Add-ons || |
| | | |- |
| 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.
| | | app || Apps || |
| | |- |
| | | cal || Calendar/Lightning || |
| | |- |
| | | ff || Firefox || |
| | |- |
| | | ffa || Firefox for Android || |
| | |- |
| | | fos || Firefox OS || |
| | |- |
| | | fxa || Firefox Accounts || |
| | |- |
| | | mp || Marketplace || |
| | |- |
| | | per || Persona || |
| | |- |
| | | tb || Thunderbird || |
| | |- |
| | | moz || Mozilla || for all other Mozilla projects |
| | |} |
|
| |
|
| ;Limitation: | | ===Web Platform=== |
| * 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).
| | ;<big>wpla</big> |
| | MDN have documentation for all of the web platform 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. |
|
| |
|
| ;Usage: | | ;Usage: |
| * <code><nowiki>{{mdnbox|</nowiki>l1=''custom address string''<nowiki>}}</nowiki></code> | | * <code><nowiki>{{mdnbox|</nowiki>wpla=''platform code''<nowiki>}}</nowiki></code> |
|
| |
|
| ====Defined page levels==== | | ====Platform codes==== |
| ;<big>l1 + l2–l5</big>
| | {| class="wikitable" |
| 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).
| | |- |
| | ! Value !! Web platform !! Comment |
| | |- |
| | | api || APIs and DOM || |
| | |- |
| | | css || CSS || |
| | |- |
| | | css3 || CSS3 || |
| | |- |
| | | graph || Graphics || |
| | |- |
| | | html || HTML || |
| | |- |
| | | html5 || HTML5 || |
| | |- |
| | | js || JavaScript || |
| | |- |
| | | mml || MathML || |
| | |- |
| | | all || ''Web technology for developers'' || for all other web platforms |
| | |} |
|
| |
|
| 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.
| | ===Developer Tools=== |
| | | ;<big>tool</big> |
| ;Limitations: | | 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. |
| * 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: | | ;Usage: |
| * <code><nowiki>{{mdnbox|</nowiki>l1=''level 1''|l2=''level 2''|l3=''level 3''|l4=''level 4''|l5=''level 5''<nowiki>}}</nowiki></code> | | * <code><nowiki>{{</nowiki>mdnbox|tool=''tool code''<nowiki>}}</nowiki></code> |
|
| |
|
| ===Page anchor/subheader=== | | ====Tool codes==== |
| ;<big>sh</big>
| | {| class="wikitable" |
| 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.
| | |- |
| | | ! Value !! Developer tool !! Comment |
| 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>.
| | |- |
| | | | appm || App Manager || |
| ;Usage:
| | |- |
| * <code><nowiki>{{</nowiki>mdnbox|sh=''anchor/subheader title''<nowiki>}}</nowiki></code>
| | | jsdeb || JavaScript Debugger || |
| | |- |
| | | pagin || Page Inspector || |
| | |- |
| | | wcon || Web Console || |
| | |- |
| | | all || ''Firefox Developer Tools'' || for all other developer tools |
| | |} |
|
| |
|
| ==Examples== | | ==Examples== |
| Line 106: |
Line 128: |
| ;<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|lang=de}} |
| <big>d</big> | | ;<big>lang</big> (only) |
| {{mdnbox|The MDN project|l1=MDN}} | | <code><nowiki>{{mdnbox|lang=de}}</nowiki></code> gives |
| :1. No param
| | <br><br><br><br> |
| :<code><nowiki>{{mdnbox|The MDN project|l1=MDN}}</nowiki></code> gives
| | {{mdnbox|lang=de}} |
| <br><br><br>
| | ;<big>lang</big> (with another parameter) |
| {{mdnbox|The MDN project|d=|l1=MDN}}
| | <code><nowiki>{{mdnbox|lang=de|zone=ff}}</nowiki></code> gives |
| :2. Empty
| | <br><br><br><br> |
| :<code><nowiki>{{mdnbox|The MDN project|d=|l1=MDN}}</nowiki></code> gives
| | {{mdnbox|zone=ff|wpla=html5|tool=jsdeb}} |
| <br><br><br> | | ;<big>Combo</big> |
| {{mdnbox|Add-ons|d=no|l1=Add-ons}}
| | <code><nowiki>{{mdnbox|zone=ff|wpla=html5|tool=jsdeb}}</nowiki></code> gives |
| :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== |