From c295de661c8e9462f63bbf716c1d5db23b2e93e5 Mon Sep 17 00:00:00 2001 From: Alex Willmer Date: Thu, 22 Apr 2021 21:40:58 +0100 Subject: [PATCH] Correct splitext() description, and example (#74377) `splitext()` returns a 2-tuple of strings, and the last element of the return value includes the `.` --- docs/docsite/rst/user_guide/playbooks_filters.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docsite/rst/user_guide/playbooks_filters.rst b/docs/docsite/rst/user_guide/playbooks_filters.rst index 39672232bb4..512c39cded5 100644 --- a/docs/docsite/rst/user_guide/playbooks_filters.rst +++ b/docs/docsite/rst/user_guide/playbooks_filters.rst @@ -1622,12 +1622,12 @@ To get the root and extension of a path or file name (new in version 2.0):: # with path == 'nginx.conf' the return would be ('nginx', '.conf') {{ path | splitext }} -The ``splitext`` filter returns a string. The individual components can be accessed by using the ``first`` and ``last`` filters:: +The ``splitext`` filter always returns a pair of strings. The individual components can be accessed by using the ``first`` and ``last`` filters:: # with path == 'nginx.conf' the return would be 'nginx' {{ path | splitext | first }} - # with path == 'nginx.conf' the return would be 'conf' + # with path == 'nginx.conf' the return would be '.conf' {{ path | splitext | last }} To join one or more path components::