Template:Sandbox: Difference between revisions

From Alpine Linux
m (This is a test at potentially improving the pkg template)
m (Add documentation...)
 
(25 intermediate revisions by the same user not shown)
Line 1: Line 1:
<noinclude>This is the sandbox template that anyone can edit to figure out how templates work or to test a new template before deplying it...</noinclude>
<includeonly>{{#switch: {{{1}}} | short = 3.20 | v = v3.20 | 3.20.3 }}</includeonly>
<noinclude><!--                          ^^^^      ^^^^^  ^^^^^^
When updating this template, the latest version string must be changed three times, two lines above this comment
The first is the short version (major.minor)
The second is the short version prefixed with a lowercase v (vmajor.minor)
The final is the full version string (major.minor.patchlevel)--></noinclude>
<noinclude>{{Template}}
<noinclude>{{Template}}
An inline link to search for the given package in the Package Browser.
This template produces a string containing the latest version of Alpine Linux


=== Usage ===
=== Usage ===
<pre>{{Pkg|package}}</pre>
<pre>{{AlpineLatest|short|v}}</pre>


Special characters in the package name will automatically be url-encoded. "*" can be used as a wildcard.
{{define|short|The string produced will only contain the minor and major version}}
{{define|v|The string produced will only contain the minor and major version prefixed with a v}}
 
This template will only accept one parameter at a time, all parameters are optional.<br>
If no parameters are supplied, or the parameters which are supplied are invalid, the full version string (minor.major.patchlevel) will be produced.


=== Examples ===
=== Examples ===
<pre>{{Pkg|gtk+2.0}}</pre>
Display the full version string of the latest Alpine Linux stable:
<pre>{{AlpineLatest}}</pre>
will produce:
will produce:
{{Pkg|gtk+2.0}}
{{AlpineLatest}}


Display the short version string of the latest Alpine Linux stable:
<pre>{{AlpineLatest|short}}</pre>
will produce:
{{AlpineLatest|short}}


<pre>{{Pkg|gtk*}}</pre>
Display the short version string of the latest Alpine Linux stable, prefixed with v:
<pre>{{AlpineLatest|v}}</pre>
will produce:
will produce:
{{Pkg|gtk*}}
{{AlpineLatest|v}}
 
</noinclude>
 
<!--If you're updating the string containing the latest version of Alpine, go to the top!-->
</noinclude><includeonly><span class="plainlinks" style="font-family: monospace, Courier;font-size:10pt;">[https://pkgs.alpinelinux.org/packages?name={{urlencode:{{ #if: {{{name|}}} | {{{name}}} |{{{1}}}}}&branch={{ #if: {{{branch|}}} | {{{branch}}} | edge}}&repo={{{repo}}}&arch={{ #if: {{{arch|}}} | {{{arch}}} | x86_64}}&maintainer={{{maintainer}}} {{{1}}}}}]</span></includeonly>

Latest revision as of 17:44, 6 September 2024

Template Documentation for Sandbox

This page is a template and should only be used as part of other articles. For more information, read Help:Template.

Please do not experiment with this template; you could ruin all pages using this template. If you want to edit this template, copy the text to Template:Sandbox, edit and test it there, and copy it back when it works.

Feel free to voice your opinion regarding this template.

This template produces a string containing the latest version of Alpine Linux

Usage

{{AlpineLatest|short|v}}

short
The string produced will only contain the minor and major version

v
The string produced will only contain the minor and major version prefixed with a v

This template will only accept one parameter at a time, all parameters are optional.
If no parameters are supplied, or the parameters which are supplied are invalid, the full version string (minor.major.patchlevel) will be produced.

Examples

Display the full version string of the latest Alpine Linux stable:

{{AlpineLatest}}

will produce: 3.20.3

Display the short version string of the latest Alpine Linux stable:

{{AlpineLatest|short}}

will produce: 3.20.3

Display the short version string of the latest Alpine Linux stable, prefixed with v:

{{AlpineLatest|v}}

will produce: 3.20.3