Catalin Constantin Mititiuc 766c9bad62 Use '_' instead of '.' for numbering cosmo escapes
because it gets syntax highlighted weird because '.' is not valid for
like a variable name so the syntax highlighter is splitting the escape
phrase at the '.' which means that phrase won't match when unescaped so
it fails to get unescaped

for example, this would fail:

```
 $$ct
```
2025-06-25 21:10:30 -07:00
2025-06-20 15:18:57 -07:00
2025-06-25 15:25:08 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:04 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-16 20:18:05 -07:00
2025-06-22 10:29:40 -07:00
2025-06-16 20:18:05 -07:00
2025-06-25 14:47:23 -07:00
2025-06-25 15:25:08 -07:00

requirements

pandoc utility must be installed

  • Debian Bookworm:

    $ apt-get update && apt-get install -y pandoc
    

start default openresty

  1. Run docker run --rm -it --init -w /opt -v $PWD:/opt -p 80:80 openresty/openresty:1.27.1.2-0-bookworm-buildpack
  2. Visit localhost in web browser.

start a custom site

build docker image

$ make image-build

rebuild an existing docker image

$ make image-rm image-build

generate a new site file

$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen new

add an index page

$ docker run --rm -w /opt/app -v $PWD:/opt/app miti.sh sitegen page /opt/app index

add to site.moon

add "index.md"

add config for nginx

$ mkdir logs/ conf/

# conf/nginx.conf
worker_processes  1;
error_log logs/error.log;
events {
    worker_connections 1024;
}
http {
    server {
        listen 8080;
        location / {
            default_type text/html;
        }
    }
}

build site

$ make build

build a single file

$ make build file=index.html

start dev server

$ make serve

Visit localhost:8080 in web browser

start watcher

$ docker exec -it container_name sitegen watch

run tests

$ make test

lint moonscript

$ make lint

print out pygments styles

$ pygmentize -S STYLE -f formatter

example:

$ pygmentize -S default -f html

deploy

$ make deploy

gotchas

What is error cosmo failed: [string "..."]:62: cannot resume dead coroutine?

If you call cosmo.yield, your function must return nil! If you forget to return nil, you will see this cryptic error:

Error: index.html -> html/index.html: cosmo failed: [string "..."]:62: cannot resume dead coroutine
make: *** [Makefile:6: build] Error 1`

What is error calling 'load_cache' on bad self?

moon: .../local/openresty/luajit/share/lua/5.1/sitegen/common.lua:41:
/usr/local/openresty/luajit/share/lua/5.1/sitegen/cache.lua:99: calling
'load_cache' on bad self (table expected, got userdata) stack traceback:

Delete your .sitegen_cache file.

thinking about

  • use sitecache with pandoc renderer
  • draft documents
  • treesitter highlighting for moonscript
Description
Source code for website miti.sh
Readme 8 MiB
Languages
MoonScript 42.7%
CSS 31.6%
Python 8.1%
HTML 7.5%
Dockerfile 3.3%
Other 6.8%