Compare commits

...

7 Commits

Author SHA1 Message Date
ktyl 1cc66385ab feat(rss): generate unformatted file titles
continuous-integration/drone/push Build is failing Details
2023-11-15 01:18:53 +00:00
ktyl 17c12cadf4 feat: add journal as submodule 2023-11-15 01:18:53 +00:00
ktyl a76793e961 ci(garden): add rule file requirements
continuous-integration/drone/push Build is passing Details
2023-11-15 01:18:08 +00:00
ktyl 5b938fe2fa ci(garden): build garden site files 2023-11-15 01:17:12 +00:00
ktyl 7f4cc152ca feat: add navigation 2023-11-12 02:30:03 +00:00
ktyl 9849fff782 build: add make targets 2023-11-12 02:30:03 +00:00
ktyl 6ed995de6c feat(garden): generate rss 2023-11-12 02:29:55 +00:00
9 changed files with 142 additions and 8 deletions

9
.gitmodules vendored
View File

@ -4,3 +4,12 @@
[submodule "blog"] [submodule "blog"]
path = blog path = blog
url = https://sauce.pizzawednes.day/ktyl/blog.git url = https://sauce.pizzawednes.day/ktyl/blog.git
[submodule "journal"]
path = sr/garden/journal
url = git@sauce.pizzawednes.day:ktyl/journal.git
[submodule "src/garden/period3.xyz"]
path = src/garden/period3.xyz
url = git@sauce.pizzawedney.day:ktyl/period3.xyz
[submodule "src/garden/journal"]
path = src/garden/journal
url = git@sauce.pizzawednes.day:ktyl/journal

View File

