Jump to content

Module:Path/doc: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
No edit summary
mNo edit summary
Line 4: Line 4:


== Functions ==
== Functions ==
In all functions the {{para|1}} argument can be indifferently a relative (i.e. beginning with <code>./</code> or <code>../</code>) or an absolute path.
In all functions the {{para|1}} argument can indifferently a relative (i.e. beginning with <code>./</code> or <code>../</code>) or an absolute path.


=== <code>abs</code> ===
=== <code>abs</code> ===
This function converts the {{para|1}} argument into an absolute path.
This function the {{para|1}} argument an absolute path.


==== Examples ====
==== Examples ====
Line 20: Line 20:


=== <code>rel</code> ===
=== <code>rel</code> ===
This function converts the {{para|1}} argument into a relative path.
This function the {{para|1}} argument a relative path.


==== Examples ====
==== Examples ====
Line 36: Line 36:


=== <code>sub</code> ===
=== <code>sub</code> ===
This function converts the {{para|1}} argument into a partial path with only the subpages shown.
This function the {{para|1}} argument a partial path with only the subpages shown.


==== Examples ====
==== Examples ====

Revision as of 00:54, 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 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 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

sub

This function parses the |1= argument and returns 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