Module:Path/doc: Difference between revisions
From Kenshi Wiki
More actions
Created page with "{{Module rating|beta}} <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> This module offers utilities to convert paths into different formats. == Functions == {{A note}} In all functions the {{para|1}} argument can indifferently be a relative (i.e. beginning with <code>./</code> or <code>../</code> or <code>/</code>) or an absolute path. {{vpad}} === <code>abs</code> === The <code>abs</code> function parses the {{para|1}} ar..." |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
{{ | {{doc sub}} | ||
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | ||
This module offers utilities to convert paths into different formats. | This module offers utilities to convert paths into different formats. | ||
| Line 66: | Line 66: | ||
<includeonly>{{Sandbox other|| | <includeonly>{{Sandbox other|| | ||
<!-- Categories below this line; interwikis at Wikidata --> | <!-- Categories below this line; interwikis at Wikidata --> | ||
[[Category:Modules]] | |||
[[Category:Wikipedia utility modules|{{PAGENAME}}]] | [[Category:Wikipedia utility modules|{{PAGENAME}}]] | ||
}}</includeonly> | }}</includeonly> | ||
<noinclude> | <noinclude> | ||
[[Category:Module | [[Category:Module documents]] | ||
</noinclude> | </noinclude> | ||
Latest revision as of 01:31, 10 March 2025
| This is a documentation subpage for Module:Path. It may contain usage information, categories and other content that is not part of the original module page. |
This module offers utilities to convert paths into different formats.
Functions
Note: In all functions the
|1= argument can indifferently be a relative (i.e. beginning with ./ or ../ or /) or an absolute path.
abs
The abs 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
The rel 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
The sub 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