Git Product home page Git Product logo

chai's Introduction

chai

a static html gallery generator written in owl lisp

work in progress, i may or may not introduce breaking changes

why

as a fast alternative to my cringe perl cgi script that used to power my website.

dependencies

how

$ git clone --recursive https://github.com/krzysckh/chai
$ cd chai
$ make
# make install

then, create your galleries like this:

- my-gallery/
  - config.scm
  - photos-from-somewhere/
    - index.scm
    - ....jpg
    - ....png
    - ...
  - photos-from-somewhere-else/
    - index.scm
    - ...

config.scm, and every index.scm will be (eval)'d at runtime, and they must return these association lists:

; config.scm:
'((css . use-default)                 ; this setting is not implemented yet
  (gallery-template . use-default)    ; explained below
  (index-template . use-default)      ; explained below
  (page-name . "example gallery")     ; the <title> and the <h1> title
  (output-directory . "public_html")) ; output directory under my-gallery
; index.scm
'((gallery-name . "gallery name here")      ; name of the gallery (the title)
  (date . (07 9 2023))                      ; day month year
  (description . "description")             ; self-explanatory
  (private . #t)                            ; if #t, add .htpasswd to dir.
  (htpasswd . "/etc/httpd/conf/.htpasswd")) ; this can be skipped when
                                            ; private = #f

'use-default can be used if you don't want to write your own {gallery,index}-template. Though if you want to, a template is a function that takes the body of a given page, so for example, an index-template could be implemented like this:

; config.scm
`((css . use-default)
  (gallery-template . use-default)
  (page-name . "example gallery")
  (output-directory . "public_html")
  (index-template . ,(lambda (idx)
                       `(html
                          (body
                            (p "this will be an index to the gallery")
                            ,idx
                            ((a (href . "https://example.com"))
                             "a link to example.com"))))))

Note that index-template is not just plain html, it's html written in s-expressions (cool!!). This is what (robusta encoding html) does. To get to know more, look at chai/defaults.scm, which defines default pages as (robusta encoding html) expressions.

caveats

  • chai doesn't try to sort the galleries in the index by date. sorry (for now),
  • user-defined css doesn't work yet,
  • the man page sucks

krzysckh 2023, 2024
krzysckh.org

chai's People

Contributors

krzysckh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.