From 4514023ae0e87e7e9a7ad185dd8179d4a1af88f3 Mon Sep 17 00:00:00 2001 From: Ryan Fox Date: Fri, 24 Jul 2020 04:53:59 +0000 Subject: [PATCH] Add openring to my blog --- .gitignore | 1 + Makefile | 16 +++++++++++++- scripts/template.py | 3 +++ static/style.css | 49 ++++++++++++++++++++++++++++++++++++++++- templates/openring.html | 12 ++++++++++ templates/post.html | 3 +++ 6 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 templates/openring.html diff --git a/.gitignore b/.gitignore index 67f550c..82981f1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ ftp_url.txt music/* dist/ +temp/ scripts/__pycache__/ diff --git a/Makefile b/Makefile index f75040f..b831ac9 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ dist/%.html: pages/%.md | dist dist/%.html: pages/%.html | dist cp $< $@ -dist/blog/%.html: posts/%.md | dist/blog +dist/blog/%.html: posts/%.md dist/blog temp/openring.html scripts/template_md.py $< $@ dist/music/%.mp3: music/%.mp3 | dist/music @@ -30,6 +30,17 @@ $(POST_LISTS): $(POSTS_OUT) $(MUSIC_LISTS): music.json | $(OUTPUT_MUSIC) scripts/gen_music.py $< $@ +temp/openring.html: temp templates/openring.html scripts/openring/openring + scripts/openring/openring -l 256\ + -s http://jakob.space/feed.xml \ + -s https://drewdevault.com/feed.xml \ + -s https://deadfishsw.wordpress.com/feed.xml \ + < templates/openring.html \ + > temp/openring.html + +scripts/openring/openring: + cd scripts/openring && go build + dist/blog: mkdir -p dist/blog @@ -39,6 +50,9 @@ dist/music: dist: mkdir dist +temp: + mkdir temp + .PHONY: clean upload upload: dist diff --git a/scripts/template.py b/scripts/template.py index 5a167ed..02beb47 100644 --- a/scripts/template.py +++ b/scripts/template.py @@ -98,6 +98,9 @@ def template(content, path, ext, meta): with open("music.json", "r", encoding="utf-8") as file: music = json.loads(file.read()) meta["music_list"] = gen_music.gen_list(music, ext, limit=int(meta["music_list_limit"]), mini=True) + if "openring" in t_info[1] and t_info[1]["openring"] == "yes": + with open("temp/openring.html", "r", encoding="utf-8") as file: + meta["openring"] = file.read() meta["head"] += "\n" meta["content"] = content.format_map(meta) if "description" not in meta and meta["ext"] == ".html": diff --git a/static/style.css b/static/style.css index 2f37f4b..db87d1b 100644 --- a/static/style.css +++ b/static/style.css @@ -166,6 +166,53 @@ pre { white-space: pre-wrap; } +div.articles { + display: flex; + padding-top: 32px; + padding-bottom: 32px; +} + +div.article { + display: flex; + flex-direction: column; + padding-left: 16px; + padding-right: 16px; +} + +div.article:first-of-type { + padding-left: 0; + border-right: solid 2px #AAAAAA; +} + +div.article:last-of-type { + padding-right: 0; + border-left: solid 2px #AAAAAA; +} + +div.article h4 { + font-size: 18px; + line-height: 1.4; +} + +div.article p.summary { + font-size: 14px; + height: 100%; +} + +div.article p.extra { + color: #555555; + font-size: 14px; + line-height: 1.5; + margin-top: 0; + margin-bottom: 0; +} + +p.openring { + color: #555555; + font-size: 14px; + text-align: right; +} + @media only screen and (max-width: 950px) { header { height: 172px; @@ -270,7 +317,7 @@ pre { font-size: 30px; } - div.block { + div.block, div.articles { padding-top: 24px; padding-bottom: 24px; } diff --git a/templates/openring.html b/templates/openring.html new file mode 100644 index 0000000..71b0c2c --- /dev/null +++ b/templates/openring.html @@ -0,0 +1,12 @@ +

Articles from blogs that I like

+
+ {{range .Articles}} +
+

{{.Title}}

+

{{.Summary}}

+

From {{.SourceTitle}}
+ Published on {{.Date | date}}

+
+ {{end}} +
+

Generated with the spectacular power of openring

diff --git a/templates/post.html b/templates/post.html index bdf81e6..200e350 100644 --- a/templates/post.html +++ b/templates/post.html @@ -1,8 +1,11 @@ meta: yes head: +openring: yes template: page

{title}
Published on {date} by {author}

{content} +
+{openring}