Welcome | Get started | Dive into Lino | Contribute | Reference
cms1
-- a content management system¶
A demo project showing a Lino CMS.
It includes a page with usage examples of the [upload]
and
[gallery]
commands. To see it, say go cms1
followed by pm
runserver
and then point your browser to http://127.0.0.1:8000/p/9
>>> from lino import startup
>>> startup('lino_book.projects.cms1.settings')
>>> from lino.api.doctest import *
>>> mp = settings.SITE.plugins.memo.parser
>>> rt.models.uploads.Upload.objects.get(pk=1)
Upload #1 ('Murder on the orient express cover')
>>> print(mp.parse("[upload 1] Some text."))
...
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img
src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px;
height:10em" title="Murder on the orient express cover"/></a> Some text.
>>> print(mp.parse("[upload 1 My caption] Some text."))
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px; height:10em" title="My caption"/></a> Some text.
>>> print(mp.parse("[upload 1 thumb|My caption] Some text."))
...
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img
src="/media/uploads/2022/09/MurderontheOrientExpress.jpg"
style="padding:4px; float:right; height:10em" title="My caption"/></a> Some text.
>>> print(mp.parse("[upload 1 thumb|right|My caption] Some text."))
...
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img
src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px;
float:right; height:10em" title="My caption"/></a> Some text.
>>> print(mp.parse("[upload 1 right|thumb|My caption] Some text."))
...
[ERROR Invalid format name 'right' (allowed names are ('thumb', 'tiny', 'wide',
'solo', 'duo', 'trio')). in '[upload 1 right|thumb|My caption]' at position
0-33] Some text.
>>> print(mp.parse("[upload 1 thumb|right|] Some text."))
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px; float:right; height:10em" title="Murder on the orient express cover"/></a> Some text.
>>> print(mp.parse("[upload 1 wide|A wide image] Some text."))
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px; width:100%" title="A wide image"/></a> Some text.
Spaces around the pipe character don't count:
>>> print(mp.parse("[upload 1 wide | A wide image] Some text."))
<a href="/admin/#/api/uploads/Uploads/1" target="_blank"/><img src="/media/uploads/2022/09/MurderontheOrientExpress.jpg" style="padding:4px; width:100%" title="A wide image"/></a> Some text.
The syntax is given by the
rstgen.sphinxconf.sigal_image.parse_image_spec()
function.