X-Git-Url: https://git.ladys.computer/x_status_git/blobdiff_plain/8e2067811887c23a4b41beae30f6f7cca9465a08..3394dfeb4194ca630becdb4d34538a3370d47ca8:/post-receive?ds=inline diff --git a/post-receive b/post-receive index 94620be..e1da847 100755 --- a/post-receive +++ b/post-receive @@ -70,6 +70,11 @@ if stdin.read().split()[-1] == f"refs/heads/{LIVE_BRANCH}": status["author"] = { "name": author_path.name[2:] } with author_path.open("r", encoding="utf-8") as text: status["author"]["@id"] = text.read().strip() + title_path = next(path.parent.glob("2=*")) + if title_path: + with title_path.open("r", encoding="utf-8") as text: + title = text.read().strip() + status["title"] = title date_path = next(path.parent.glob("3=*")) datetime = "" if date_path: @@ -128,11 +133,18 @@ if stdin.read().split()[-1] == f"refs/heads/{LIVE_BRANCH}": # Copy H·T·M·L files to their expected locations. copy2(f"{BUILD_DIRECTORY}/index.html", f"{PUBLIC_DIRECTORY}/index.html") + copy2(f"{BUILD_DIRECTORY}/about.html", f"{PUBLIC_DIRECTORY}/.about.html") copy2(f"{BUILD_DIRECTORY}/status.html", f"{PUBLIC_DIRECTORY}/.status.html") copy2(f"{BUILD_DIRECTORY}/statuses.html", f"{PUBLIC_DIRECTORY}/.statuses.html") copy2(f"{BUILD_DIRECTORY}/topic.html", f"{PUBLIC_DIRECTORY}/.topic.html") copy2(f"{BUILD_DIRECTORY}/topics.html", f"{PUBLIC_DIRECTORY}/.topics.html") + # Output “about” metadata + if not exists(f"{PUBLIC_DIRECTORY}/about"): + mkdir(f"{PUBLIC_DIRECTORY}/about") + with open(f"{PUBLIC_DIRECTORY}/about/index.jsonld", "w", encoding="utf-8") as f: + json.dump({ "@context": { "@language": LANG, "activity": "https://www.w3.org/ns/activitystreams#", "sioc": "http://rdfs.org/sioc/ns#", "sioct": "http://rdfs.org/sioc/types#", "Forum": "sioc:Forum", "Thread": "sioc:Thread", "Microblog": "sioct:Microblog", "streams": { "@id": "activity:streams", "@type": "@id" } }, "@id": f"{PUBLIC_URL}", "@type": "Microblog", "streams": [{ "@id": f"{PUBLIC_URL}/statuses", "@type": "Thread" }, { "@id": f"{PUBLIC_URL}/topics", "@type": "Forum" }] }, f, ensure_ascii=False, allow_nan=False) + # Output month‐based listings and the non‐topic index statuspairs = list(enumerate(months.items())) for (index, (yyyy_mm, ld)) in statuspairs: @@ -149,7 +161,7 @@ if stdin.read().split()[-1] == f"refs/heads/{LIVE_BRANCH}": if not exists(f"{PUBLIC_DIRECTORY}/statuses"): mkdir(f"{PUBLIC_DIRECTORY}/statuses") with open(f"{PUBLIC_DIRECTORY}/statuses/index.jsonld", "w", encoding="utf-8") as f: - json.dump({ "@context": { "@language": LANG, "activity": "https://www.w3.org/ns/activitystreams#", "sioc": "http://rdfs.org/sioc/ns#", "OrderedCollection": "activity:OrderedCollection", "Thread": "sioc:Thread", "current": { "@id": "activity:current", "@type": "@id" }, "first": { "@id": "activity:first", "@type": "@id" } }, "@id": f"{PUBLIC_URL}/statuses", "@type": ["OrderedCollection", "Thread"], "first": f"{PUBLIC_URL}/{statuspairs[0][1][0]}", "current": f"{PUBLIC_URL}/{statuspairs[-1][1][0]}" }, f, ensure_ascii=False, allow_nan=False) + json.dump({ "@context": { "@language": LANG, "activity": "https://www.w3.org/ns/activitystreams#", "sioc": "http://rdfs.org/sioc/ns#", "OrderedCollection": "activity:OrderedCollection", "Thread": "sioc:Thread", "current": { "@id": "activity:current", "@type": "@id" }, "first": { "@id": "activity:first", "@type": "@id" }, "has_parent": { "@id": "sioc:has_parent", "@type": "id" } }, "@id": f"{PUBLIC_URL}/statuses", "@type": ["OrderedCollection", "Thread"], "first": f"{PUBLIC_URL}/{statuspairs[0][1][0]}", "current": f"{PUBLIC_URL}/{statuspairs[-1][1][0]}", "has_parent": f"{PUBLIC_URL}" }, f, ensure_ascii=False, allow_nan=False) # Output topic‐based listings and the topic index if not exists(f"{PUBLIC_DIRECTORY}/topics"): @@ -160,7 +172,7 @@ if stdin.read().split()[-1] == f"refs/heads/{LIVE_BRANCH}": with open(f"{PUBLIC_DIRECTORY}/topics/{topic}/index.jsonld", "w", encoding="utf-8") as f: json.dump(ld, f, ensure_ascii=False, allow_nan=False) with open(f"{PUBLIC_DIRECTORY}/topics/index.jsonld", "w", encoding="utf-8") as f: - json.dump({ "@context": { "@language": LANG, "activity": "https://www.w3.org/ns/activitystreams#", "dct": "http://purl.org/dc/terms/", "sioc": "http://rdfs.org/sioc/ns#", "Collection": "activity:Collection", "Forum": "sioc:Forum", "items": { "@id": "activity:items", "@type": "@id" }, "subject": "dct:subject" }, "@id": f"{PUBLIC_URL}/topics", "@type": ["Collection", "Forum"], "items": list(map(lambda a: { "@id": a["@id"], "subject": a["subject"] }, topics.values())) }, f, ensure_ascii=False, allow_nan=False) + json.dump({ "@context": { "@language": LANG, "activity": "https://www.w3.org/ns/activitystreams#", "dct": "http://purl.org/dc/terms/", "sioc": "http://rdfs.org/sioc/ns#", "Collection": "activity:Collection", "Forum": "sioc:Forum", "items": { "@id": "activity:items", "@type": "@id" }, "has_parent": { "@id": "sioc:has_parent", "@type": "id" }, "subject": "dct:subject" }, "@id": f"{PUBLIC_URL}/topics", "@type": ["Collection", "Forum"], "items": list(map(lambda a: { "@id": a["@id"], "subject": a["subject"] }, topics.values())), "has_parent": f"{PUBLIC_URL}" }, f, ensure_ascii=False, allow_nan=False) # Remove the build directory. rmtree(BUILD_DIRECTORY)