1. 29
  1. 12

    Comprised of just a few Forth CGI scripts…

    Ok, you have my attention…

    1. 7

      Content is stored as Gemtext, the lightweight markup language of the Gemini protocol.

      and it lost mine…

      1. 5

        gemtext desperately needs some text formatting

    2. 4

      It’s always nice to see another Forth programmer’s code. Stuff like image-extension? is always strange to me. Forth is really the first programming language I picked up and ran with to write fun programs, and the idea of this kind of case-statement equivalent never occured to me - it always seemed nicer to e.g. write a word to take the extension from the string and execute it or fail: : .jpg html:image ; and build a dictionary up from using data as code (as opposed to Lisp’s code as data, something that defines the difference in approach for me). Example of what I mean:

      : image-extension? ( c-addr u -- f )
          2dup s" .bmp" string-suffix? r>
          2dup s" .svg" string-suffix? r> or >r
          s" .webp" string-suffix? r> or ;
      

      vs.

      : string-extension  ( c-addr u) ... ; \ short loop from end of string to last .
      : .bmp   html:image; : .svg   html:image ; \ etc... (could be done w some CREATE DOES> or wtv magic)
      : .mp4   html:video; \ other extensions
      : Content-Type ( c-addr u)   drop find dup if evaluate else 2drop then ; \ can't really remember how evaluate works but you get the idea
      

      Just seems more forth-y to me. Cool project anyhow!