diff --git a/.gitignore b/.gitignore
index ab3e8ce..07d2806 100644
--- a/.gitignore
+++ b/.gitignore
@@ -162,3 +162,4 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
+output/
diff --git a/LICENSE b/LICENSE
index c783be6..e00417e 100644
--- a/LICENSE
+++ b/LICENSE
@@ -220,7 +220,7 @@ If you develop a new program, and you want it to be of the greatest possible use
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
python-webgen
- Copyright (C) 2025 ClariSys
+ Copyright (C) 2025 ChloeCat
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
diff --git a/README.md b/README.md
index 466434a..4f49b39 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,17 @@
# python-webgen
-a set of python scripts to generate a blog-style website from a set of markdown pages.
+a set of python scripts and html templates to generate blog-style websites
---
## Getting Started
-Welcome to your new KitsuDev Repo, ClariSys! Feel free to make this place your own!
+Welcome to your new KitsuDev Repo, ChloeCat! Feel free to make this place your own!
## Make your first push!
Once you're ready to push your files, use these commands to get to your spot!
```bash
-git remote add origin https://kitsunes.dev/ClariSys/python-webgen.git
+git remote add origin https://kitsunes.dev/ChloeCat/python-webgen.git
git branch -M main
git push -uf origin main
```
diff --git a/generate.py b/generate.py
new file mode 100644
index 0000000..8de9830
--- /dev/null
+++ b/generate.py
@@ -0,0 +1,23 @@
+import argparse
+from datetime import datetime
+
+# Argument Parser
+argparser = argparser = argparse.ArgumentParser(description = "Generate a .md file with a pre-filled title, date, etc.")
+argparser.add_argument("output", help = "The location to generate the template to")
+argparser.add_argument("--title", help = "The title of the article (default: Blog Post)", default = "Blog Post")
+argparser.add_argument("--author", help = "The name of the author (default: Blog Author)", default = "Blog Author")
+argparser.add_argument("-v", help = "more output", action = "store_true", dest = "verbose")
+args = argparser.parse_args()
+
+date = datetime.now().astimezone().strftime('%Y-%m-%dT%H:%M:%S%z')
+template = "+++\ntitle = '{}'\ndate = {}\nauthor = '{}'\ndraft = True\n+++"
+output = template.format(args.title, date, args.author)
+if args.verbose: print(template)
+
+# time to write the file :3
+with open(args.output, "w+") as file:
+ if args.verbose: print("Writing to {}...".format(args.output))
+ file.write(output)
+ print("Finished writing file to {}".format(args.output))
+
+print("Done.")
diff --git a/parser.py b/parser.py
new file mode 100644
index 0000000..79ad561
--- /dev/null
+++ b/parser.py
@@ -0,0 +1,89 @@
+# import modules
+import markdown as md
+
+# function definitions
+
+# convertFile(): takes in a path to a markdown file and
+# outputs an html snippet.
+def convertFile(infilePath):
+ rawfile = open(infilePath)
+ output = ""
+ isComment = False
+ for line in rawfile:
+ if "+++" in line:
+ if not isComment:
+ isComment = True
+ continue
+ else:
+ isComment = False
+ continue
+ if isComment:
+ continue
+ else:
+ output = output + line
+ output = md.markdown(output)
+ return output
+
+# getMetadata(): returns the metadata as a dictionary
+def getMetadata(infilePath):
+ rawfile = open(infilePath)
+ isComment = False
+ metadata = {}
+ for line in rawfile:
+ if "+++" in line:
+ if not isComment:
+ isComment = True
+ continue
+ else:
+ isComment=False
+ break
+ if isComment:
+ key = line.split(" = ")[0]
+ value = line.split(' = ')[1][:-1]
+ metadata[key] = value
+ if metadata[key] == "true":
+ metadata[key] = True
+ if metadata[key] == "false":
+ metadata[key] = False
+ if isinstance(metadata[key], str):
+ metadata[key] = metadata[key][1:-1]
+ return metadata
+
+# getTitle(): returns the title from the metadata
+def getTitle(infilePath):
+ return getMetadata(infilePath)['title']
+
+def convertDate(timestamp):
+ dateStr = ""
+ newTime = timestamp.split('T')[0]
+ date = newTime.split("-")
+ day = date[2].lstrip("0")
+ year = "20" + date[0][-2:]
+ match date[1]:
+ case "01":
+ month = "January"
+ case "02":
+ month = "February"
+ case "03":
+ month = "March"
+ case "04":
+ month = "April"
+ case "05":
+ month = "May"
+ case "06":
+ month = "June"
+ case "07":
+ month = "July"
+ case "08":
+ month = "August"
+ case "09":
+ month = "September"
+ case "10":
+ month = "October"
+ case "11":
+ month = "November"
+ case "12":
+ month = "December"
+ case _:
+ month = ""
+ return "{} {}, {}".format(day, month, year)
diff --git a/stitcher.py b/stitcher.py
new file mode 100644
index 0000000..4f82682
--- /dev/null
+++ b/stitcher.py
@@ -0,0 +1,35 @@
+import parser
+
+# function defs
+
+def generateBody(infilePath):
+ title = parser.getTitle(infilePath)
+ body = parser.convertFile(infilePath)
+ timestamp = parser.getMetadata(infilePath)["date"]
+ date = parser.convertDate(timestamp)
+ final = "