API Docs¶
Jinja utilities for Invenio.
-
class
invenio_formatter.ext.
InvenioFormatter
(app=None)[source]¶ Invenio-Formatter extension.
Extension initialization.
Parameters: app – The Flask application. (Default: None
)
Context preprocessors¶
Badges context processor.
-
invenio_formatter.context_processors.badges.
badges_processor
()[source]¶ Context processor for badges.
-
invenio_formatter.context_processors.badges.
generate_badge_png
(title, value, color='#007ec6')[source]¶ Generate the badge in PNG format.
Filters¶
Datetime Jinja filters.
-
invenio_formatter.filters.datetime.
from_isodate
(value, strict=False)[source]¶ Convert an ISO formatted date into a Date object.
Parameters: - value – The ISO formatted date.
- strict – If value is
None
, then if strict isTrue
it returns the Date object of today, otherwise it returnsNone
. (Default:False
)
Returns: The Date object or
None
.
-
invenio_formatter.filters.datetime.
from_isodatetime
(value, strict=False)[source]¶ Convert an ISO formatted datetime into a Date object.
Parameters: - value – The ISO formatted datetime.
- strict – If value is
None
, then if strict isTrue
it returns the Date object of today, otherwise it returnsNone
. (Default:False
)
Returns: The Date object or
None
.