all repos — h3rald @ c88d4d815569086d4562bf71e172eb5a61bc2dff

The sources of https://h3rald.com

scripts/project.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
;Generates a new project page.
""        :ident
""        :title
""        :subtitle
""        :summary
false     :github
""        :release
false     :valid-id

(
  (str) expect first :ident
  ident "^[a-z0-9-]+$" match? :valid-regexp
  (. "contents") => "/" join ls :filelist
  filelist (filename "(.+)\..+$" search 1 get) map ident in? not :valid-file
  valid-regexp valid-file and
) ^validate


(valid-id not) (
  "ID" ask @ident
  ident validate @valid-id
  (valid-id not) ("ID must not be already used and it must contain only lowercase letters, numbers, or -" warn!) when
) while

"Title"     ask @title
"Subtitle"  ask @subtitle
"Summary"   ask @summary
"version"   ask @release

"-----
id: $1
github: $1
home: /$1/
title: \"$2\"
subtitle: \"$3\"
summary: \"$4\"
content-type: project
active: true
version: $5
download: \"https://github.com/h3rald/$1/releases/download/\"
-----
" (ident title subtitle summary release) =% :metadata

metadata puts!
("Create project?" confirm) 
(
  (ident ".md") => "" join :fn 
  (. "contents" fn) => "/" join :path
  metadata path fwrite
) when