commit dc6c82356de31888512a293ba34b03ae320a7867 Author: grey-cat-1908 Date: Sat Sep 16 13:12:45 2023 +0300 test base without content diff --git a/build.py b/build.py new file mode 100644 index 0000000..d159d68 --- /dev/null +++ b/build.py @@ -0,0 +1,49 @@ +import os +import shutil + +import mistune + +render = mistune.create_markdown( + plugins=['math', 'strikethrough', 'footnotes', 'table', 'url', 'task_lists', 'abbr', 'mark', 'subscript', 'spoiler'] + ) + +try: + shutil.rmtree("build") +except: + pass + +os.mkdir("build") + + +for filename in os.listdir("static"): + if len(filename.split(".")) == 1: + shutil.copytree(f"{os.getcwd()}/static/{filename}", f"{os.getcwd()}/build/{filename}") + else: + shutil.copy(f"{os.getcwd()}/static/{filename}", f"{os.getcwd()}/build/{filename}") + + +template_file = open('template.html', "r") +template_text = template_file.read() +template_file.close() + + +def gen_file(directory): + file = open(directory, "r") + md_text = file.read() + file.close() + + return template_text.replace("{{%CONTENT%}}", render(md_text)) + + +for filename in os.listdir("content"): + if len(filename.split(".")) == 1: + content = gen_file(f"{os.getcwd()}/content/{filename}/index.md") + loc = f"{filename}/index.html" + os.makedirs(f'build/{filename}') + else: + content = gen_file(f"{os.getcwd()}/content/{filename}") + loc = filename.split(".")[0] + '.html' + + file = open(f"{os.getcwd()}/build/{loc}", "a") + file.write(content) + file.close() \ No newline at end of file diff --git a/content/hoba/index.md b/content/hoba/index.md new file mode 100644 index 0000000..936236e --- /dev/null +++ b/content/hoba/index.md @@ -0,0 +1 @@ +poka \ No newline at end of file diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000..016863f --- /dev/null +++ b/content/index.md @@ -0,0 +1 @@ +privet \ No newline at end of file diff --git a/static/custom.css b/static/custom.css new file mode 100644 index 0000000..e69de29 diff --git a/template.html b/template.html new file mode 100644 index 0000000..72ad7b1 --- /dev/null +++ b/template.html @@ -0,0 +1,17 @@ + + + + + + + + Arbuz? + + + +
+ {{%CONTENT%}} +
+ + + \ No newline at end of file