mirror of https://github.com/ansible/ansible.git
filter: fix documentation (#81113)
* Updated urldecode documentation * Misc typo fixes * Better formatting * Corrected some example Fixes: #81112 Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>pull/81299/head
parent
528e7859d0
commit
1e929ada6f
@ -1,48 +1,29 @@
|
|||||||
DOCUMENTATION:
|
DOCUMENTATION:
|
||||||
name: urlsplit
|
name: urldecode
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
short_description: get components from URL
|
short_description: Decode percent-encoded sequences
|
||||||
description:
|
description:
|
||||||
- Split a URL into its component parts.
|
- Replace %xx escapes with their single-character equivalent in the given string.
|
||||||
positional: _input, query
|
- Also replace plus signs with spaces, as required for unquoting HTML form values.
|
||||||
|
positional: _input
|
||||||
options:
|
options:
|
||||||
_input:
|
_input:
|
||||||
description: URL string to split.
|
description: URL encoded string to decode.
|
||||||
type: str
|
type: str
|
||||||
required: true
|
required: true
|
||||||
query:
|
|
||||||
description: Specify a single component to return.
|
|
||||||
type: str
|
|
||||||
choices: ["fragment", "hostname", "netloc", "password", "path", "port", "query", "scheme", "username"]
|
|
||||||
|
|
||||||
RETURN:
|
RETURN:
|
||||||
_value:
|
_value:
|
||||||
description:
|
description:
|
||||||
- A dictionary with components as keyword and their value.
|
- URL decoded value for the given string
|
||||||
- If O(query) is provided, a string or integer will be returned instead, depending on O(query).
|
|
||||||
type: any
|
type: any
|
||||||
|
|
||||||
EXAMPLES: |
|
EXAMPLES: |
|
||||||
|
|
||||||
{{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit }}
|
# Decode urlencoded string
|
||||||
# =>
|
{{ '%7e/abc+def' | urldecode }}
|
||||||
# {
|
# => "~/abc def"
|
||||||
# "fragment": "fragment",
|
|
||||||
# "hostname": "www.acme.com",
|
|
||||||
# "netloc": "user:password@www.acme.com:9000",
|
|
||||||
# "password": "password",
|
|
||||||
# "path": "/dir/index.html",
|
|
||||||
# "port": 9000,
|
|
||||||
# "query": "query=term",
|
|
||||||
# "scheme": "http",
|
|
||||||
# "username": "user"
|
|
||||||
# }
|
|
||||||
|
|
||||||
{{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('hostname') }}
|
|
||||||
# => 'www.acme.com'
|
|
||||||
|
|
||||||
{{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('query') }}
|
|
||||||
# => 'query=term'
|
|
||||||
|
|
||||||
{{ "http://user:password@www.acme.com:9000/dir/index.html?query=term#fragment" | urlsplit('path') }}
|
# Decode plus sign as well
|
||||||
# => '/dir/index.html'
|
{{ 'El+Ni%C3%B1o' | urldecode }}
|
||||||
|
# => "El Niño"
|
||||||
|
Loading…
Reference in New Issue