/')
def page(path):
page = pages.get_or_404(path)
template = page.meta.get('template', 'flatpage.html')
return render_template(template, page=page)
.. autoclass:: Page()
:members:
With the ``hello.html`` page defined earlier
.. code-block:: YAML
# hello.html
title: Hello
published: 2010-12-22
Hello, *World*!
Lorem ipsum dolor sit amet, …
::
>>> page = pages.get('hello')
>>> page.meta # PyYAML converts YYYY-MM-DD to a date object
{'title': u'Hello', 'published': datetime.date(2010, 12, 22)}
>>> page['title']
u'Hello'
>>> page.body
u'Hello, *World*!\n\nLorem ipsum dolor sit amet, \u2026'
>>> page.html
u'Hello, World!
\nLorem ipsum dolor sit amet, \u2026
'
.. automethod:: __getitem__
.. automethod:: __html__
.. autofunction:: pygmented_markdown
.. autofunction:: pygments_style_defs
Changelog
---------
.. release-notes::
v0.7.2
~~~~~~~~~~~~~
Release Date: 2020-04-19
Bug Fixes
^^^^^^^^^
- Fixed a bug arising when the user overrides the default markdown extensions, but does not use Pygments. Apologies to anyone who didn't want codehiliting!
(`#73 `_)
Documentation Changes
^^^^^^^^^^^^^^^^^^^^^
- Update documentation to use the latest version of the Flask template.
- Add towncrier config for auto-generating release notes
Other Notes
^^^^^^^^^^^
- This project currently supports Python versions 2.7, and 3.4+.
Some dependencies, particularly PyYAML, do not support Python 3.4 in the most recent versions. Thus, for security reasons,
we strongly advise using Python 2.7 if no newer version of Python 3 is available.
Support for Python 3.4 will be dropped in June 2020.
v0.7.1
~~~~~~~~~~~~~
* Small bump to dependency versions to resolve security alerts.
v0.7.0
~~~~~~~~~~~~~
* Update to Markdown 3.0 with new extension loading syntax.
* Added `FLATPAGES_EXTENSION_CONFIGS` for configuring extensions specified by import string.
* Add support for loading pages from Flask instance folder
* Add a case insensitive loading option
v0.6.1
~~~~~~~~~~~~~
* Update dependencies to `Flask>=1.0` (as Flask 0.12.1 has known vulnerabilities).
* Pin `Markdown<=3.0` as the Markdown extension API has changed.
v0.6
~~~~~~~~~~~
Release Date: 2015-02-09
* Python 3 support.
* Allow multiple file extensions for FlatPages.
* The renderer function now optionally takes a third argument, namely
the :class:`Page` instance.
* It is now possible to instantiate multiple instances of :class:`FlatPages`
with different configurations. This is done by specifying an additional
parameter ``name`` to the initializer and adding the same name in uppercase
to the respective Flask configuration settings.
v0.5
~~~~~~~~~~~
Release Date: 2013-04-02
* Change behavior of passing ``FLATPAGES_MARKDOWN_EXTENSIONS`` to renderer
function, now the :class:`FlatPages` instance is optionally passed as second
argument. This allows more robust renderer functions.
v0.4
~~~~~~~~~~~
Release Date: 2013-04-01
* Add ``FLATPAGES_MARKDOWN_EXTENSIONS`` config to setup list of Markdown
extensions to use with default HTML renderer.
* Fix a bug with non-ASCII filenames.
v0.3
~~~~~~~~~~~
Release Date: 2012-07-03
* Add :meth:`.FlatPages.init_app`
* Do not use namespace packages anymore: rename the package from
``flaskext.flatpages`` to ``flask_flatpages``
* Add configuration files for testing with tox and Travis.
v0.2
~~~~~~~~~~~
Release Date: 2011-06-02
Bugfix and cosmetic release. Tests are now installed alongside the code.
v0.1
~~~~~~~~~~~
Release Date: 2011-02-06.
First public release.