From: Joe Mooring Date: Sat, 9 Oct 2021 18:36:57 +0000 (-0700) Subject: docs: Create path.Clean documentation X-Git-Tag: v0.89.0~46 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=f8d132d731cf8e27c8c17931597fd975e8a7c3cc;p=brevno-suite%2Fhugo docs: Create path.Clean documentation Related to #9005 --- diff --git a/docs/content/en/functions/path.Clean.md b/docs/content/en/functions/path.Clean.md new file mode 100644 index 00000000..03ffbd83 --- /dev/null +++ b/docs/content/en/functions/path.Clean.md @@ -0,0 +1,26 @@ +--- +title: path.Clean +description: Replaces path separators with slashes (`/`) and removes extraneous separators. +date: 2021-10-08 +# publishdate: 2018-11-28 +# lastmod: 2018-11-28 +categories: [functions] +menu: + docs: + parent: "functions" +keywords: [path] +signature: ["path.Clean PATH"] +--- + +`path.Clean` replaces path separators with slashes (`/`) and removes extraneous separators, including trailing separators. + +``` +{{ path.Clean "foo//bar" }} → "foo/bar" +{{ path.Clean "/foo/bar/" }} → "/foo/bar" +``` + +On a Windows system, if `.File.Path` is `foo\bar.md`, then: + +``` +{{ path.Clean .File.Path }} → "foo/bar.md" +```