Compare commits
No commits in common. "969d7ee5c11d04beb81d4332fd06810636e8b2d1" and "3571b643d4917ca33cfb96e625896264c12c79bc" have entirely different histories.
969d7ee5c1
...
3571b643d4
@ -1,7 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
set +e
|
||||
|
||||
mkdir -p ./html/articles
|
||||
|
||||
./tools/main_page_generator.py ./articles | ./tools/mmd/build/multimarkdown > ./html/index.html
|
||||
@ -11,5 +9,3 @@ for d in ./articles/*; do
|
||||
./tools/article_wrapper.py "$d/page.mmd" | ./tools/mmd/build/multimarkdown > "./html/articles/$(basename -- $d).html"
|
||||
fi
|
||||
done
|
||||
|
||||
./tools/feed_generator.py ./articles/ https://mjestecko.neocities.org/ > ./html/feed.xml
|
||||
|
@ -1,5 +1,20 @@
|
||||
import time, subprocess
|
||||
|
||||
MONTHS = {
|
||||
1: "January",
|
||||
2: "February",
|
||||
3: "March",
|
||||
4: "April",
|
||||
5: "May",
|
||||
6: "June",
|
||||
7: "July",
|
||||
8: "August",
|
||||
9: "September",
|
||||
10: "October",
|
||||
11: "November",
|
||||
12: "December"
|
||||
}
|
||||
|
||||
def the_line_after_metadata(lines: []) -> int:
|
||||
i = 0
|
||||
while lines[i].strip():
|
||||
|
@ -5,8 +5,8 @@
|
||||
from sys import argv, exit
|
||||
import time
|
||||
|
||||
from article_utils import the_line_after_metadata, parse_metadata
|
||||
from page_shares import wrap_page, MONTHS
|
||||
from article_utils import the_line_after_metadata, parse_metadata, MONTHS
|
||||
from page_shares import wrap_page
|
||||
|
||||
if len(argv) <= 1:
|
||||
print("No file was supplied")
|
||||
|
@ -1,64 +0,0 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
from sys import argv, exit
|
||||
from os import walk, path
|
||||
from random import choice, seed
|
||||
from textwrap import indent
|
||||
import time, urllib.parse, re, subprocess
|
||||
|
||||
from article_utils import parse_metadata
|
||||
from page_shares import ADJECTIVES
|
||||
from rfc822 import stringify_date
|
||||
|
||||
if len(argv) <= 1:
|
||||
print("No directory was supplied")
|
||||
exit(-1)
|
||||
|
||||
if len(argv) <= 2:
|
||||
print("No address was supplied")
|
||||
exit(-1)
|
||||
|
||||
seed()
|
||||
|
||||
address = argv[2]
|
||||
|
||||
# todo: Find the latest pubDate
|
||||
feed = f"""<rss version="2.0">
|
||||
<channel>
|
||||
<title>mjestečko</title>
|
||||
<link>{address}</link>
|
||||
<description>Personal blog of one {choice(ADJECTIVES)} Veclav Talica</description>
|
||||
<language>en</language>
|
||||
<lastBuildDate>{stringify_date(time.gmtime(int(time.time())))}</lastBuildDate>
|
||||
"""
|
||||
|
||||
body_taker = re.compile(r"<body>(.*)</body>", re.DOTALL)
|
||||
|
||||
for root, dirs, _ in walk(argv[1]):
|
||||
for d in dirs:
|
||||
metadata = parse_metadata(path.abspath(root + '/' + d + "/page.mmd"))
|
||||
feed += (
|
||||
" <item>\n"
|
||||
f""" <title>{metadata.get("Title", "No title!? ;-;")}</title>\n"""
|
||||
)
|
||||
body = subprocess.getoutput(f"./tools/mmd/build/multimarkdown {root}/{d}/page.mmd")
|
||||
feed += (
|
||||
" <description>\n"
|
||||
" <![CDATA[\n"
|
||||
f"{indent(body_taker.search(body)[1], ' ' * 12)}\n"
|
||||
" ]]>\n"
|
||||
" </description>\n"
|
||||
)
|
||||
if "Date" in metadata:
|
||||
feed += \
|
||||
f""" <pubDate>{stringify_date(metadata["Date"])}</pubDate>\n"""
|
||||
feed += (
|
||||
f""" <guid>/articles/{d}</guid>\n"""
|
||||
f""" <link>{address}/articles/{urllib.parse.quote(d)}</link>\n"""
|
||||
" </item>\n"
|
||||
)
|
||||
|
||||
feed += """ </channel>
|
||||
</rss>"""
|
||||
|
||||
print(feed)
|
@ -2,24 +2,24 @@
|
||||
|
||||
from sys import argv, exit
|
||||
from os import walk, path
|
||||
from random import choice, seed
|
||||
from random import choice
|
||||
import time, urllib.parse
|
||||
|
||||
from article_utils import parse_metadata
|
||||
from page_shares import wrap_page, ADJECTIVES, MONTHS
|
||||
from article_utils import parse_metadata, MONTHS
|
||||
from page_shares import wrap_page
|
||||
|
||||
if len(argv) <= 1:
|
||||
print("No directory was supplied")
|
||||
exit(-1)
|
||||
|
||||
seed()
|
||||
|
||||
page_metadata = """Title: mjestečko
|
||||
CSS: /style.css
|
||||
|
||||
"""
|
||||
|
||||
page = f"""Personal blog of one {choice(ADJECTIVES)} Veclav Talica.
|
||||
adjectives = ["*wild*", "**wacky**", "very humble", "**most serious**"]
|
||||
|
||||
page = f"""Personal blog of one {choice(adjectives)} Veclav Talica.
|
||||
|
||||
---
|
||||
|
||||
|
@ -9,7 +9,6 @@ HEAD_EMBED = """
|
||||
<ul class="nav">
|
||||
<li><a href="/">main page</a></li>
|
||||
<li><a href="https://git.poto.cafe/veclavtalica/mjestecko">source</a></li>
|
||||
<li><a href="/feed.xml">rss</a></li>
|
||||
<li><a href="/articles/mjestečko.html">about</a></li>
|
||||
</ul>
|
||||
|
||||
@ -27,32 +26,5 @@ TAIL_EMBED = """
|
||||
|
||||
"""
|
||||
|
||||
ADJECTIVES = ["*wild*", "**wacky**", "very humble", "**most serious**"]
|
||||
|
||||
MONTHS = {
|
||||
1: "January",
|
||||
2: "February",
|
||||
3: "March",
|
||||
4: "April",
|
||||
5: "May",
|
||||
6: "June",
|
||||
7: "July",
|
||||
8: "August",
|
||||
9: "September",
|
||||
10: "October",
|
||||
11: "November",
|
||||
12: "December"
|
||||
}
|
||||
|
||||
WEEKDAYS = {
|
||||
0: "Monday",
|
||||
1: "Tuesday",
|
||||
2: "Wednesday",
|
||||
3: "Thursday",
|
||||
4: "Friday",
|
||||
5: "Saturday",
|
||||
6: "Sunday"
|
||||
}
|
||||
|
||||
def wrap_page(page: str) -> str:
|
||||
return HEAD_EMBED + page + TAIL_EMBED
|
||||
|
@ -1,4 +0,0 @@
|
||||
from page_shares import MONTHS, WEEKDAYS
|
||||
|
||||
def stringify_date(date) -> str:
|
||||
return f"{WEEKDAYS[date.tm_wday][:3]}, {date.tm_mday} {MONTHS[date.tm_mon][:3]} {date.tm_year} {date.tm_hour:02d}:{date.tm_min:02d}:{date.tm_sec:02d} GMT"
|
Loading…
Reference in New Issue
Block a user