all repos — min @ ab455edbaff6ba083df1154078e2eaaef624fcfb

A small but practical concatenative programming language.

tasks/help.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
 59
 60
 61
 62
 63
 64
 65
 66
 67
"help/snippets.json" fread from-json :snippets
"site/contents" ls ("reference-" match) filter =src-files
"\{\#op\|\|([^|]+)\|\|([^|]+)\|\|([^|]+)\|\|([^#])+\#\}" :op-regex
"\{\\{([^}]+)\}\}" :snippet-regex
">( >)*" :block-regex
"%([^%]+)%" :title-regex

(
    symbol process-block-markup
    (string :s ==> string :result)
    (
        s 
            block-regex (pop "") replace-apply
            title-regex (pop "") replace-apply
        @result
    )
) ::
;; Simplify block-level markup

(
    symbol process-snippets
    (string :s ==> string :result)
    (
        s snippet-regex (
            1 get :id
            snippets id dget
        ) replace-apply @result
    )
) ::
;; Resolves documentation snippets.

(
    symbol process
    (string :s ==> string :result)
    (
        s process-snippets process-block-markup strip @result
    )
) ::
;; Processes documentation snippets and markup.

(
    symbol process-op
    (quot :matches ==> dict :data)
    (
        {}
            matches 1 get process %name
            matches 2 get process %input
            matches 3 get process %output
            matches 4 get process %description
        @data
    )   
) ::
;; Processes operator reference documentation.

(
    symbol default
    (==>)
    (
        src-files (
            fread op-regex search-all (
                process-op :op
                op
            ) foreach
        ) foreach
    )
) ::
;; Builds the reference help JSON sources.