#!/bin/sh #llllmmmm11234567892123456789312345678941234567895123456789612345678971234567890 set -ex <"$0" python3 -c ' import os, sys class File: attributes = [ # last in order wins in conflict, list must have both "literally", "figuratively", "append", "replace", "verbatim", "stub" ] content = "" substitutions = dict() def __init__(self, **kwargs): for key in kwargs: if key == "attributes": self.attributes += kwargs[key] else: setattr(self, key, kwargs[key]) files = {"./cleanup.sh": File(attributes=["verbatim"], content="#!/bin/sh\n")} 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] != "/": 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] content = part[len("\n".join(content))+2:] file = File(attributes = attributes, content = content, substitutions = substitutions) if file.attributes.index("append") > file.attributes.index("replace"): 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 name == "./cleanup.sh": continue attributes = files[name].attributes if name == "./js/quotes.json": print(attributes) directory = "/".join(name.split("/")[:-1]) if attributes.index("stub") > attributes.index("verbatim"): prefix = "" suffix = "" for d in directory.split("/"): if d + "/Prefix" in files.keys(): prefix = files[d + "/Prefix"].content if d + "/Suffix" in files.keys(): suffix = files[d + "/Suffix"].content files[name].content = prefix + files[name].content + suffix if attributes.index("figuratively") > attributes.index("literally"): 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 if not(os.path.isdir(directory)): os.makedirs(directory) files["./cleanup.sh"].content += "rm -r -- " + directory + "\n" elif directory == ".": files["./cleanup.sh"].content += "rm -- " + name + "\n" with open(name, "w") as fd: fd.write(files[name].content) if len(files["./cleanup.sh"].content.split("\n")) > 2: with open("./cleanup.sh", "w") as fd: fd.write(files["./cleanup.sh"].content) ' test -f homepage.local \ && exec ./homepage.local \ || exit 0 /LICENSE verbatim Other than noted exceptions, this is free and unencumbered data released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this data, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this data dedicate any and all copyright interest in the data to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this data under copyright law. THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE DATA OR THE USE OR OTHER DEALINGS IN THE DATA. For more information, please refer to /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.

In the absence of file attributes, the file will be exported to the filesystem, the appropriate Prefix and Suffix files will be prepended and appended respectively, and any requested macro substitutions will be performed.

The "verbatim" attribute indicates that the file should be exported to the filesystem without the appropriate Prefix and Suffix files prepended or appended. The "stub" attribute indicates the opposite, though its behavior is default.

The "literally" attribute indicates that the file should not be subject to macro expansion despite any other directives. The "figuratively" attribute indicates the opposite, though its behavior is default.

/praise/index.html append,literally
  • [] Doctor Eli Selig !!JQHA6kqyl91: >Maid Phone user / >mfw / ["Heart hands.jpg"]
  • /praise/Prefix