How it works...

Steps 2 and 3 in the How do it… section prepare the template and the data to be displayed. In Step 4, extra information is produced—the number of movies, which is derivative from the movies element. The movies element is then transformed into a valid Markdown element from a Python list. Note the new lines and the initial *, which will be rendered as a bullet point:

>>> '
'.join('* {}'.format(movie) for movie in context['pmovies'])
'* Casablanca * The Sound of Music * Vertigo'

In Step 5, the template is generated in Markdown format. The format is very readable in this raw form, which is the strong point of Markdown:

Movies Report
=======

Date: 2018-06-29 20:47:18.930655

Movies seen in the last 30 days: 3

* Casablanca
* The Sound of Music
* Vertigo

Total minutes: 404

Then, using mistune, the report is transformed into HTML and stored in a file in Step 6.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.218.65.76