Bước tới nội dung

Mô đun:Path/tài liệu

Bách khoa toàn thư mở Wikipedia

This module offers utilities to convert paths into different formats.

Functions Mô đun:Path/tài liệu

 Ghi chú: 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}}
    Mô đun:Path/tài liệu/example
  • {{#invoke:path|abs|.}}
    Mô đun:Path/tài liệu
  • {{#invoke:path|abs|Wikipedia:Lua}}
    Wikipedia:Lua
  • {{#invoke:path|abs}}
    Mô đun:Path/tài liệu

rel

The rel function parses the |1= argument and returns it as a relative path.

Examples

  • {{#invoke:path|rel|Mô đun:Path/example}}
    ../example
  • {{#invoke:path|rel|Mô đun:Path}}
    ..
  • {{#invoke:path|rel|Wikipedia:Lua}}
    Wikipedia:Lua
  • {{#invoke:path|rel}}
    .
  • [[Mô đun:Path/example|{{#invoke:path|rel|Mô đun:Path/example}}]]
    ../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|Mô đun:Path/example}}
    example
  • {{#invoke:path|sub|Mô đun:Path}}
  • {{#invoke:path|sub|Wikipedia:Lua}}
    Wikipedia:Lua
  • {{#invoke:path|sub}}
  • [[Mô đun:Path/example|{{#invoke:path|sub|Mô đun:Path/example}}]]
    example

See also Mô đun:Path/tài liệu