pandoc.path
directory
function pandoc.path.directory(filepath: string)
-> string
Gets the directory name, i.e., removes the last directory separator and everything after from the given path.
filename
function pandoc.path.filename(filepath: string)
-> string
Get the file name.
is_absolute
function pandoc.path.is_absolute(filepath: string)
-> boolean
Checks whether a path is absolute, i.e. not fixed to a root.
is_relative
function pandoc.path.is_relative(filepath: string)
-> boolean
Checks whether a path is relative or fixed to a root.
join
function pandoc.path.join(filepaths: table)
-> string
Join path elements back together by the directory separator.
make_relative
function pandoc.path.make_relative(path: string, root: string, unsafe?: boolean)
-> string
Contract a filename, based on a relative path. Note that the resulting path will usually not introduce .. paths, as the presence of symlinks means ../b may not reach a/b if it starts from a/c. For a worked example see this blog post.
normalize
function pandoc.path.normalize(filepath: string)
-> string
Normalizes a path.
//makes sense only as part of a (Windows) network drive; elsewhere, multiple slashes are reduced to a singlepath.separator(platform dependent)./becomespath.separator(platform dependent)./-> ’’- an empty path becomes
.
search_path_separator
string
The character that is used to separate the entries in the PATH environment variable.
separator
string
The character that separates directories.
split
function pandoc.path.split(filepath: string)
-> table
Splits a path by the directory separator.
split_extension
function pandoc.path.split_extension(filepath: string)
-> string
2. string
Splits the last extension from a file path and returns the parts. The extension, if present, includes the leading separator; if the path has no extension, then the empty string is returned as the extension.
Returns:
- filepath without extension (string)
- extension or empty string (string)
split_search_path
function pandoc.path.split_search_path(search_path: string)
-> table
Takes a string and splits it on the search_path_separator character. Blank items are ignored on Windows, and converted to . on Posix. On Windows path elements are stripped of quotes.