all repos — min @ 314c9a11a145621f934d5d73fabab926c57c21f0

A small but practical concatenative programming language.

site/rules.min

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
'hastysite import
;Routing
(
  =meta
  meta /id :id
  meta /ext :ext
  (
    ((id "home" ==) (
      meta "index" %id #meta
      meta ".html" %ext #meta
    ))
    ((ext ".md" ==) (
      meta ".html" %ext #meta
      meta "$1/index" (id) % %id #meta
    ))
  ) case
  meta
) :set-destination

;Processing operators
(
  :tpl
  =meta
  meta /path :path
  " - Processing $1: $2" (tpl path) % notice
  meta input-fread :contents
  contents meta markdown @contents
  meta settings /title %site #meta
  meta contents %contents #meta
  tpl meta mustache :page
  meta page %contents #meta
  meta
) :process-md-with-template

(
  =meta
  meta /content-type :ct
  meta ct process-md-with-template
) :process-md-content

(
  =meta
  meta /ext :ext
  meta
  (
    ((".md" ext ==) (process-md-content))
  ) case
) :process-content

;Main
modified (
  dup
  (
    ((/id "^_includes" match) ()) ;Ignore files starting with underscore.
    ((asset?) (copy2output))
    ((content?) (process-content set-destination output-fwrite)) 
  ) case
) foreach