Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python x Html5
#4
(Sep-30-2019, 07:07 PM)JohnnyCoffee Wrote: Do you know the way of stones to develop an html5 interpreter?
HTML is text markup language,there is no interpreter or compiler required in HTML.
Markup language is used to describe the visual appearance of a document to be displayed.

Browsers who deal with HTML do contain something similar to a interpreter(called parser).
Parser will identify various tags and display them accordingly - it depends on the way tags are rendered in browser.
One of the component in web browser is called rendering engine that performs this task.

Jinja2 is a template engine that generate HTML.
This mean that we can have Python code like eg a list and can make a loop in HTML that will render vaild HTML.
Server:
from flask import Flask, render_template 

app = Flask(__name__)
@app.route('/')
def index():
    list_example = ['Python', 'HTML', 'CSS']
    return render_template('index.html', list_example=list_example)
 
if __name__ == '__main__':
    app.run(debug=True)
Client in Browser:
<!DOCTYPE html>
<html>
<head>
  <title>Conditions</title>
</head>
<body>
<ul>
  {% for name in list_example %}
    <li>{{ name }}</li>
  {% endfor %}
</ul> 
</body>
</html>
Reply


Messages In This Thread
Python x Html5 - by JohnnyCoffee - Sep-29-2019, 01:44 PM
RE: Python x Html5 - by snippsat - Sep-29-2019, 02:46 PM
RE: Python x Html5 - by JohnnyCoffee - Sep-30-2019, 07:07 PM
RE: Python x Html5 - by snippsat - Sep-30-2019, 08:39 PM
RE: Python x Html5 - by JohnnyCoffee - Oct-02-2019, 11:47 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  BeautifulSoup : how to have a html5 attribut searched for in a regular expression ? arbiel 2 2,639 May-09-2020, 03:05 PM
Last Post: arbiel

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020