@ -15,6 +15,9 @@ BLOG_BUILD_DIR = $(BLOG_BASE_DIR)out/html/
BLOG_OUT_DIR = $(OUT_DIR)/blog BLOG_OUT_DIR = $(OUT_DIR)/blog
BLOG_INDEX = $(BLOG_BUILD_DIR)/index.html BLOG_INDEX = $(BLOG_BUILD_DIR)/index.html
GARDEN_BASE_DIR = $(SRC_DIR)/garden/
GARDEN_BUILD_DIR = $(GARDEN_BASE_DIR)html
PAGES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.html") PAGES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.html")
STYLES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.css") STYLES = $(shell find $(ROOT_DIR) -wholename "$(ROOT_DIR)*.css")
IMAGES = $(shell find $(IMG_DIR) -wholename "$(IMG_DIR)/*.png") IMAGES = $(shell find $(IMG_DIR) -wholename "$(IMG_DIR)/*.png")
@ -26,7 +29,8 @@ HTML_TARGETS = $(PAGES:$(ROOT_DIR)/%.html=$(OUT_DIR)/%.html)
CSS_TARGETS = $(STYLES:$(ROOT_DIR)/%.css=$(OUT_DIR)/%.css) CSS_TARGETS = $(STYLES:$(ROOT_DIR)/%.css=$(OUT_DIR)/%.css)
PNG_TARGETS = $(IMG_DIR)/%.png=$(OUT_DIR)/%.png PNG_TARGETS = $(IMG_DIR)/%.png=$(OUT_DIR)/%.png
all: html blog | $(OUT_DIR) all: html blog garden | $(OUT_DIR)
cp -r src/garden/html $(OUT_DIR)/garden
html: $(HTML_TARGETS) $(CSS_TARGETS) | $(OUT_DIR) html: $(HTML_TARGETS) $(CSS_TARGETS) | $(OUT_DIR)
cp $(IMG_DIR)/*.png $(OUT_DIR)/ cp $(IMG_DIR)/*.png $(OUT_DIR)/
@ -62,8 +66,12 @@ blog: $(HTML_INCLUDES) $(CSS_TARGETS)
cp $(CSS_TARGETS) `dirname $$page` ; \ cp $(CSS_TARGETS) `dirname $$page` ; \
done done
garden:
make --directory $(GARDEN_BASE_DIR) html
clean: clean:
make --directory $(GARDEN_BASE_DIR) clean
make --directory $(BLOG_BASE_DIR) clean make --directory $(BLOG_BASE_DIR) clean
rm -rf $(OUT_DIR) rm -rf $(OUT_DIR)
.PHONY: blog .PHONY: blog garden

18
src/garden/Makefile Normal file
View File

@ -0,0 +1,18 @@
html: feed.py Makefile
mkdir html
cp feed.py Makefile html
cp *.md html
clean-html:
[[ -d html ]] && rm -r html
.PHONY: clean-html
feed:
python feed.py `pwd`
rss: feed
clean: clean-html
.PHONY: feed clean

63
src/garden/feed.py Normal file
View File

@ -0,0 +1,63 @@
#!/usr/bin/env python3
import markdown
import pathlib
import sys
import re
import glob
import os
def print_usage():
print("\nusage: python feed.py ROOT\n")
print("\n")
print("\t\ROOT\tbase folder")
# check args for at most one file paths
if len(sys.argv) > 2:
print_usage()
sys.exit(1)
base_folder = sys.argv[1] if len(sys.argv) == 2 else os.getcwd()
print(base_folder)
def get_paths() -> [str]:
return [x for x in glob.glob(f"{base_folder}/*.md")]
def get_text(path):
with open(path) as f:
return f.read()
#def to_html(md : str) -> str:
# return markdown.markdown(md, extensions=["fenced_code"])
def get_title(md):
m = re.compile(r"^# (.+)\n").match(md)
if m is not None:
return m.groups(1)[0]
# truncated first line of file for auto-title
return md.splitlines()[0][0:30]
def get_entry(path):
return get_title(get_text(path))
def get_entries() -> [str]:
entries = [get_entry(p) for p in get_paths()]
return "\n\n".join(entries)
def get_header() -> str:
return """<?xml version="1.0" encoding="utf-8" ?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title></title>
<link>https://ktyl.dev/garden</link>
<description></description>
<atom:link href="https://ktyl.dev/garden/feed.xml" rel="self" type="application/rss+xml"/>
"""
def get_footer() -> str:
return "\n</channel></rss>"
print(get_header())
print(get_entries())
print(get_footer())

15
src/garden/feed.xml Normal file
View File

@ -0,0 +1,15 @@
python feed.py `pwd`
<?xml version="1.0" encoding="utf-8" ?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
<channel>
<title></title>
<link>https://ktyl.dev/garden</link>
<description></description>
<atom:link href="https://ktyl.dev/garden/feed.xml" rel="self" type="application/rss+xml"/>
Digital Gardens
RSS
</channel></rss>

5
src/garden/gardens.md Normal file
View File

@ -0,0 +1,5 @@
# Digital Gardens
* Obsidian
* Notion
* Git

1
src/garden/journal Submodule

@ -0,0 +1 @@
Subproject commit 6249b069e3c6f5a740141db60d7aac41ad50c11f

View File

@ -1,16 +1,30 @@
# RSS # RSS
Really Simple Syndication (RSS) is a an ancient file format for communicating updates over the Web. Really Simple Syndication (RSS) is an ancient file format for communicating updates over the Web, and my personal favourite.
## Stubs: * [It's Time for an RSS Revival](https://www.wired.com/story/rss-readers-feedly-inoreader-old-reader/)
* readers ### Stubs:
* feed generation
## YouTube Subscriptions * my curated feeds
* reader applications
## Technical Simplicity
From a technical perspective, like [Gemini](gemini://gemini.circumlunar.space) [\(HTTP\)](https://gemini.circumlunar.space/) it's grokkable with a couple good reads of the specification.
I wrote [a simple generator](https://ktyl.dev/blog/2022/6/3/rss.md)] for my blog posts, and am now working on [a simpler one](./feed.py) for the garden.
To start with, I'd like to generate it as simply as possible, from just a directory structure, but I can already see I'd like to do more with it.
I work predominantly in [Git](https://git-scm.com/) repositories, which, like a directory, or a garden, is tree-based.
My blog's feed has a chronological hierarchy, but at present it's based on manually creating and naming folders.
It's also very much a _published_ format, rather than a living one.
This is silly!
Instead, I'd like to structure my feed around a Git repository, as I think it'd be a much better descriptor of activity.
## Managing YouTube Subscriptions
There are many reasons to avoid the YouTube homepage, such as recommended videos or the accursed Shorts. There are many reasons to avoid the YouTube homepage, such as recommended videos or the accursed Shorts.
Since RSS feeds are published per-channel, it's totally possible to circumvent its subscription system entirely - including having to make an account - and keep track of channels one enjoys with RSS feeds instead. YouTube publishes channel-specific RSS feeds, making it totally possible to circumvent its subscription system entirely - including having to make an account - and keep track of channels one enjoys with RSS feeds instead.
Get a channel's ID: Get a channel's ID:
1. Go to the channel's page 1. Go to the channel's page

View File

@ -2,4 +2,5 @@
<li><a href="/about.html">about</a></li> <li><a href="/about.html">about</a></li>
<li><a href="/blog.html">blog</a></li> <li><a href="/blog.html">blog</a></li>
<li><a href="/gallery.html">gallery</a></li> <li><a href="/gallery.html">gallery</a></li>
<li><a href="/garden/index.html">garden</a></li>
</ul> </ul>