diff --git a/generate.py b/generate.py new file mode 100644 index 0000000..a6a93dd --- /dev/null +++ b/generate.py @@ -0,0 +1,45 @@ +from dataclasses import dataclass +from pathlib import Path +import re + + +@dataclass +class Article: + path: str + + def read_contents(self) -> str: + return Path(self.path).read_text() + + +articles = [ + Article( + "./input/art-001.html", + ), +] + +# generate slugs and read articles +slugs = [] +article_contents = [] +for article in articles: + contents = article.read_contents() + id_match = re.search(r'

{title}

""" + slugs.append(slug) + +# plug into template, write to index.html +template = Path("./input/template.html").read_text() +template = template.replace( + "
", "\n".join(article_contents) +) +template = template.replace("
", "\n".join(slugs)) +with open("./index.html", "w", encoding="utf-8") as index_html: + index_html.write(template) diff --git a/index.css b/index.css new file mode 100644 index 0000000..cbfcff8 --- /dev/null +++ b/index.css @@ -0,0 +1,19 @@ +:root { + --text-color: #f7f7f7; + --bg-color: #19232f; +} + +@media (prefers-color-scheme: light) { + :root { + --text-color: #222430; + --bg-color: #f7f7f7; + } +} + +@media only screen and (min-width: 768px) { + .container { + display: grid; + grid-template-columns: 2.75fr 1.25fr; + margin-top: 2rem; + } +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..3bb0d76 --- /dev/null +++ b/index.html @@ -0,0 +1,28 @@ + + + + + + Page Title + + + + +
+

Page Header

+
+ +
+
+
+

My Article Title

+

Any HTML you please

+
+

Also any HTML you please, I like to put images between articles

+
+
+

My Article Title

+
+
+ + diff --git a/input/art-001.html b/input/art-001.html new file mode 100644 index 0000000..894e46b --- /dev/null +++ b/input/art-001.html @@ -0,0 +1,5 @@ +
+

My Article Title

+

Any HTML you please

+
+

Also any HTML you please, I like to put images between articles

diff --git a/input/template.html b/input/template.html new file mode 100644 index 0000000..4033343 --- /dev/null +++ b/input/template.html @@ -0,0 +1,24 @@ + + + + + + Page Title + + + + +
+

Page Header

+
+ +
+
+
+
+
+
+
+
+ +