38 lines
965 B
Python
38 lines
965 B
Python
'''
|
|
Created on Oct 27, 2021
|
|
|
|
@author: terry
|
|
'''
|
|
|
|
import os
|
|
import yaml
|
|
import lunagen.addon
|
|
|
|
class Products(lunagen.addon.LunaGenAddOn):
|
|
"""
|
|
Products with Banners.
|
|
"""
|
|
name = 'products'
|
|
desc = """\
|
|
Display a set of product banners for merch store.
|
|
"""
|
|
file = __file__
|
|
|
|
@staticmethod
|
|
def load(site):
|
|
if site.verbose: print("Loading store products data.")
|
|
try:
|
|
with open(os.path.join(site.datadir, 'products.yaml')) as prod_file:
|
|
products = yaml.safe_load(prod_file)
|
|
# stylesheets = site.sitedata['stylesheets']
|
|
site.sitedata.update(products)
|
|
site.sitedata['stylesheets'] = site._collect_stylesheets(products)
|
|
except FileNotFoundError:
|
|
print("No products.yaml file, so products list is empty.")
|
|
site.sitedata['products'] = []
|
|
|
|
|
|
|
|
|
|
|
|
|