working module finallyyyyy

This commit is contained in:
Anish Lakhwara 2022-02-14 22:09:35 +10:00
parent e0c1e9d245
commit 575557a057
9 changed files with 40 additions and 4 deletions

View file

@ -1,2 +1,8 @@
Import current blog entries Import current blog entries
create :art: for art 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

View file

View file

View file

@ -576,4 +576,5 @@ def generate_website():
# Triggers the website build # Triggers the website build
if __name__ == '__main__':
generate_website() generate_website()

View file

View file

@ -7,12 +7,12 @@ from os import listdir, mkdir, path, remove
import shutil import shutil
import random import random
import json import json
import convert from . import convert
from icecream import ic import os
import sys import sys
sys.path.append("../") sys.path.append("../")
from shared.censor import privateList from shared.censor import privateList
from shared import TagHelper from shared import TagHelper, config
## TODO: generalize based on headings(?) in index.wiki ## TODO: generalize based on headings(?) in index.wiki
@ -118,12 +118,16 @@ def convertFiles(outputBasePath='../raw/'):
except RuntimeError as e: except RuntimeError as e:
print(f"Could not convert file {outputBasePath + filename} because {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__': if __name__=='__main__':
#network = loadNetwork() #network = loadNetwork()
#network = censorNetwork(network) #network = censorNetwork(network)
deleteOldRaw()
AllFiles = TagHelper.getAllFiles() AllFiles = TagHelper.getAllFiles()
FilteredFiles = filterFiles(AllFiles) FilteredFiles = filterFiles(AllFiles)
copyFiles(FilteredFiles) copyFiles(FilteredFiles)

24
src/kitaab-public/main.py Normal file
View file

@ -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()

View file

View file

@ -6,6 +6,7 @@ files_folder = '' #TODO
build_folder = "output/" build_folder = "output/"
assets_folder = "asset/" assets_folder = "asset/"
medias_folder = "media/" medias_folder = "media/"
raw_folder = "raw/"
template_main = "partial/main.html" template_main = "partial/main.html"
template_nav = "partial/nav.html" template_nav = "partial/nav.html"
template_index = "partial/index_table.html" template_index = "partial/index_table.html"