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 |
'hastysite import ; Copy PDF files saved in asset folder ; to the corresponding article output folder. ( (dict) expect -> =asset asset /id :id id "^pdf\/(.+)$" search 1 get :name asset "output/articles/$1/$1" (name) => % %id #asset asset output-cp ) :copy-pdf-article-asset ; Process a content file applying the appropriate template ; and compiling markdown to HTML if necessary. ( (dict) expect -> =content content /content-type :ct content /id :id "page" :tpl (ct "article" ==) ("article" @tpl) when (id "index" ==) ("home" @tpl) when "" :page "" :contents content ( (input-fread @contents content) ((/ext ".md" ==) (=temp contents temp markdown @contents temp) when) (contents %contents) (=temp tpl temp mustache @page temp) (page %contents) ((id "index" !=)("$1/index" (id) => % %id ".html" %ext) when) ) tap ) :process-content ;;;; MAIN ;;;; contents (process-content output-fwrite) foreach ; Process all assets. assets ( dup ( ((/id "^pdf\/" match) (copy-pdf-article-asset)) ;((/ext ".css" match) (process-css-asset)) ((true) (output-cp)) ) case ) foreach |