From 18daa58ecffc4d69c65a920bdff8e173c7d59875 Mon Sep 17 00:00:00 2001 From: Mark Suckerberg Date: Fri, 1 Mar 2024 12:40:46 -0600 Subject: [PATCH] updates --- .gitignore | 1 + main.py | 23 +++++++++++++++++------ output/common.css | 26 ++++++++++++++++++++++++++ reports/report-3.md | 2 +- requirements.txt | 1 + templates/header.html | 31 ++----------------------------- 6 files changed, 48 insertions(+), 36 deletions(-) create mode 100644 .gitignore create mode 100644 output/common.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0f998ca --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +output/*.html \ No newline at end of file diff --git a/main.py b/main.py index 4f34ee0..daa34ca 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,27 @@ import mistletoe +import bs4 import os #Write report from markdown file `input_filename` to file stream `target` def WriteReport(target, input_filename): - target.write(f"
") - with open(f"reports/{input_filename}") as input: - target.write(mistletoe.markdown(input)) - target.write("
\n


\n") + target.write(f"
") + with open(f"reports/{input_filename}", "r") as input: + #Parse the markdown file and convert it to HTML + content = mistletoe.markdown(input) + soup = bs4.BeautifulSoup(content, "html.parser") -with open("output/index.html", "x") as out: - with open("output/all.html", "x") as out_all: + #Find the first header in the report and use it as the summary + title = soup.h1 or soup.h2 or soup.h3 + target.write(f"{title.text}\n") + + #Write the report content + target.write(content) + target.write("
\n

\n") + +with open("output/index.html", "w") as out: + with open("output/all.html", "w") as out_all: filelist = os.listdir("reports") + filelist.sort(reverse=True) with open("templates/header.html") as header: out_all.write(header.read()) diff --git a/output/common.css b/output/common.css new file mode 100644 index 0000000..397f3a5 --- /dev/null +++ b/output/common.css @@ -0,0 +1,26 @@ +/* Credit for modified style: https://github.com/KeenRivals/bestmotherfucking.website */ +@media (prefers-color-scheme: dark){ + body {color:#fff;background:#000} + a:link {color:#cdf} + a:hover, a:visited:hover {color:#def} + a:visited {color:#dcf} +} +body{ + margin:1em auto; + max-width:40em; + padding:0 .62em; + font:1.2em/1.62 sans-serif +} +h1,h2,h3 { + line-height:1.2; + text-align:center; +} +@media print{ + body{ + max-width:none + } +} +blockquote{ + background: #272727; + border-left: 1px solid #fff; +} \ No newline at end of file diff --git a/reports/report-3.md b/reports/report-3.md index 0bc4c57..f95d702 100644 --- a/reports/report-3.md +++ b/reports/report-3.md @@ -1,4 +1,4 @@ -# Second Progress Report +# Second Progress Report - 08/17/2023 Been a while, huh? Yeah, we kind of forgot this existed. **MeeM** here. Usually, I'd be working on the wiki, or mapping a new thing, but we needed a new progress report, so I went to write one. diff --git a/requirements.txt b/requirements.txt index 513cb82..41771af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ mistletoe==0.9.0 +beautifulsoup4==4.12.2 diff --git a/templates/header.html b/templates/header.html index 2b08bbd..714b51b 100644 --- a/templates/header.html +++ b/templates/header.html @@ -5,35 +5,8 @@ Shiptest Progress Reports - - +

Shiptest Development Logs

-
+