From 575557a057af16536ba7ca807bbf36bcd72ed99d Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 14 Feb 2022 22:09:35 +1000 Subject: [PATCH] working module finallyyyyy --- src/kitaab-public/TODO | 6 ++++++ src/kitaab-public/__init__.py | 0 src/kitaab-public/build/__init__.py | 0 src/kitaab-public/build/build.py | 3 ++- src/kitaab-public/grab/__init__.py | 0 src/kitaab-public/grab/makePublic.py | 10 +++++++--- src/kitaab-public/main.py | 24 ++++++++++++++++++++++++ src/kitaab-public/shared/__init__.py | 0 src/kitaab-public/shared/config.py | 1 + 9 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 src/kitaab-public/__init__.py create mode 100644 src/kitaab-public/build/__init__.py create mode 100644 src/kitaab-public/grab/__init__.py create mode 100644 src/kitaab-public/main.py create mode 100644 src/kitaab-public/shared/__init__.py diff --git a/src/kitaab-public/TODO b/src/kitaab-public/TODO index ee97eb7..25fced8 100644 --- a/src/kitaab-public/TODO +++ b/src/kitaab-public/TODO @@ -1,2 +1,8 @@ Import current blog entries create :art: for art entries +sealight.wiki page not being copied?? +404 page +link matrix-to:// on home.wiki somehow + + +Read Kitaab Website.wiki for more info diff --git a/src/kitaab-public/__init__.py b/src/kitaab-public/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/kitaab-public/build/__init__.py b/src/kitaab-public/build/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/kitaab-public/build/build.py b/src/kitaab-public/build/build.py index 0420ccb..549d8e6 100644 --- a/src/kitaab-public/build/build.py +++ b/src/kitaab-public/build/build.py @@ -576,4 +576,5 @@ def generate_website(): # Triggers the website build -generate_website() +if __name__ == '__main__': + generate_website() diff --git a/src/kitaab-public/grab/__init__.py b/src/kitaab-public/grab/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/kitaab-public/grab/makePublic.py b/src/kitaab-public/grab/makePublic.py index aec7fe8..571d986 100644 --- a/src/kitaab-public/grab/makePublic.py +++ b/src/kitaab-public/grab/makePublic.py @@ -7,12 +7,12 @@ from os import listdir, mkdir, path, remove import shutil import random import json -import convert -from icecream import ic +from . import convert +import os import sys sys.path.append("../") from shared.censor import privateList -from shared import TagHelper +from shared import TagHelper, config ## TODO: generalize based on headings(?) in index.wiki @@ -118,12 +118,16 @@ def convertFiles(outputBasePath='../raw/'): except RuntimeError as e: print(f"Could not convert file {outputBasePath + filename} because {e}") +def deleteOldRaw(): + if os.path.exists(config.raw_folder): + shutil.rmtree(config.raw_folder) if __name__=='__main__': #network = loadNetwork() #network = censorNetwork(network) + deleteOldRaw() AllFiles = TagHelper.getAllFiles() FilteredFiles = filterFiles(AllFiles) copyFiles(FilteredFiles) diff --git a/src/kitaab-public/main.py b/src/kitaab-public/main.py new file mode 100644 index 0000000..6fd0a4d --- /dev/null +++ b/src/kitaab-public/main.py @@ -0,0 +1,24 @@ +import click +from grab import makePublic +from shared import TagHelper + +@click.command() +def grab(): + AllFiles = TagHelper.getAllFiles() + FilteredFiles = makePublic.filterFiles(AllFiles) + makePublic.copyFiles(FilteredFiles) + print("Censoring files...") + makePublic.censorFiles() + +@click.command() +def build(): + build.generate_website() + +@click.command() +def main(): + grab() + build() + + +if __name__ == '__main__': + main() diff --git a/src/kitaab-public/shared/__init__.py b/src/kitaab-public/shared/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/kitaab-public/shared/config.py b/src/kitaab-public/shared/config.py index 2ef5493..b4c7006 100644 --- a/src/kitaab-public/shared/config.py +++ b/src/kitaab-public/shared/config.py @@ -6,6 +6,7 @@ files_folder = '' #TODO build_folder = "output/" assets_folder = "asset/" medias_folder = "media/" +raw_folder = "raw/" template_main = "partial/main.html" template_nav = "partial/nav.html" template_index = "partial/index_table.html"