Edited variable names in the rendering templates section of the quickstart guide.

This commit is contained in:
Jake Tanis 2024-05-21 23:08:57 +00:00 committed by David Lord
parent a2f495b9ff
commit 767ad19b10
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8

View file

@ -375,7 +375,7 @@ Here's a simple example of how to render a template::
@app.route('/hello/') @app.route('/hello/')
@app.route('/hello/<name>') @app.route('/hello/<name>')
def hello(name=None): def hello(name=None):
return render_template('hello.html', name=name) return render_template('hello.html', person=name)
Flask will look for templates in the :file:`templates` folder. So if your Flask will look for templates in the :file:`templates` folder. So if your
application is a module, this folder is next to that module, if it's a application is a module, this folder is next to that module, if it's a
@ -404,8 +404,8 @@ Here is an example template:
<!doctype html> <!doctype html>
<title>Hello from Flask</title> <title>Hello from Flask</title>
{% if name %} {% if person %}
<h1>Hello {{ name }}!</h1> <h1>Hello {{ person }}!</h1>
{% else %} {% else %}
<h1>Hello, World!</h1> <h1>Hello, World!</h1>
{% endif %} {% endif %}
@ -419,7 +419,7 @@ know how that works, see :doc:`patterns/templateinheritance`. Basically
template inheritance makes it possible to keep certain elements on each template inheritance makes it possible to keep certain elements on each
page (like header, navigation and footer). page (like header, navigation and footer).
Automatic escaping is enabled, so if ``name`` contains HTML it will be escaped Automatic escaping is enabled, so if ``person`` contains HTML it will be escaped
automatically. If you can trust a variable and you know that it will be automatically. If you can trust a variable and you know that it will be
safe HTML (for example because it came from a module that converts wiki safe HTML (for example because it came from a module that converts wiki
markup to HTML) you can mark it as safe by using the markup to HTML) you can mark it as safe by using the