mirror of
https://github.com/inventree/inventree-docs.git
synced 2025-06-18 21:25:29 +00:00
Simpler gallery
- use splide.js - iterate though a directory automatically
This commit is contained in:
__pycache__
_includes
app_carousel.htmlcarousel.htmlcarousel_end.htmlcarousel_start.htmlindex_carousel.htmlsplide_image.html
docs
app
assets
images
28
main.py
Normal file
28
main.py
Normal file
@ -0,0 +1,28 @@
|
||||
import os
|
||||
from posixpath import dirname
|
||||
|
||||
def define_env(env):
|
||||
|
||||
@env.macro
|
||||
def listimages(subdir):
|
||||
"""
|
||||
Return a listing of all asset files in the provided subdir
|
||||
"""
|
||||
|
||||
here = os.path.dirname(__file__)
|
||||
|
||||
directory = os.path.join(here, 'docs', 'assets', 'images', subdir)
|
||||
|
||||
assets = []
|
||||
|
||||
allowed = [
|
||||
'.png',
|
||||
'.jpg',
|
||||
]
|
||||
|
||||
for asset in os.listdir(directory):
|
||||
|
||||
if any([asset.endswith(x) for x in allowed]):
|
||||
assets.append(os.path.join(subdir, asset))
|
||||
|
||||
return assets
|
Reference in New Issue
Block a user