Module Weberizer.Path
val base : t
val from_base : t -> string
The (normalized) path to the filename (the filename being excluded) relative to the base directory. Returns
""
if we are in the base directory.
val from_base_split : t -> string list
The path to the filename (including it) relative to the base directory splitted into its components (see
Neturl
for the precise format).
val filename : t -> string
The filename the path points to. The path designates a directory if and only if
filename
returns""
.
val to_base : t -> string
The path from the directory of the filename to the base directory. One can see it as the "inverse" of
from_base
.
val in_base : t -> bool
in_base p
returnstrue
ifp
is the base directory or a file in the base directory.
val to_base_split : t -> string list
The path from the directory of the filename to the base directory. One can see it as the "inverse" of
from_base_split
.
val full : t -> string
Returns a path that can be used to open the file (or query the directory).
val language : t -> string
language p
returns the language of the filename based on the convention that it has the form "name.lang.ext".
val description : t -> string
description p
returns the descriptive name for the file pointed byp
.
val concat_file : t -> string -> t
navigation p
returns the navigation information for the pathp
. It consists of a list of pairs(name, path)
wherename
is a descriptive name of that directory of the path andpath
is the relative link to go from the location pointed byp
to the directory. Iffilename p
is of the form index.html or index.<lang>.html, then only its directory is included in the navigation information.Descriptive names are based on the name of the directory or, if an index.<lang>.html file is present it is taken as its title (if any). <lang> is determined according to the file pointed by
p
(if of the form name.<lang>.html).
val translations : ?rel_dir:(string -> string -> string) -> langs:string list -> t -> (string * string) list
translations langs p
returns a list of couples(lang, url)
for all translations of the file pointed by the pathp
.langs
is the list of languages to examine, the first being the default one (files with no explicit language).- parameter rel_dir
is a function so that
rel_dir lang l
gives the relative path from the base directory of the current languagelang
of the filep
to the base directory of the translation in the languagel
. Default:fun _ l -> "../" ^ l
.