Module:Path/doc
Appearance
| 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 is being discussed in accordance with Wikipedia's deletion policy. Help reach a consensus at its entry. |
| This module is rated as beta. It is considered ready for widespread use, but as it is still relatively new, it should be applied with some caution to ensure results are as expected. |
This module offers utilities to convert paths into different formats.
Functions
[edit]
Note: In all functions the |1= argument can indifferently be a relative (i.e. beginning with ./ or ../ or /) or an absolute path.
abs
[edit]The abs function parses the |1= argument and returns it as an absolute path.
Examples
[edit]{{#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
[edit]The rel function parses the |1= argument and returns it as a relative path.
Examples
[edit]{{#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}}]]
sub
[edit]The sub function parses the |1= argument and returns it as a partial path with only the subpages shown.
Examples
[edit]{{#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