Skip to content

Commit

Permalink
Merge pull request #1447 from doublethefish/fix/1446/fix_tp.file.fold…
Browse files Browse the repository at this point in the history
…er_docs

fix: updates docs to match _actual_ behaviour of tp.file.folder()

refs: #1446
  • Loading branch information
Zachatoo committed Sep 25, 2024
2 parents bfbb474 + 8d4f402 commit 0923fac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/documentation.toml
Original file line number Diff line number Diff line change
Expand Up @@ -318,18 +318,18 @@ example = """<% tp.file.find_tfile("MyFile").basename %>"""
[tp.file.functions.folder]
name = "folder"
description = "Retrieves the file's folder name."
definition = "tp.file.folder(relative: boolean = false)"
definition = "tp.file.folder(absolute: boolean = false)"

[[tp.file.functions.folder.args]]
name = "relative"
description = "If set to `true`, appends the vault relative path to the folder name. If `false`, only retrieves name of folder. Defaults to `false`."
name = "absolute"
description = "If set to `true`, returns the vault-absolute path of the folder. If `false`, only returns the basename of the folder (the last part). Defaults to `false`."

[[tp.file.functions.folder.examples]]
name = "File folder (Folder)"
example = "<% tp.file.folder() %>"

[[tp.file.functions.folder.examples]]
name = "File folder with relative path (Path/To/Folder)"
name = "File folder with vault-absolute path (Path/To/Folder)"
example = "<% tp.file.folder(true) %>"

[tp.file.functions.include]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ export class InternalModuleFile extends InternalModule {
};
}

generate_folder(): (relative?: boolean) => string {
return (relative = false) => {
generate_folder(): (absolute?: boolean) => string {
return (absolute = false) => {
const parent = this.config.target_file.parent;
let folder;

if (relative) {
if (absolute) {
folder = parent.path;
} else {
folder = parent.name;
Expand Down

0 comments on commit 0923fac

Please sign in to comment.