{ "info": { "author": "Amin Mesbah", "author_email": "dev@aminmesbah.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Plugins", "Framework :: Lektor", "License :: OSI Approved :: MIT License" ], "description": "# Lektor WebDAV Plugin\n\n[](https://pypi.python.org/pypi/lektor-webdav/)\n\nGet a list of files hosted on a WebDAV server for use in your\n[Lektor](https://www.getlektor.com/) templates.\n\n\n## Installation\n\n```\nmkdir packages\ncd packages\ngit clone https://github.com/mesbahamin/lektor-webdav\n```\n\nI'll try to set this up soon so it can be installed properly with `lektor\nplugins add`.\n\n\n## Configuration\n\nFor each WebDAV server you want to use, add a section in `configs/webdav.ini`:\n\n```\n[photos]\nurl = https://my.webdav.domain/photography/\nusername = my_user@example.com\npasscmd = pass my_webdav_server\n```\n\nReplace 'photos' with whatever label you want for this particular webdav server.\n\n\n### Options\n\n|Option | Description\n|---------|-------------------------------------------------------------------------\n|url | URL of your WebDAV folder\n|username | Username with which to authenticate with the WebDAV server\n|passcmd | A command that will return your WebDAV password as a UTF-8 string\n\n\n## Use In Templates\n\nThis plugin exposes the following for use in Jinja2 templates:\n\n\n### Functions\n\n- `webdav_ls_files`\n - Return a list of all files (not folders) in a WebDAV directory. The files\n are returned in the form of a list of `WebdavFile` instances.\n - Parameters:\n - `webdav_id`. This is the name you chose as the section title in\n `webdav.ini` ('photos' in the above snippet).\n - `path` (optional). If you want to look in a subfolder of your WebDAV\n folder, pass its name in here.\n- `webdav_ls_file_names`\n - Same as `webdav_ls_files`, but only return the names.\n- `webdav_ls_file_paths`\n - Same as `webdav_ls_files`, but only return the paths.\n\n\n### Tuples\n\n- `WebdavFile`: A named tuple that holds information about a file.\n - `path`\n - The full path of the file with the WebDAV server's URL as its root.\n - Example: `'/photographs/my_photograph_of_a_wall.jpg'`\n - `name`\n - Just the name of the file itself.\n - Example: `'my_photograph_of_a_wall.jpg'`\n - `content_type`\n - Filetype metadata supplied by the WebDAV server.\n - Example: `'images/jpeg'`\n\n\n### Filters\n\n- `webdav_zip`\n - Jinja2 doesn't have a `zip` filter, so I included one here since I needed\n to pair up my photos with generated thumbnails (see example below).\n - Usage: `{{ zipped_iterator_ab = iterator_a|zip(iterator_b) }}`\n\n\n## Example\n\nI made this because I wanted to make a photo gallery on my blog. I already had\na webDAV server through my Fastmail account, and I wanted to host the images\nthere.\n\nMy full site configuration can be found\n[here](https://github.com/mesbahamin/amin.space), but here are the main bits:\n\n\n### Config\n\nMy `webdav.ini` looks like this:\n\n```\n[photography]\nurl = https://myfiles.fastmail.com/photography/\nusername = me@mydomain.com\npasscmd = pass sync/fastmail_webdav\n```\n\nI using [pass](https://www.passwordstore.org/) to manage my passwords, so\nI invoke it in `passcmd`.\n\n\n### Template\n\nThe template for my photography page looks like this:\n\n```\n{% extends \"layout.html\" %}\n{% block body %}\n