#!/bin/sh #llllmmmm11234567892123456789312345678941234567895123456789612345678971234567890 # vim: syntax=:ts=8 set -ex <"$0" python3 -c ' import os, sys class File: attributes = []; content = ""; substitutions = dict() figurative = True; stub = True def addattribute(self, *args): for a in args: # sloppy but works if a == "stub": self.stub = True elif a == "verbatim": self.stub = False elif a == "figuratively": self.figurative = True elif a == "literally": self.figurative = False def __init__(self, **kwargs): for key in kwargs: if key == "attributes": self.addattribute(*kwargs[key]) else: setattr(self, key, kwargs[key]) files = dict() for part in reversed(sys.stdin.read().split("\n\n\n")): name = "." + part.split("\n")[0] if "\t" in "." + name: attributes = name.split("\t")[1].split(",") name = name.split("\t")[0] else: attributes = [] if len(name) <= 1 or name[1] != "/" or "ignore" in attributes: continue content = part.split("\n\n")[0].split("\n") substitutions = dict() if(len(content) > 1): for s in content[1:]: s = s.split("\t") if len(s) == 2: substitutions[s[0]] = s[1] mode = "replace" for attribute in attributes: if attribute in ["append", "replace"]: mode = attribute attributes = list(set(attributes) ^ {"append", "replace"}) content = part[len("\n".join(content))+2:] file = File(attributes = attributes, content = content + "\n", substitutions = substitutions) if mode == "append": if not(name in files): sys.stderr.write(sys.argv[0] + ": " + name + ": " + "appending to nothing\n") else: file.content = files[name].content + file.content files[name] = file for name in files: if files[name].stub: p = ""; s = ""; d = name while True: d = os.path.dirname(d) if (p == "" and os.path.join(d, "Prefix") in files.keys()): p = files[os.path.join(d, "Prefix")].content if (s == "" and os.path.join(d, "Suffix") in files.keys()): s = files[os.path.join(d, "Suffix")].content if d == "." or (not(p == "") and not(s == "")): break files[name].content = p + files[name].content + s if files[name].figurative: content = files[name].content for s in files[name].substitutions: instances = [] i = 0 while True: instance = content.find(s, i) if instance == -1: break instances += [instance] i = instance + len(s) if len(instances) == 0: continue for i in reversed(instances): content = (content[:i] + files[name].substitutions[s] + content[i+len(s):]) files[name].content = content # TODO error checking if not(os.path.isdir(os.path.dirname(name))): os.makedirs(os.path.dirname(name)) with open(name, "w") as fd: fd.write(files[name].content) d = ""; bucket = "#!/bin/sh\n" for name in files: d = name while True: if os.path.dirname(d) == ".": mop = ("rm " + "-r " * os.path.isdir(d) + name # yeah this sucks + "\n" ) if not(mop in bucket): bucket += mop break else: d = os.path.dirname(d) if len(bucket.split("\n")) > 2: with open("./cleanup.sh", "w") as fd: fd.write(bucket) ' test -x homepage.local \ && exec ./homepage.local \ || test -e homepage.local \ && exec sh ./homepage.local \ || exit 0 /CNAME verbatim www.trinity.moe /BANNER.txt verbatim /\ |/||\|| _\|||\ |||||/||\|\\// |\ /|/ \||\| / \ || || /|||\\|||| || || ||\/|| | ||> /____\ _||__||\\||||\\|||__||_ _||_()||\/||\_/||/| /license.html

Except where noted, www.trinity.moe is available under the Blue Oak Model License 1.0.0 as defined below.

Blue Oak Model License, Version 1.0.0

Purpose
	This license gives everyone as much permission to work with this
software as possible, while protecting contributors from liability.

Acceptance
	In order to receive this license, you must agree to its rules. The
rules of this license are both obligations under that agreement and conditions
to your license. You must not do anything with this software that triggers a
rule that you cannot or will not follow.

Copyright
	Each contributor licenses you to do everything with this software that
would otherwise infringe that contributor's copyright in it.

Notices
	You must ensure that everyone who gets a copy of any part of this
software from you, with or without changes, also gets the text of this license
or a link to .

Excuse
	If anyone notifies you in writing that you have not complied with the
Notices, you can keep your license by taking all practical steps to comply
within 30 days after the notice.  If you do not do so, your license ends
immediately.

Patent
	Each contributor licenses you to do everything with this software that
would otherwise infringe any patent claims they can license or become able to
license.

Reliability
	No contributor can revoke this license.

No Liability
	As far as the law allows, this software comes as is, without any
warranty or condition, and no contributor will be liable to anyone for any
damages related to this software or this license, under any kind of legal
claim.
/homepage.html $!TITLE "homepage" documentation $!DESCRIPTION one file, one website

"homepage" documentation

the forest

homepage is a single-file static site generator written in UNIX sh(1) shell script, the goal being to contain a website with heirarchical page organization within a single file that can be run to extract it out to the filesystem, almost like a self-extracting UNIX tape archive that documents its own layout in a UTF-8 script closer to English.

trees

files

To add a file to your homepage, append three newlines ('\n', or the Enter/Return key on your keyboard) to the end of the homepage file, followed by the path of the file to add. A homepage file path starts with a slash ('/') and is followed by the path to the file relative to the prefix directory (the directory containing homepage). A file path that starts with a hash ('#') is discarded. For all non-slash- non-hash- prefixed file paths, the behavior of homepage is undefined.

file attributes

On the same line as the file path, if, after the path, a tab ('\t') is present, the substring following the first tab in the line and spanning to and excluding the next tab or newline describes the attributes of the file as it is exported to the file system. These file attributes are delimited by commas (',') and there's no limit to the amount of attributes a file can have, though in the event of conflicting attributes the later attribute "wins" the conflict.

attribute default?action
"figuratively"yes Indicates the file should be subject to macro expansion.
"ignore" no Ignore the current entry.
"literally" no Opposite of "figuratively".
"stub" yes Indicates the file should be exported to the filesystem with the appropriate Prefix and Suffix files prepended or appended.
"verbatim" no Opposite of "stub".
/praise/index.html append,literally
  • [] Doctor Eli Selig !!JQHA6kqyl91: >Maid Phone user / >mfw / ["Heart hands.jpg"]
  • /praise/Prefix verbatim