Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkSuckerberg committed Mar 1, 2024
1 parent 6628e37 commit 18daa58
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 36 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
output/*.html
23 changes: 17 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
@@ -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"<div id='{input_filename}'>")
with open(f"reports/{input_filename}") as input:
target.write(mistletoe.markdown(input))
target.write("</div>\n<br><hr><br>\n")
target.write(f"<details id='{input_filename}'>")
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"<summary>{title.text}</summary>\n")

#Write the report content
target.write(content)
target.write("</details>\n<br><hr>\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())
Expand Down
26 changes: 26 additions & 0 deletions output/common.css
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 1 addition & 1 deletion reports/report-3.md
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
mistletoe==0.9.0
beautifulsoup4==4.12.2
31 changes: 2 additions & 29 deletions templates/header.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Shiptest Progress Reports</title>
<!--Credit for modified style: https://github.com/KeenRivals/bestmotherfucking.website-->
<style>
@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;
}
</style>
<link rel="stylesheet" href="common.css" />
</head>
<body>
<h1>Shiptest Development Logs</h1>
<hr/>
<hr />

0 comments on commit 18daa58

Please sign in to comment.