diff options
author | Eduardo Julian | 2019-02-05 20:30:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2019-02-05 20:30:13 -0400 |
commit | 60430ee6dfffbeb220a3e8fee7336d54313467bc (patch) | |
tree | e00b48c2af5354392f514347547340f67f71e708 /stdlib/source/program/licentia/document.lux | |
parent | c542e618266c2f321704bef381b14213c30cc2e0 (diff) |
Folded license-making program (legislator) into the Lux project proper (as licentia).
Diffstat (limited to 'stdlib/source/program/licentia/document.lux')
-rw-r--r-- | stdlib/source/program/licentia/document.lux | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/stdlib/source/program/licentia/document.lux b/stdlib/source/program/licentia/document.lux new file mode 100644 index 000000000..bb128807b --- /dev/null +++ b/stdlib/source/program/licentia/document.lux @@ -0,0 +1,47 @@ +(.module: + [lux (#- or and) + [data + ["." text + format] + [collection + [list ("list/." functor)]]]]) + +(def: #export (quote text) + (-> Text Text) + (format text.double-quote text text.double-quote)) + +(def: #export (block content) + (-> Text Text) + (format content text.new-line text.new-line)) + +(def: #export (plural singular) + (-> Text Text) + (format singular "(s)")) + +(def: #export (sentence content) + (-> Text Text) + (format content ".")) + +(def: #export paragraph + (-> (List Text) Text) + (|>> (list/map ..sentence) + (text.join-with text.new-line))) + +(do-template [<name> <word>] + [(def: #export <name> + (-> (List Text) Text) + (text.join-with (format ", " <word> " ")))] + + [or "or"] + [and "and"] + [and/or "and/or"] + ) + +(type: #export Section + {#title Text + #content Text}) + +(def: #export (section value) + (-> Section Text) + (format (block (get@ #title value)) + (get@ #content value))) |