]> site info

site info

it was displeased with its previous state of not having a website, and thus chose to remedy this. now it has a place to put all of its silly little thoughts.[1]in addition to the aforementioned purpose, this site also exists because:

webocodynamics of natalieee.net

natalieee.net is accessible through a few other domains:



static site generator

this site uses a custom-build static site generator written in hy. the design of this static site generator is rather unique: it compiles quoted hy[4] forms to html such that the structure of a quoted hy form is the structure of the output html. this allows it to do useful things like placing unquoted code inside of quoted documents, functionally creating a macro system where it can run arbitrary code at website generation time.

most of the time—such as with the comment section at the bottom of pages—this ability is used not for running hy code, but instead for invoking shell scripts that output html, however there are a few instances of hy code being envoked on its own. an example of hy code being envoked on its own would be the part of the home page where 88x31s are displayed. that is generated at compile time by parsing a yaml file that specifies the src, href, alt, and optionally title property of each 88x31.



static site generator example:
input
`(html (:lang en)
  (head
    (link (:rel stylesheet :href "/assets/style.css" :type "text/css")))
  (body
    (h1 (:id example) meow)
    (p ~(.join " " ["mrrp" "mrow" "meow"]))))
output
<html lang="en">
  <head>
    <link rel="stylesheet" href="/assets/style.css" type="text/css">
  </head>
  <body>
    <h1 id="example">meow</h1>
    <p>mrrp mrow meow</p>
  </body>
</html>

this design is very nice, because this way it does not have to write closing tags. the experience of writing lisp is much less cumbersome than the experience of writing xml-like syntax—at least without doing an unpleasant amount of vim configuring. the means of running code at compile time is also much nicer than any templating system it has found, as it is as simple as unquoting a lisp form. also, it allows for templating, as this one can just write functions that go inside of quoted forms that return more quoted forms when called.



http server

the web server is pretty unremarkable in most ways. it is more or less what anyone would write if they were instructed to write an http server in hy. it does, however, have one unique feature: upon a page being requested, all instances of $[] on that page are interpreted as bash code, and replaced with the result of executing said bash code.

this allows for compiled pages to be rendered with up-to-date information at page request time. it also allows arbitrary scripts to be run at request time. this is very helpful, because it means that it does not need to use demon technologies like javascript to achieve such things as the comments function or the "page rendered at" time in the footer



further example of the static site generator:
the template that gets called to create the comments below:
(import urllib.parse [quote-plus])
 
(defn comments [route]
  `(section (:class comments)
    (div
      (h2 comments)
      (p "as an anti-bot measure, in order for $VIEWER's comment to be stored on the server, $VIEWER" (span (:style "font-weight: bold") " MUST ") 
        "enter the commit hash of the current deployment found in the bottom right of the page footer. failure to do so will result in the comment being disregarded.")
 
      (form (:id comment :method post :action ~f"/comment?route={route}" :autocomplete off)
        (textarea (:id comment :name comment :placeholder comment :required True :maxlength 2048))
        (input (:id name :type text :name name :placeholder username :required True :maxlength 32))
        (input (:id website :type text :name site :placeholder "website (not required)" :maxlength 256))
        (input (:id commit :type text :name commit :placeholder "commit" :maxlength 8))
        (input (:id submit :type submit :value post))))
    
    (~f"$[ls -r ./www/data/comments/{(quote-plus route :safe "")} | xargs -I# cat ./www/data/comments/{(quote-plus route :safe "")}/#]")))

this code gets executed at compile time, however the compiled output contains the $[] string, and thus that part gets executed at page serve time such that comments are update every page load instead of only at compile time.

see also: its fedi[1] in its opinion[2] which changes not infrequently[3] which is a lisp[4]

comments

as an anti-bot measure, in order for $VIEWER's comment to be stored on the server, $VIEWER MUST enter the commit hash of the current deployment found in the bottom right of the page footer. failure to do so will result in the comment being disregarded.