Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

jinja : Jinja printing

This document describes the lino.modlib.jinja plugin

This page contains code snippets (lines starting with >>>), which are being tested during our development workflow. The following snippet initializes the demo project used throughout this page.

>>> from lino import startup
>>> startup('lino_book.projects.min1.settings')
>>> from lino.api.doctest import *

Plugin settings

Two settings to used by the local.css file.

lino.modlib.jinja.tile_width

The width of each tile for tables in display mode “tiles”.

Default value is "20em".

lino.modlib.jinja.background_color

The background color of tiles for tables in display mode “tiles” and certain other elements. Default value is "Gainsboro".

The local.css file

This file contains CSS available in all front ends.

Build methods

This module adds a build method for lino.modlib.printing.

class lino.modlib.jinja.JinjaBuildMethod

Inherits from lino.modlib.printing.DjangoBuildMethod.

Model mixins

class lino.modlib.jinja.XMLMaker

Usage example in Lino and XML

xml_file_name

The name of the XML file to generate. This file will be overwritten without asking. The name formatted with one name self in the context.

xml_file_template

The name of a Jinja template to render for generating the XML content.

This must be either None or a Path object.

xml_validator_file

The name of a “validator” to use for validating the XML content.

This must be either None or a Path object.

Lino choose the validation method from the file’s suffix. It currently can handle suffixes “.xsd” and “.sch”.

get_xml_file()

Get the name of the XML file to be generated for this database row.

Returns an instance of lino.utils.media.MediaFile.

make_xml_file(ar)

Make the XML file for this database row.

django-admin commands

This plugin defines two django-admin commands.

showsettings

Print to stdout all the Django settings that are active on this Lino site.

Usage example:

>>> from atelier.sheller import Sheller
>>> shell = Sheller("lino_book/projects/min1")
>>> shell("python manage.py showsettings | grep EMAIL")
...
DEFAULT_FROM_EMAIL = webmaster@localhost
EMAIL_BACKEND = django.core.mail.backends.smtp.EmailBackend
EMAIL_HOST = mail.example.com
EMAIL_HOST_PASSWORD =
EMAIL_HOST_USER =
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = None
EMAIL_SUBJECT_PREFIX = [min1]
EMAIL_TIMEOUT = None
EMAIL_USE_LOCALTIME = False
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
SERVER_EMAIL = root@localhost
status

Write a diagnostic status report about this Lino site.

A functional replacement for the diag command.

>>> shell = Sheller("lino_book/projects/min1")
>>> shell("python manage.py status")
...
Plugins
=======

- lino : lino
- about : lino.modlib.about
- jinja : lino.modlib.jinja(needed by lino.modlib.extjs)
- extjs : lino.modlib.extjs(needs ['lino.modlib.jinja'])
- printing : lino.modlib.printing(needed by lino.modlib.system)
- system : lino.modlib.system(needs ['lino.modlib.printing'])
- users : lino.modlib.users(needs ['lino.modlib.system'])
- office : lino.modlib.office(needed by lino_xl.lib.countries)
- xl : lino_xl.lib.xl(needed by lino_xl.lib.countries)
- countries : lino_xl.lib.countries(needed by lino_xl.lib.contacts, needs ['lino.modlib.office', 'lino_xl.lib.xl'])
- contacts : lino_xl.lib.contacts(needs ['lino_xl.lib.countries', 'lino.modlib.system'])
- staticfiles : django.contrib.staticfiles
- sessions : django.contrib.sessions

Config directories
==================

- .../lino_xl/lib/contacts/config
- .../lino/modlib/users/config
- .../lino/modlib/printing/config
- .../lino/modlib/extjs/config
- .../lino/modlib/jinja/config
- .../lino/config

The output may be customized by overriding the jinja/status.jinja.rst template.

jinja/status.jinja.rst

The template file used by the status command.