Module:Path/doc: Difference between revisions
Appearance
Content deleted Content added
mNo edit summary |
mNo edit summary |
||
Line 33: | Line 33: | ||
* <syntaxhighlight lang="wikitext" inline>[[Module:Path/example|{{#invoke:path|rel|Module:Path/example}}]]</syntaxhighlight> |
* <syntaxhighlight lang="wikitext" inline>[[Module:Path/example|{{#invoke:path|rel|Module:Path/example}}]]</syntaxhighlight> |
||
*: ↳ [[Module:Path/example|{{#invoke:path|rel|Module:Path/example}}]] |
*: ↳ [[Module:Path/example|{{#invoke:path|rel|Module:Path/example}}]] |
||
*:* See also {{tl| |
*:* See also {{tl|Relative link}} |
||
=== <code>sub</code> === |
=== <code>sub</code> === |
||
Line 49: | Line 49: | ||
* <syntaxhighlight lang="wikitext" inline>[[Module:Path/example|{{#invoke:path|sub|Module:Path/example}}]]</syntaxhighlight> |
* <syntaxhighlight lang="wikitext" inline>[[Module:Path/example|{{#invoke:path|sub|Module:Path/example}}]]</syntaxhighlight> |
||
*: ↳ [[Module:Path/example|{{#invoke:path|sub|Module:Path/example}}]] |
*: ↳ [[Module:Path/example|{{#invoke:path|sub|Module:Path/example}}]] |
||
*:* See also {{tl| |
*:* See also {{tl|Relative link implicit}} |
||
== See also == |
== See also == |
||
* {{Tl| |
* {{Tl|Relative link}} |
||
* {{Tl| |
* {{Tl|Relative link implicit}} |
||
* [[:Category:Wikipedia utility modules]] |
* [[:Category:Wikipedia utility modules]] |
||
Revision as of 01:46, 6 September 2024
This module offers utilities to convert paths into different formats.
Functions
In all functions the |1=
argument can indifferently be a relative (i.e. beginning with ./
or ../
) or an absolute path.
abs
This function parses the |1=
argument and returns it as an absolute path.
Examples
{{#invoke:path|abs|./example}}
- ↳ Module:Path/doc/example
{{#invoke:path|abs|.}}
- ↳ Module:Path/doc
{{#invoke:path|abs|Wikipedia:Lua}}
- ↳ Wikipedia:Lua
{{#invoke:path|abs}}
- ↳ Module:Path/doc
rel
This function parses the |1=
argument and returns it as a relative path.
Examples
{{#invoke:path|rel|Module:Path/example}}
- ↳ ../example
{{#invoke:path|rel|Module:Path}}
- ↳ ..
{{#invoke:path|rel|Wikipedia:Lua}}
- ↳ Wikipedia:Lua
{{#invoke:path|rel}}
- ↳ .
[[Module:Path/example|{{#invoke:path|rel|Module:Path/example}}]]
- ↳ ../example
- See also {{Relative link}}
- ↳ ../example
sub
This function parses the |1=
argument and returns it as a partial path with only the subpages shown.
Examples
{{#invoke:path|sub|Module:Path/example}}
- ↳ example
{{#invoke:path|sub|Module:Path}}
- ↳
{{#invoke:path|sub|Wikipedia:Lua}}
- ↳ Wikipedia:Lua
{{#invoke:path|sub}}
- ↳
[[Module:Path/example|{{#invoke:path|sub|Module:Path/example}}]]
- ↳ example
- See also {{Relative link implicit}}
- ↳ example