staticoso/Source/Modules/Pug.py

25 lines
895 B
Python
Raw Permalink Normal View History

""" ================================= |
| This file is part of |
| staticoso |
| Just a simple Static Site Generator |
| |
| Licensed under the AGPLv3 license |
| Copyright (C) 2022, OctoSpacc |
| ================================= """
# TODO: Write a native Pug parser; There is one already available for Python but seems broken / out-of-date
import os
from Modules.Utils import *
2022-08-27 16:50:50 +02:00
def PugCompileList(OutputDir, Pages, LimitFiles):
# Pug-cli seems to shit itself with folder paths as input, so we pass ALL the files as arguments
Paths = ''
for File, Content, Titles, Meta in Pages:
2022-08-28 00:32:45 +02:00
if File.lower().endswith('.pug') and (LimitFiles == False or File in LimitFiles):
Path = f'{OutputDir}/{File}'
WriteFile(Path, Content)
Paths += f'"{Path}" '
2022-07-24 16:47:12 +02:00
if Paths:
os.system(f'pug -P {Paths} > /dev/null')